MathemagiciansLibraryExplorationsDeep Dives
← Physics · Pre-University
PhysicsPre-University

Gauss's law for electricity and magnetism

PP4 — Electromagnetism › PP4.4 — Maxwells EquationsLecture 1 of 3~2960 words

Counting the charge in a closed box

Someone hands you a sealed box with electric charges inside. You cannot open it. You may only measure the electric field at every point of its outside surface. Can you find the total charge inside?

It seems hopeless. The field on the surface depends on everything: how many charges, where they sit, how close each is to each wall. Move one charge near a wall, and the field there becomes huge. Yet the answer is yes. One number, worked out from the field over the whole surface, gives the total charge exactly, whatever the box's shape. That number is the electric flux, and the rule is Gauss's law.

You have met this rule once without its name. In the capacitor lecture, for a point charge: the disappeared, and that lecture said it was not luck. This lecture shows why, and states the idea in full.

Electric flux: how much field crosses a surface

You already know magnetic flux from Faraday's law. For a flat area in a uniform field, , where is the angle between the field and the normal to the area. Electric flux is its twin, with in place of :

Picture it as the amount of field crossing the area: largest square-on, less when tilted, and zero edge-on (). The unit is N m² C⁻¹. If the field changes over the surface, add over small pieces. In the limit the sum is an integral.

For a closed surface, such as the walls of the box, the normal on each piece points outwards. So field leaving counts as positive flux, and field entering as negative. The circle on the integral sign means "over the whole closed surface":

Many books write this as . It means the same thing.

Why only the charge inside counts

Start with the case you know. A point charge sits at the centre of a sphere of radius . The field is the same size, , everywhere on the sphere, and it points straight out, so . The flux is field × area:

Make the sphere twice as big. The area becomes four times bigger. The field becomes four times weaker, because of the inverse square. The flux does not change. This is the first key point: the inverse square law and the in a sphere's area cancel exactly.

Now change the shape. Think of any small piece of any closed surface around . Project it onto a sphere centred on . The projected piece has area , and the same field crosses both, so both carry the same flux. Every piece of the odd shape has a matching piece of the sphere. So the odd shape has the same total flux as the sphere: .

Finally, put the charge outside the surface. Draw a thin cone out from the charge. If it hits the surface, it hits it twice: once going in and once coming out. The field enters through one piece and leaves through the other. By the same projection argument, the two fluxes are equal in size and opposite in sign. They cancel. A charge outside adds nothing to the total.

So the field-line picture is exact here. A line from a charge inside must cross the surface to get out. A line from a charge outside comes in and goes out again. Test it below.

Explore — move a charge inside and outside a closed sphere

A charge of +1.0 nC sits at distance d from the centre of an imaginary sphere of radius 10 cm. Move it. The readouts give the field at the nearest and farthest points of the sphere, and the total flux, added up over the whole surface by the page. The picture shows a slice through the sphere with 24 field lines. A filled dot marks a line crossing outwards, and an open dot a line crossing inwards.

The table moves a +1.0 nC charge from the centre of a sphere of radius 10 cm to outside it. The field on the surface changes hugely, but the total flux is either Q/ε₀ ≈ 113 N m² C⁻¹ or zero.

d in cmE at nearest point in N C⁻¹E at farthest point in N C⁻¹Total flux in N m² C⁻¹
0899899113
53 596400113
989 900249113
1189 9002040
153 5961440

Near the wall, the field at the nearest point is a hundred times bigger, but the flux stays at 113. Outside, every line that enters leaves again, and the net is zero.

Gauss's law for electricity

The total electric flux out of any closed surface equals the total charge inside it divided by :

("enclosed") is the sum of all charges inside, with their signs. The surface can be any closed shape, real or imaginary. It is called a Gaussian surface.

That is it. That is the whole idea. The sealed box is solved: add up over the walls, multiply by , and you have the total charge inside.

The law needed two facts: fields add, and each charge's field falls as . With any other power, the flux would depend on the size of the surface.

