# How to calculate free charge using Gauss law?

We have 3 point charges $Q_1, Q_2$ and $Q_3$ and know electric fields $E_1, E_2$ and $E_3$ ($E_1$ - field due to $Q_1$ etc., $E_1+E_2+E_3 = E$ is electric field in any point of space), and we enclose $Q_1$ and $Q_2$ with some surface, then if we wanted to get $\frac{Q_1+Q_2}{\epsilon_0}$ (right side of Gauss law) what field should sum over surface (left side of Gauss law)? $E_1+E_2$ (field due to enclosed charges) or $E$(the electric field)?

In other words is $E$ in Gauss law ( $\oint_S\vec E d\vec A = \frac{Q}{\epsilon_0}$) field due to all charges or only ones enclosed in some surface S?

If $Q_3$ isn't enclosed by the sphere of interest, then the net contribution of $E_3$ to the integral $\oint_S E\ dA$ is going to be $0$.
That is, $$\oint_S E\ dA = \oint_S (E_1 + E_2 + E_3)\ dA$$ $$= \oint_S (E_1 + E_2)\ dA + \oint_S E_3\ dA$$
$$\oint_S E_3\ dA = 0$$ we have,
$$\oint_S E\ dA = \oint_S (E_1 + E_2)\ dA$$
Thus you should arrive at the same answer for the surface integral whether or not the contribution of $Q_3$ to the field is included in the integral or not.