# Gauss law

Gauss’s Law provides an elegant way to relate electric fields to the charges that create them. It’s one of the core equations in Maxwell’s set, capturing how electric fields is realated to his father generator and suorce: electric charges! Gauss’s Law can be incredibly useful in understanding and calculating electric fields in certain symmetrical situations, where it simplifies otherwise complex calculations that require hard work of integrals or numerical solutions. let’s be elegant

The total electric flux through a closed surface is proportional to the charge enclosed within that surface. This is expressed as: $$ \oint_S \vec{E} \cdot d\vec{A} = \frac{Q_{\text{enc}}}{\epsilon_0} $$

Here:

- $\oint_S \vec{E} \cdot d\vec{A}$ represents the
**total electric flux**through the closed surface $S$. - $Q_{\text{enc}}$ is the
**total charge enclosed**within $S$. - $\epsilon_0$ is the
**permittivity of free space**, a constant that appears in Coulomb’s law.

In simpler terms, Gauss’s Law says that the electric field passing through any closed surface only depends on the charge inside, regardless of how the field behaves elsewhere. This property of electric fields makes Gauss’s Law immensely powerful!

## Deeeeep dive into divergence

To fully understand Gauss’s Law, let’s start with the concept of **divergence**. The **divergence** of a vector field, represented by $\nabla \cdot \vec{F}$, is a measure of how much a field “spreads out” from a point. For the electric field $\vec{E}$, the divergence at any point tells us if that point is a source (like a charge) or if it’s neutral.

Mathematically, for a vector field $\vec{F} = (F_x, F_y, F_z)$, the divergence is: $$ \nabla \cdot \vec{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z} $$

If $\nabla \cdot \vec{F} > 0$ at a point, it means there’s an “outflow” source pushing the field outwards. If $\nabla \cdot \vec{F} < 0$, it’s like a sink, pulling the field inwards. When it comes to the electric field $\vec{E}$, positive divergence points to a positive charge (source of field lines), while negative divergence points to a negative charge (sink of field lines).

It is exacly like how gravity works, but matter can be only positive (or antimatter??), think of planaets as a suorce of the field. It turns out to be also the same inverted proportion to the $\frac{1}{r^2}$ like the electric field.

### Let’s differentiate the problem to find a local law

In terms of electric fields, Gauss’s Law in **differential form** tells us that the divergence of $\vec{E}$ at a point is proportional to the charge density $\rho$ at that point:
$$
\nabla \cdot \vec{E} = \frac{\rho}{\epsilon_0}
$$

We have now something way more powerful, a local law of the electric field point by point. Doesn’t give a fuck about integrating on surfaces or lines. let’s gooooo.

This form of Gauss’s Law ties the field’s behavior at a point directly to the charge at that point: wherever we find a positive charge density $\rho$, the electric field “spreads out” from it.

## Connecting Divergence and Flux

To go from Gauss’s Law in differential form to its integral form, we use a powerful tool in vector calculus: the **Divergence Theorem**. This theorem, also known as the **Flux Theorem**, links the divergence of a vector field over a volume to the total flux of the field through the boundary of that volume.

The Divergence Theorem states: $$ \int_V (\nabla \cdot \vec{F}) , dV = \oint_{S} \vec{F} \cdot d\vec{A} $$

In words, this means that if we integrate the divergence of a field $\vec{F}$ over a volume $V$, it’s the same as integrating the flux of $\vec{F}$ across the boundary surface $S$ of that volume. Essentially, the “spread out” of the field within the volume translates to an “outflow” through its boundary.

### Proof

Now let’s apply the Divergence Theorem to the electric field $\vec{E}$ over a volume $V$ bounded by a closed surface $S$. According to the Divergence Theorem: $$ \int_V (\nabla \cdot \vec{E}) \ dV = \oint_S \vec{E} \cdot d\vec{A} $$

Using the differential form of Gauss’s Law, $\nabla \cdot \vec{E} = \frac{\rho}{\epsilon_0}$, we substitute into the left side: $$ \int_V \frac{\rho}{\epsilon_0} \ dV = \oint_S \vec{E} \cdot d\vec{A} $$

Rearranging, we get: $$ \oint_S \vec{E} \cdot d\vec{A} = \frac{1}{\epsilon_0} \int_V \rho \ dV $$

The term $\int_V \rho \ dV$ is simply the **total charge** $Q_{\text{enc}}$ inside the volume $V$, so we rewrite this as:
$$
\oint_S \vec{E} \cdot d\vec{A} = \frac{Q_{\text{enc}}}{\epsilon_0}
$$

This is Gauss’s Law in its **integral form**, showing that the flux of $\vec{E}$ through a closed surface depends solely on the total charge enclosed, without concern for the details of the field outside the surface.

## Examples

Let’s put Gauss’s Law to work with an example: calculating the electric field around a point charge $q$.

Imagine a point charge at the origin, and we want to know the electric flux through a spherical surface of radius $r$ centered around it.

**Electric Field of a Point Charge**:

The electric field $\vec{E}$ at a distance $r$ from a point charge $q$ is radially outward with magnitude: $$ E = \frac{q}{4 \pi \epsilon_0 r^2} $$

**Infinite wire**:

Suppose we have an infinitely long, uniformly charged line. By symmetry, the electric field around the line will be radial, with the same magnitude at any fixed distance $r$ from the line. Enclosing the line in a cylindrical surface of radius $r$ and length $L$, we can use Gauss’s Law to find the electric field at that distance.

**Total Charge Enclosed**: Let $\lambda$ represent the charge per unit length of the line. The total charge within the cylindrical Gaussian surface is $Q_{\text{enc}} = \lambda L$.

**Flux Calculation**:
Since the field is perpendicular to the cylindrical surface, the flux is:
$$
\oint_S \vec{E} \cdot d\vec{A} = E \cdot (2 \pi r L)
$$

**Applying Gauss’s Law**:
Using Gauss’s Law, we set up the equation:
$$
E \cdot (2 \pi r L) = \frac{\lambda L}{\epsilon_0}
$$
Solving for $E$:
$$
E = \frac{\lambda}{2 \pi \epsilon_0 r}
$$

This result tells us that the electric field from an infinite line of charge decreases as $1/r$ with distance from the line, which is a handy result that we derived using symmetry and Gauss’s Law.

Bye bye!!!