A law that is always true, but not always useful

Gauss's law holds for every closed surface. But it gives one number, the total flux. It does not tell you the field at each point. To get out of it, you need a surface where symmetry tells you two things in advance: is the same size everywhere on the surface, and it crosses the surface straight on (or runs along it, giving no flux).

For a point charge, a sphere centred on it does both. Then the flux is just , and Gauss's law gives

This is Coulomb's law, recovered. For still charges, the two laws carry the same information, seen in two ways.

Stop and think

A charge sits at the centre of a cube. The flux out of the cube is . Can you use this to find the field at a corner of the cube?

Show the answer

No. The corners are farther from the charge than the middles of the faces, so the field is weaker there, and it crosses the faces at a slant. is not the same over the surface, so the flux cannot be written as area. Gauss's law is still true for the cube. It just does not give the field. By symmetry it does give one thing: each of the six faces carries .

Inside a charged shell

Now a thin spherical shell carries charge spread evenly over its surface. What is the field at a point P inside it, away from the centre? Commit to an answer first.

Predict — the field inside a charged shell

The shell carries positive charge, spread evenly. P is inside, much closer to one side than the other. Which statement about the field at P is right?

Draw a thin double cone through P. It cuts a small patch of the shell nearby and a large patch far away. The patch areas grow as the square of their distance from P, and each patch's field falls as the inverse square, so the two fields are equal and opposite. Every double cone through P cancels in the same way, so the field at P is zero.

P near patch small, close far patch large, far
A thin double cone through P. The near patch is small and close. The far patch is larger and farther away. Their fields at P are equal in size and opposite in direction.

The cone argument is Newton's, from the lecture on gravitational shells. Gauss's law gives the same result in two lines. A Gaussian sphere through P, concentric with the shell, encloses no charge, so its flux is zero. By symmetry the field on it has one size and points all out or all in. Such a field gives zero flux only if it is zero. So at P.

Both arguments used symmetry and the inverse square law. Zero flux alone is not enough: symmetry turns "zero flux" into "zero field". This is what Cavendish's test of 1773, from the gravitation lecture, really measured. If the force law were not exactly inverse square, the field inside would not cancel, and charge would move onto the inner globe.

Inside a conductor, and inside its hollow

The lecture on field and potential showed that the field in the metal of a conductor in equilibrium is zero, or the free electrons would move. It promised a proof, with Gauss's law, that a hollow space inside is at the metal's potential. Here it is, in three steps.

Step 1. Any excess charge is on the surface. A Gaussian surface in the metal, just below the outer surface, has everywhere, so zero flux and zero charge inside. Any excess charge must be on the outer surface itself.

Step 2. The wall of the hollow carries no net charge. Now let the conductor have an empty cavity. Draw a Gaussian surface in the metal, around the cavity, as in Figure 1. The field is zero on it, so the total charge inside it is zero. The cavity is empty, so the net charge on the cavity wall is zero.

+ − impossible metal: E = 0 Gaussian surface (dashed) cavity
Figure 1. A conductor with an empty cavity. The dashed Gaussian surface runs through the metal, where E = 0, so it encloses no net charge. A field line from a + patch to a − patch on the cavity wall would mean a drop in potential between two points of the same conductor. That is impossible.

Step 3. The wall carries no charge at all. Step 2 still allows a + patch and an equal − patch on the wall. Gauss's law alone cannot rule this out, because the total would still be zero. But then a field line would run across the cavity from the + patch to the − patch. Along a field line the potential always falls. So the + patch would be at a higher potential than the − patch. Both patches are on the same conductor, which is all at one potential. This is a contradiction. So there are no patches, no field in the cavity, and the cavity is at the potential of the metal.

Faraday showed this in 1836. He covered a room in metal foil, charged its outside strongly, and found with an electroscope no charge on the inside of the walls. The same reasoning shields any closed metal box from outside electric fields, whatever its shape.

