# Electrodynamics/Gauss's Law
## Flux

Flux is effectively the amount of Field passing through a surface. In other words, it is analogous to a stream of water; if you put a screen in a creek, then water will pass through it. The amount of water moving through it is the flux.
Using the water analogy, point charges can be viewed as a source (such as a hose or faucet where water comes from), or a drain. Water comes out of a source, flows around the field, and travels into the drain.
If we draw our electric field lines so that our lines from our sinks connect to the lines from our drains, and if we ensure that no lines cross, the flux is essentially represented by the density of lines in our drawing. If we use the common convention that charge "flows out of" a positive charge, and "flows into" a negative charge, we can have a better understanding of what flux is.

## Surfaces

A surface is an abstract mathematical tool that we can use to explore various phenomena. What a surface is, is a shell around a region of space. Consider a common inflatable ball, such as a soccer ball, or a basketball. The "ball" itself is just a rubberized shell around a pocket of air.
Like a ball, a surface is just a shape in space that encloses a certain volume. Like a ball, the surface cannot have any gaps in it (if a ball has gaps, air will escape, and the ball will deflate).

## Gauss' Law

If the surface we have is a closed one, so it has no gaps, then you can imagine that in a river the same amount of water that enters the surface must also exit the surface. The only time that more water can be coming out of a surface is if there is a hose inside the surface. The only time more water can be entering the surface is if there is a drain inside the surface.
Or if we go back to Electric Field, the only time the flux in a surface is not zero, is when there is a charge inside that surface.
[Gauss' Law for Electric Fields (zero charge)]
    $\oint _{S}{\mathbf {E} \cdot d\mathbf {a} }=0$
If no charge is inside the surface, where da is an infinitesimally small area.
Now what happens if we place a charge inside the surface, you can imagine that if we had a water tap inside that we would get a net flux leaving the surface. The same is true for the electric field.

### Charge Inside the Surface

Imagine a sphere with a charge in the center. We will denote the sphere in spherical coordinates, for ease of use:
    $\oint _{S}{\mathbf {E} \cdot d\mathbf {a} }=\int {\frac {1}{4\pi \epsilon _{0}}}\left({\frac {q}{r^{2}}}\mathbf {\hat {r}} \right)\cdot (r^{2}\sin \theta d\theta d\rho \mathbf {\hat {r}} )={\frac {1}{\epsilon _{0}}}q$
Now notice that the radius of the sphere has no influence upon the Net Flux, this means no matter what size the sphere is the answer is the same. This can be extended to mean that there is no dependence upon the shape of S at all.
So therefore:
[Gauss' Law of Electric Fields (non-zero charge)]
    $\oint _{S}{\mathbf {E} \cdot d\mathbf {a} }={\frac {1}{\epsilon _{0}}}Q_{enclosed}$
Where Q$_{enclosed}$ is the total amount of charge located inside the surface. This is Gauss's Law for Electric Fields .

## Example: Infinite Charged Plate

Imagine an infinite uniformly charged metal plate, with charge density σ. What is the electric field around the plate? In this case, because we have a plate with charge density σ, but no object of the opposite charge, we assume that there is an oppositely charged object at infinity, for our electric field lines to be drawn towards.
Solution Place a Gaussian Surface through the surface of the metal plate, with sides only perpendicular and parallel to the surface. For ease, we will say that our gaussian surface is a cube or a rectangle. Let A be the area of the side of the cube that is parallel to the plate. To find the total charge inside the plate we can multiply the charge density σ with the total area. Therefore there is an enclosed charge of σ A.
Because the plate is infinite and symmetrical the only direction the E Field can go is perpendicular to the plate. If the E field lines were not perpendicular to the plate, they would eventually cross each other.
    $\oint _{S}{\mathbf {E} \cdot d\mathbf {a} }=|\mathbf {E} |\int _{S}{d\mathbf {a} }=2A|\mathbf {E} |$
    $\oint _{S}{\mathbf {E} \cdot d\mathbf {a} }={\frac {1}{\epsilon _{0}}}Q_{enclosed}$
Therefore:
    $\mathbf {E} ={\frac {\sigma }{2\epsilon _{0}}}\mathbf {\hat {n}}$
Where $\mathbf {\hat {n}}$ is a unit vector perpendicular to the plate.

## Expressing Gauss's Law in Terms of Divergence

Perhaps a more useful way of Expressing Gauss's Law is by using the Divergence of the Electric Field:
    $\nabla \cdot \mathbf {E}$
This turns our original integral equation into a differential one by using the Divergence Theorem:
    $\oint {\mathbf {E} \cdot d\mathbf {a} }=\int (\nabla \cdot \mathbf {E} )dV$
Now if we rewrite Q in terms of charge density ρ, then we have:
    $Q_{Enc}=\int \rho dV$
Substituting this in we get:
    $\int (\nabla \cdot \mathbf {E} )dV=\int \left({\frac {\rho }{\epsilon _{0}}}\right)dV$
    $\nabla \cdot \mathbf {E} ={\frac {\rho }{\epsilon _{0}}}$
Note that Gauss's Law is always true, but not always useful. You need a certain amount of symmetry and a good Gaussian Surface in order to use it effectively.