# Why do we consider external electric field in Gaussian equation of electric flux?

We know in the Gaussian equation that the net flux through a closed surface is equal to the flux of the charge inside the surface. Mathematically we see that the left hand integral consists of the entire electric field, inside as well as outside. But since the flux due to the outside field is zero, why do we consider it?

Mathematically we see that the left hand integral consists of the entire electric field, inside as well as outside. But since the flux due to the outside field is zero, why do we consider it?

You are correct when you say "the flux due to the outside field is zero"

$$\oint \vec E_\text{outside} \cdot d\vec A = 0$$

where $$\vec E_\text{outside}$$ is the electric field due to charge outside the Gaussian surface. According to this, it is the same if you put $$\vec E_\text{inside}$$ or $$\vec E_\text{total}$$ under the integral to calculate electric flux, where

$$\vec E_\text{total} = \vec E_\text{inside} + \vec E_\text{outside}$$

However, if you measured electric field in a region, you can measure only the total electric field. Since principle of superposition applies to electric fields, in general there is no way to separate the total electric field into electric field due to outside and inside charge. Hence

$$\Phi_E = \oint \vec E_\text{total} \cdot d \vec A = \oint \vec E_\text{inside} \cdot d \vec A = \frac{Q_\text{inside}}{\varepsilon_0}$$