Gauss's Law (Integral Form)

Suppose you want the electric field a small distance from a long charged wire. The honest way is to chop the wire into a million tiny pieces, write down the little k\,dq/r^2 contribution of each one, resolve every one into components, and grind out a vector integral that runs the length of the wire. It can be done — and it is genuinely unpleasant. Now here is the same answer, obtained in a single line with no integral in sight:

E = \frac{\lambda}{2\pi\varepsilon_0\, r}.

The shortcut is Gauss's law. It is one of the four Maxwell equations that sum up all of electromagnetism, and in the right circumstances it turns a brutal integral into a one-line calculation. The catch — and the reason this page exists — is that using it well takes a new idea (electric flux) and a good eye for symmetry. Get those two things, and a whole class of field problems simply falls open.

First idea: electric flux

Picture the electric field as a set of field lines streaming through space, and hold up a little wire loop in the flow. The electric flux \Phi through that loop is a measure of how many field lines thread through it — how much field is "piercing" the surface. Two things control it: how strong the field is, and how the surface is tilted relative to it.

For a small flat patch of area \vec{A} (a vector: its length is the area, its direction is the outward normal, perpendicular to the patch), the flux is a dot product:

\Phi = \vec{E}\cdot\vec{A} = E\,A\cos\theta,

where \theta is the angle between the field and the normal. The \cos\theta is the whole story of "tilt":

A real surface is usually curved and the field varies over it, so we tile it into infinitesimal patches d\vec{A} and add up their contributions — an integral over the surface:

\Phi = \int_S \vec{E}\cdot d\vec{A}.

Flux is a single number (a scalar), and its units are field times area: \text{N·m}^2/\text{C}. Keep the mental picture front and centre — flux is just field lines threading a surface, counted with a sign.

The law: total flux counts only the charge inside

Now specialise to a closed surface — one with no edges, sealing off a region of space like a balloon (a sphere, a box, a can). By convention the area vectors point outward. The flux out through a closed surface gets its own symbol, a circle on the integral sign: \oint_S \vec{E}\cdot d\vec{A}. Gauss's law makes a startling claim about it.

Here \varepsilon_0 \approx 8.85\times 10^{-12}\ \text{C}^2/(\text{N·m}^2) is the permittivity of free space, the same constant that sits inside k = 1/(4\pi\varepsilon_0) in Coulomb's law. That is not a coincidence — Gauss's law and Coulomb's law are two faces of the same physics.

Why is it true? Follow a single point charge Q and wrap it in a sphere of radius r. Its field points straight out with magnitude E = kQ/r^2 = Q/(4\pi\varepsilon_0 r^2), everywhere perpendicular to the sphere, so \cos\theta = 1 and the flux is just field times total area:

\Phi = E \times (4\pi r^2) = \frac{Q}{4\pi\varepsilon_0 r^2}\times 4\pi r^2 = \frac{Q}{\varepsilon_0}.

Watch the magic: the field weakens as 1/r^2, but the area it spreads over grows as r^2, and the two cancel exactly. The r vanishes — the flux is the same through every sphere, and (with a bit more geometry) through any closed surface at all. That precise cancellation is the fingerprint of an inverse-square law.

Second idea: let symmetry do the integral for you

Gauss's law is always true, but it is only useful when the field is so symmetric that you can pull E out of the integral. The trick is to choose an imaginary Gaussian surface that matches the symmetry of the charge, so that on it E is either constant-and-perpendicular (flux = E\times A) or parallel (flux = 0). There are exactly three symmetries that work, each with its own natural surface:

Spherical: the point charge (and the whole sphere) — E = kQ/r^2

We essentially did this above. By symmetry the field points radially and has one magnitude E(r) everywhere on a sphere of radius r. So \oint \vec{E}\cdot d\vec{A} = E \cdot 4\pi r^2, and Gauss's law gives

E\cdot 4\pi r^2 = \frac{Q}{\varepsilon_0} \;\Longrightarrow\; E = \frac{Q}{4\pi\varepsilon_0 r^2} = \frac{kQ}{r^2}.

Coulomb's law drops out in one line. And notice we never used where the charge sits inside the sphere — so a uniformly charged shell or ball produces exactly the field of a point charge at its centre, as seen from outside. That is the shell theorem, free of charge.

Cylindrical: the infinite line — E = \lambda/(2\pi\varepsilon_0 r)

A line carries charge \lambda per unit length. By symmetry the field points straight out from the line, with one magnitude E(r) at distance r. Wrap a coaxial cylinder of radius r and length \ell around it. The two flat end-caps have the field skimming along them (\cos\theta = 0, zero flux); all the flux goes out through the curved side, whose area is 2\pi r\,\ell. The charge enclosed is \lambda\ell:

E\cdot(2\pi r\,\ell) = \frac{\lambda\ell}{\varepsilon_0} \;\Longrightarrow\; E = \frac{\lambda}{2\pi\varepsilon_0\, r}.

The length \ell cancels (it must — an infinite line has no special place), and we land on the very formula from the hook, with no painful integral over the wire. Note the field of a line falls off as 1/r, more gently than a point charge's 1/r^2.

Planar: the infinite sheet — E = \sigma/(2\varepsilon_0)

