The flux out of any closed surface surrounding a system of charges
\[ \{ q_i \}_i\]
is \[\int \int S \mathbf{E} \cdot \mathbf{n} dS = \sum_i \frac{q_i}{\epsilon_0}\]
Proof
The potential at the point
\[(x,y,z)\]
on the surface due to the charge \[q_i\]
is \[\phi_i = \frac{q_i}{4 \pi \epsilon_0 r_i}\]
where \[r_i\]
is the position vector of \[(x,y,z)\]
relative to the charge.The electric field at
\[ on the surface due to the charge
The electric field due to the collection of charges is
The flux out of the surface
Now use Gauss's Theorem
to give
\[q_i\]
is \[\mathbf{E_i} = - \mathbf{\nabla} \phi_i = - \frac{q_i}{4 \pi \epsilon_0} \mathbf{\nabla} (\frac{1}{r_i}) = \frac{q_i}{4 \pi \epsilon_0} \frac{\mathbf{r_i}}{r^3_i} \]
The electric field due to the collection of charges is
\[\mathbf{E} = \sum_i \mathbf{E_i} = \sum_i \frac{q_i}{4 \pi \epsilon_0} \frac{\mathbf{r_i}}{r^3_i} \]
The flux out of the surface
\[S\]
is\[\int \int_S \mathbf{E} \cdot \mathbf{n} dS = \frac{1}{4 \pi \epsilon_0} \int \int_S \sum_i \frac{q_i \mathbf{r_i} \cdot \mathbf{n}}{r^3_i} dS\]
Now use Gauss's Theorem
to give
\[\frac{}{4 \pi \epsilon_0} \int \int_S \sum_i \frac{q_i \mathbf{r_i} \cdot \mathbf{n}}{r^3_i} dS=\frac{}{4 \pi \epsilon_0} \sum_i \frac{4 \pi q_i} = \sum_i \frac{q_i}{\epsilon_0} \]