The field at the surface of a conductor

Now the capacitor lecture's result, for any conductor. Let the surface carry charge per square metre. Draw a short cylinder, a "pillbox", through the surface, with one flat end in the metal and one just outside.

The charge inside is . So , and

For a capacitor plate, , so , the result from that lecture.

Gauss's law for magnetism

Now do the same for magnetic fields. The result is short:

Gauss's law for magnetism

The total magnetic flux out of any closed surface is zero.

The right-hand side is zero because nothing plays the part of charge. Magnetic field lines do not start or end anywhere. They close on themselves, so every line that enters a closed surface also leaves it.

Test it on a bar magnet. Wrap a closed surface around the north end only, cutting through the middle of the magnet. Outside, lines leave the north end and cross outwards. Inside the magnet the field runs from south to north, so where the surface cuts the magnet, lines cross inwards. The two fluxes are equal. (Cutting the magnet does not help: each piece has both poles.)

You have already relied on this law. Faraday's law talks about "the flux through a coil", but many surfaces have the coil as their edge: a flat disc, or a bulging bag. Two of them together form a closed surface with zero total flux, so what goes in through one comes out through the other. That is why "the flux through the coil" has one value.

The Biot–Savart lecture described the search for magnetic monopoles. If one is ever found, this law would gain a magnetic charge on its right-hand side, as the electric law has .

Worked examples

Worked Example 1 — A sphere with charge spread through it

An insulating sphere of radius 5.0 cm carries 40 nC spread evenly through its volume (an invented example). Find the field at cm, at the surface, and at cm.

By symmetry the field points straight out and has the same size at the same . So use a Gaussian sphere of radius , and the flux is .

Outside (): all the charge is enclosed, so . At the surface, N C⁻¹. At 10 cm, twice as far, it is a quarter of that: N C⁻¹.

Inside (): only part of the charge is enclosed. The fraction is the volume fraction, . So

At cm, halfway out, the field is half the surface value: N C⁻¹.

The enclosed charge grows as and the area as , so . Check: at the surface both formulas give , so the graph is continuous, but it has a corner there (Figure 2).

5 10 15 0 distance from centre r in cm 0.5 1.0 1.5 E in 10⁵ N C⁻¹ surface: 1.44 inside: E ∝ r outside: E ∝ 1/r²
Figure 2. The field of the sphere in Worked Example 1. Inside, E rises in proportion to r. Outside, it falls as 1/r². The two parts meet at the surface with a corner.
Worked Example 2 — How much charge can a metal dome hold?

Dry air at sea level breaks down and sparks when the field reaches about V m⁻¹. A metal dome of a high-voltage generator is a sphere of radius 0.15 m. Estimate the largest charge it can hold, and its potential.

The field just outside a conductor is . So the largest surface charge is C m⁻², about 27 μC m⁻².

The charge is spread over the sphere's area: C, about 7.5 μC.

Outside, the sphere acts as a point charge at its centre, so V. Check: V m⁻¹, the breakdown field. A bigger dome reaches a higher potential before it sparks.

Worked Example 3 — A long charged wire

A long straight wire carries 5.0 nC per metre ( C m⁻¹). Find the field 2.0 cm from it, away from its ends.

Symmetry: the field points straight away from the wire and depends only on the distance . So use a Gaussian cylinder of radius and length around the wire. The flat ends have no flux, because the field runs along them. The curved side has area , and the field crosses it straight on.

The length cancels. With numbers, N C⁻¹.

The field falls as , not . The lines spread out in a plane round the wire, not in all directions, so the area they cross grows only in proportion to .

Three traps

Trap 1 — "Zero flux means zero field"

A closed surface with no charge inside has zero flux, but a charge outside can still make a strong field on it: lines enter on one side and leave on the other. Zero flux means zero field only when symmetry makes the field the same all over the surface.

Trap 2 — Using Gauss's law to find E without symmetry