A sheet carries charge \sigma per unit area. By symmetry the field points straight away from the sheet on both sides, with the same magnitude E everywhere. Poke a little cylindrical "pillbox" of cap-area A through the sheet. Flux escapes through both caps (2EA) and none through the sides. The enclosed charge is \sigma A:

2EA = \frac{\sigma A}{\varepsilon_0} \;\Longrightarrow\; E = \frac{\sigma}{2\varepsilon_0}.

The astonishing part: there is no r at all. The field of an infinite sheet is uniform — the same strength however far away you stand. (Move back and you lose field lines to spreading, but you also "see" more of the sheet; the two effects cancel perfectly.)

Worked example 1 — inside and outside a charged ball

Take a ball of radius R with total charge Q spread uniformly through its volume. What is the field at a distance r from the centre — both outside and inside?

Outside (r \ge R). A Gaussian sphere of radius r encloses all the charge, Q_{\text{enc}} = Q. By the spherical result:

E_{\text{out}} = \frac{Q}{4\pi\varepsilon_0 r^2} = \frac{kQ}{r^2}\qquad (r \ge R).

From outside, the ball is indistinguishable from a point charge — the good old 1/r^2.

Inside (r < R). Now a Gaussian sphere of radius r only catches the charge in the smaller ball it bounds. Since the charge is uniform, the enclosed charge is the fraction of the volume:

Q_{\text{enc}} = Q\,\frac{\tfrac{4}{3}\pi r^3}{\tfrac{4}{3}\pi R^3} = Q\,\frac{r^3}{R^3}.

Feed that into E\cdot 4\pi r^2 = Q_{\text{enc}}/\varepsilon_0:

E_{\text{in}} = \frac{Q\,r^3/R^3}{4\pi\varepsilon_0 r^2} = \frac{Q}{4\pi\varepsilon_0 R^3}\,r = \frac{kQ}{R^3}\,r\qquad (r < R).

Inside the ball the field grows linearly from zero at the centre (E \propto r); outside it falls as 1/r^2. The two pieces meet and agree exactly at the surface r = R, where both give E = kQ/R^2. Drag the sliders below to watch the peak ride along the surface.

Worked example 2 — flux through a cube

A point charge Q sits at the exact centre of a cube. What is the total flux through the cube's surface — and through just one face?

The whole cube. Do not integrate over six faces with awkward angles! The cube is a closed surface enclosing Q, so Gauss's law answers instantly:

\Phi_{\text{cube}} = \frac{Q}{\varepsilon_0}.

One face. Now use symmetry. With the charge dead-centre, the six faces are completely interchangeable — each must carry the same share of the flux. So one face gets a sixth:

\Phi_{\text{face}} = \frac{1}{6}\cdot\frac{Q}{\varepsilon_0} = \frac{Q}{6\varepsilon_0}.

A surface integral that would take a page of trigonometry, settled by a symmetry argument in two lines. (Move the charge off-centre and the symmetry is broken — the near faces catch more flux than the far ones — but the total is still Q/\varepsilon_0, unshaken.)

A charge outside the cube. Slide the charge just outside the box and the enclosed charge is now zero, so the total flux is 0 — every field line that enters one face leaves through another, in and out cancelling perfectly. Outside charges never contribute to net flux.

Three classic traps live inside Gauss's law — worth naming out loud.

1. The \vec{E} in the integral is the total field. The field appearing in \oint \vec{E}\cdot d\vec{A} is the true field on the surface, made by all charges everywhere — inside and outside. What is special is only that the net flux ends up depending on the enclosed charge alone. Outside charges do push the field around point by point; they just contribute zero when you add the flux up over the whole closed surface.

2. Zero net flux does not mean zero field. Put a Gaussian surface in a region with no charge inside and the total flux is zero — but the field on it can be large and lively. Zero flux means "as many lines out as in", not "no lines". Never read \Phi = 0 as E = 0.

3. Always true, rarely handy. Gauss's law holds for every closed surface, always. But you can only solve for E when the symmetry lets you pull it out of the integral — spherical, cylindrical, or planar. For a lopsided blob of charge Gauss's law is still perfectly true, and perfectly useless for finding the field; you are back to brute-force integration. Symmetry is the whole game.

Squeeze the closed surface down around a single point and Gauss's law morphs into something even more powerful. The bridge is a jewel of vector calculus, the divergence theorem, which says the flux out of a closed surface equals the integral of the divergence \nabla\cdot\vec{E} over the volume inside: \oint_S \vec{E}\cdot d\vec{A} = \int_V (\nabla\cdot\vec{E})\,dV. Set that equal to Q_{\text{enc}}/\varepsilon_0 = \int_V \rho/\varepsilon_0\,dV (with \rho the charge density), and since it must hold for every volume, the integrands themselves must match:

\nabla\cdot\vec{E} = \frac{\rho}{\varepsilon_0}.

This is the differential form of Gauss's law — the very first of Maxwell's four equations. It says charge is where field lines are born (positive divergence) or swallowed (negative). The integral form and the differential form carry exactly the same physics, phrased for a whole region versus a single point.

And here is the deep reason our universe hangs together: that clean cancellation only happens for an inverse-square law. If electric force fell off as 1/r^3 instead, the flux would depend on the radius, Gauss's law would collapse, and — it turns out — no atom could hold a stable orbit. We live in a 1/r^2 world, and Gauss's law is the elegant statement of what that buys us.