Gauss's law is true for a cube, a short cylinder or an odd shape. But you can only take outside the integral when is the same size on the surface and crosses it straight on. A short charged rod, or a cube of charge, does not give you that. Then you must add up the fields of the pieces instead.

Trap 3 — Putting all the charge in

Inside a sphere with charge spread through it, a Gaussian sphere of radius encloses only the fraction . Using all of gives a field that wrongly grows without limit near the centre. And a metal sphere is different again: its charge is on the surface, so inside.

Try it yourself

Work each one on paper first. Open a hint only when you are stuck. Use N m² C⁻² and F m⁻¹.

  1. A closed surface contains charges of +3.0 nC and −5.0 nC. A +8.0 nC charge sits just outside it. What is the total flux out of the surface? Does it change if the outside charge is moved closer?

    Hint 1

    Only the charge inside counts. Add the inside charges with their signs.

    Hint 2

    nC. Divide by .

    Full answer

    N m² C⁻¹. The minus sign means that overall, field goes into the surface. Moving the outside charge changes the field on the surface, but not the total flux: its lines still enter and leave. Check: the flux depends only on the inside charges, and −2.0 nC is negative, so a negative flux makes sense.

  2. A 6.0 nC charge sits at the centre of a cube. Find the flux through one face. Then explain why you cannot use this to find the field at the centre of a face.

    Hint 1

    The total out of the cube is , and the six faces are identical as seen from the charge.

    Hint 2

    For the field, ask whether is the same over a face.

    Full answer

    Total: N m² C⁻¹. By symmetry each face gets a sixth: N m² C⁻¹. The field is not the same over a face. It is strongest at the face's centre, nearest the charge, and weaker and more slanted at the corners. So the flux cannot be written as area, and the face's flux does not give the field at its centre. (Coulomb's law does: if the cube's side is , the centre of a face is from the charge.)

  3. A coaxial cable has a thin inner wire with nC per metre and a thin outer metal tube of radius 5.0 mm with nC per metre. Find the field 2.0 mm from the axis, and 10 mm from the axis.

    Hint 1

    Use Gaussian cylinders, as in Worked Example 3. What does each one enclose?

    Hint 2

    At 2.0 mm, only the inner wire is enclosed. At 10 mm, both are enclosed.

    Full answer

    At 2.0 mm: N C⁻¹, pointing outwards. At 10 mm: the enclosed charge per metre is . By symmetry the field there is the same size all round the cylinder and points straight in or out, so zero flux means . The cable keeps its field inside itself. Check: this is why the outer tube is called a shield.

  4. A charge of 24 nC sits exactly at one corner of a cube. Find the flux through the whole cube, and through each of its six faces.

    Hint 1

    Eight identical cubes can be packed round that corner, so that together they make one big cube with the charge at its centre.

    Hint 2

    Three faces of the small cube touch the corner where the charge is. Which way does the field run along them?

    Full answer

    The eight cubes around the corner form a big cube with the charge at its centre. The big cube's flux is , shared equally by symmetry, so one small cube gets N m² C⁻¹. The three faces that touch the charge's corner contain the charge in their own planes. The field runs along them, so their flux is zero. The other three faces are identical as seen from the charge, so each gets a third: N m² C⁻¹. Check: .

The bigger idea

Gauss's law is exact only if the force between charges is exactly inverse square. That turns the law into a test. Every version of Cavendish's experiment asks one question: does a charged outer shell leave any charge, or any potential difference, on a shell inside it? In 1936 Plimpton and Lawton found that the power in Coulomb's law is 2 to within a few parts in a thousand million. In 1971 Williams, Faller and Hill, using nested metal shells, pushed the limit to a few parts in . It is one of the most precisely tested laws in physics, and every test is a careful measurement that finds nothing.

The two laws here are two of Maxwell's four equations. They say where field lines can begin: on charges for , and nowhere for . The next lecture adds the other two, in which changing fields create fields. Together, the four explain light.

Key concepts in this lesson