Flux Counter · Guide · glidepathscience.org
GuideFlux Counter
Contents
This Guide explains the ideas and equations behind every Walkthrough step, Concept Challenge question and Predict round, in the order a textbook would take them. Part 1 prepares the Intro track and takes about fifteen minutes to read; Part 2 prepares the Advanced track and takes about twenty. Each section ends with a worked example that is not one of the sim's own problems.
Part 1 · The essentials
Field lines: where they begin and where they end
An electric field is invisible and fills all of space, so we need a way to draw it. The drawing this whole sim is built on is the field line: a curve that runs along the field everywhere, so that at each point the field $E$ is tangent to the line and points the way its arrowheads point. A field line shows direction, not a path: a small charge let go on a curved line swings wide of it.
Two rules make field lines more than decoration. First, a line begins on positive charge and ends on negative charge. In empty space a line never starts or stops; a line with no negative charge to end on runs off toward charge far away, which we call infinity. Second, we draw a fixed number of lines for each unit of charge. On the sim's 2-D board each dot is a long straight rod seen end-on, so its charge is given per meter of length, λ in nC/m, and the board draws n lines for every nC/m. A rod of +4 nC/m at 8 lines per nC/m sends out exactly 32 lines.
With those rules, the spacing of the lines carries the strength of the field: lines crowd together where $|E|$ is large and spread apart where it is small. The common mistake is to read the picture backward, as if lines spread where the field is strong, or to think lines can begin wherever the field happens to vanish. Neither is possible: the number of lines is set by the charges alone.
Once every line has a beginning and an end, we can start counting them, and the place to count is a closed surface.
Counting crossings: out minus in
Draw a closed curve on the board. On the 2-D board it is the cross-section of a closed surface, a cylinder seen end-on, which we call a Gaussian surface. It is imagined, not a wall: field lines pass straight through it. Wherever a line crosses it, the sim leaves a mark, a filled triangle where the line leaves and a hollow triangle where it enters. The number that matters is the net count:
net = out − in
Why out minus in? Follow any line. A line that starts on positive charge inside and ends outside crosses an odd number of times, once more outward than inward. A line that comes from outside and ends on negative charge inside crosses once more inward than outward. A line that starts and ends outside, or starts and ends inside, crosses an even number of times, alternately in and out, and adds nothing. So a positive charge alone inside a sphere centered on it gives only outward crossings, a negative one only inward ones, and a charge outside, however close, as many entries as exits.
The usual mistake is to look at the shape of the field rather than the count. A dipole wrapped in one large surface has outer lines that bulge out and cross the surface twice, so the ledger is not empty; but each exit is matched by an entry and the net is zero, because the total charge inside is zero. Zero net does not mean zero field, either: the field of a charge just outside can be strong all over the surface.
If the net counts only the charge inside, then the surface's shape and the charges outside should not matter at all. They do not.
Only the charge inside counts
Stretch the surface, squash it into a square, make it a lumpy blob, or slide it around, as long as no charge crosses it. The marks move, and the separate out and in totals rise and fall as lines graze the surface, but the net stays fixed. It changes only when a charge crosses the surface, and then it jumps by n times that charge. The net count is a property of what is enclosed, not of the surface.
What matters inside is the total charge, with signs, not the number of charges or the size of the biggest one:
net = $n\,λ_{enc}$, $λ_{enc}$ = the sum of the charges inside, each with its sign
Lines that run from one inside charge to another add nothing; every line that counts belongs to the charge left over once the inside charges have paired off their lines. A cluttered picture can have a small net, and a picture dominated by one large positive charge can still have a negative net. "Outnumbered" is not the same as "outweighed": counting charges instead of adding them is the mistake to avoid.
So far the count has been in lines, a drawing convention. To make it physics we need a unit for what each line stands for.
Flux: what a line carries, and a flat patch
The quantity a line count measures is the electric flux, $Φ_E$: roughly, how much field passes through a surface. The board's lines are drawn so that every line carries the same flux. The flux of one coulomb of enclosed charge is $1/ε_0$, where $ε_0$ = 8.854 × 10⁻¹² C²/(N·m²) is the permittivity of free space, so 1 C accounts for 1.129 × 10¹¹ N·m²/C. With n lines drawn per nC, one line carries an nth of that:
$Φ_1 = (1\ \mathrm{nC})/(nε_0)$ $Φ_E = (\text{net lines})\,Φ_1$
On the 2-D board each rod is long, so the Gaussian surface is a cylinder and the flux is counted through each meter of its length: a rod of 1 nC/m puts 1 nC inside each meter. Changing n changes the drawing, not the flux: twice as many lines per nC means each carries half as much.
Flux also applies to surfaces that are not closed. For a flat patch of area A in a uniform field E, only the part of the field that goes straight through counts. Describe the patch by its normal $\hat{n}$, a unit vector perpendicular to it, and let θ be the angle between $\hat{n}$ and E:
$Φ_E = EA \cos θ$
Facing the field square on (θ = 0) the patch catches EA; edge-on (θ = 90°) it catches nothing; past 90° the flux is negative, because the field passes against $\hat{n}$. The product $A \cos θ$ is the patch's shadow across the field. The classic slip is to use sin θ, measuring θ from the patch instead of from its normal; another is to leave the side in centimeters.
We now have a flux for every line and a rule that the net depends only on the charge inside. Together they are Gauss's law.
Gauss's law
Gauss's law says that the electric flux through any closed surface equals the charge it encloses divided by $ε_0$:
$Φ_E = ∮E\cdot dA = Q_{enc}/ε_0$
Here $∮E\cdot dA$ is the flux added up over the whole closed surface, with $dA$ pointing outward, and $Q_{enc}$ is the net charge inside, with its sign. The law is what the line count showed: shape, size and charges outside do not matter, only the total inside. It is one of the four basic laws of electromagnetism and holds for any distribution of charge, not only the tidy ones.
It works in both directions. The charge inside gives the flux; a measured flux tells you the charge inside without looking, $Q_{enc} = ε_0Φ_E$, which is how the Mystery box in the Predict Lab works. Two errors are common: including a charge outside because its field is strong on the surface, and dividing by $ε_0$ when going backward, which makes the charge absurdly large.
Gauss's law always gives the flux. When the charge is symmetric enough, it also gives the field itself.
A sphere gives Coulomb's law
Flux is an integral over a surface, so in general it does not tell you the field at any one point. The trick is to choose a Gaussian surface on which, by symmetry, the field has the same size everywhere and points along the normal. Then E comes out of the integral, and the flux is E times the area.
For a point charge Q, a sphere of radius r centered on it is such a surface. No direction is special, so E points straight out (in, for negative Q) with the same size all over the sphere, whose area is 4πr². Gauss's law gives
$E\cdot 4πr^2 = Q/ε_0$ $E = Q/(4πε_0r^2) = kQ/r^2$
with $k = 1/(4πε_0)$ = 8.988 × 10⁹ N·m²/C². This is Coulomb's law, recovered from counting flux, and it shows why the field falls as 1/r²: the same flux spreads over an area that grows as r², so doubling r leaves the flux unchanged and cuts E to a quarter. The slips are forgetting to square r, losing the 4π, and leaving r in centimeters.
A sphere fits a point. A long line of charge needs a different surface.
A line of charge and a cylinder
A long straight line carrying charge λ per meter looks the same from either end and from every side, so its field points straight away from it, with a size that depends only on the distance r. The surface that matches is a coaxial cylinder of radius r and length L. On its curved side E is perpendicular to the surface and the same size everywhere; on its flat ends E runs along the surface, so they get no flux. Gauss's law gives
$E\cdot 2πrL = λL/ε_0$ $E = λ/(2πε_0r)$
The field falls as 1/r, not 1/r², because the cylinder's side grows only in proportion to r. This is the field of the rods on the 2-D board, and it is why that board's drawings are honest: N lines spread around a circle of length 2πr thin out as 1/r too. The usual mistake is to use the point-charge formula $kλ/r^2$ for a line; the others are to drop the 2π or to use the sphere's 4π.
Symmetry also tells us where the field is zero, the most surprising use of Gauss's law in Part 1.
Inside a shell, and inside a conductor
Spread a charge Q evenly over a thin spherical shell of radius R. Outside, a concentric Gaussian sphere encloses all of Q and the field is $kQ/r^2$, as if the charge sat at the center. Inside, a Gaussian sphere encloses nothing, so its flux is zero; by symmetry E would point along the radius with the same size all over that sphere, and the only such field with zero flux is zero. So E = 0 everywhere inside, and at the shell E jumps from 0 to $kQ/R^2$, a jump of $σ/ε_0$ with σ the charge per area.
It is tempting to argue that a point near the wall feels a strong push from the nearby charge. It does, but the larger, farther part of the shell pushes the other way, and for an inverse-square force the two cancel exactly. The wrong answers are the outside field, $kQ/r^2$, and "Gauss's law cannot tell", which forgets that symmetry is what lets it tell.
A closed metal box, a Faraday cage, also has zero field in its empty hollow, for a different reason: the metal's free charges rearrange until the field in the metal is zero, and then the hollow is field-free whatever charge sits outside. That needs the zero field in the metal and the fact that an electrostatic field does no net work around a closed loop; Gauss's law alone, without symmetry, cannot show it.
Part 2 returns to these ideas with the flux integral written out, the geometry of solid angle behind them, and the cases where symmetry runs out.
Part 2 · Going further
The flux integral
The line count is a picture of an integral. The flux through a surface is the sum, over small pieces of area, of the component of E along each piece's outward normal:
$Φ_E = ∮E\cdot \hat{n}\,dA$
On the 2-D board, per meter of the cylinder's length, it becomes a line integral around the curve, in N·m²/C per meter, and Gauss's law reads
$∮E\cdot\hat{n}\,dl = λ_{enc}/ε_0$
The sim's chart plots $E\cdot\hat{n}$ along the curve, and the flux is the area above the axis minus the area below. The engine computes it numerically, independently of the line count, and it matches $λ_{enc}/ε_0$ to better than a part in a million. A charge near the surface makes a tall spike; a charge outside adds equal areas above and below; a dip below zero is real inward flux.
Why should an off-center charge, or a charge outside, always come out so exactly? Solid angle gives the answer.
Solid angle, and a charge on the boundary
A solid angle Ω measures how much of the view around a point a surface fills, the way an angle measures part of a circle: the area its projection covers on a sphere of unit radius, in steradians (sr), with 4π sr for the whole sphere. A point charge q sends its flux evenly in all directions, so the flux through a small piece of surface depends only on the solid angle it fills, not on its distance or tilt:
$dΦ = (q/4πε_0)\,dΩ$
A distant piece catches a weaker field but fills a smaller angle, and the two effects cancel exactly. Take a charge outside a closed surface: every narrow cone from the charge that hits the surface goes in at one place and out at another, through the same solid angle with opposite signs. Everything cancels, for any closed surface. A charge inside sees the surface fill all 4π sr, giving $q/ε_0$.
A charge exactly on the surface is the limiting case. On a smooth part of the surface it sees the surface fill half its view, and the flux is $q/2ε_0$. On a cube, a charge on a face gives half, on an edge a quarter and at a corner an eighth, because four cubes share an edge and eight share a corner. Treating the charge as inside, or as outside, are the two mistakes.
Shrink a Gaussian surface down to a point and Gauss's law becomes a statement about the field at that point.
The differential form
Apply Gauss's law to a tiny box around a point and divide by its volume. The left side becomes the net outward flux per unit volume, the divergence of E, written ∇·E; the right side becomes the charge density ρ over $ε_0$:
$\nabla\cdot E = ρ/ε_0$
This is the same law in local form, and it says something precise about field lines: they begin only where ρ is positive and end only where ρ is negative. Everywhere else the divergence is zero, and every small closed surface has as much flux in as out.
Divergence is easy to confuse with strength. Crowded lines mean a large |E|, not a large divergence; lines that bend, converge or spread in empty space still have zero divergence there. A field can be strong and divergence-free, and the divergence can be large where the field is weak, as at the center of a uniformly charged ball.
Divergence and flux treat space as three-dimensional. The 2-D board is not, and that difference decides when a drawing of field lines can be counted.
Dimensions, and where a drawing fails
In d dimensions a charge's flux spreads over a "sphere" whose size grows as $r^{d-1}$, so its field falls as $E \propto 1/r^{d-1}$: as 1/r² in three dimensions and 1/r in two. The 2-D board is honest because its rods are infinite lines: their flux and their drawn lines both spread around a circle of length 2πr, so a line count through a curve is a flux count, exactly.
A flat drawing of three-dimensional point charges is not honest. Lines that start in the page stay in it, but the share of a charge's in-plane lines that reach another follows angles, not flux. Take +q₊ and −q₋ with q₋ smaller, and let f = q₋/q₊ be the share of the positive charge's flux that ends on the negative one. Those lines leave within a cone of half-angle α around the line joining the charges, a cone holding the fraction f of all directions. In the page the cone is an arc of 2α out of 360°:
$(1 - \cos α)/2 = f$ $\cos α = 1 - 2f$ in-plane share = $α/π$
When the negative charge takes less than half the flux the drawing overstates its lines, and when it takes more it understates them. That is why the sim counts lines only in 2-D and, for point charges, integrates over the whole sphere or cube. Taking the flux share as the drawn share, or forgetting that the arc is 2α, are the mistakes to watch for.
Back in three dimensions, symmetry gives the field inside charge as well as outside it.
Inside a uniform ball
Spread a charge Q evenly through a ball of radius R, a charge density $ρ = Q/(\frac{4}{3}πR^3)$. Outside, a concentric Gaussian sphere encloses all of Q and the field is $kQ/r^2$. Inside, a sphere of radius r encloses only the fraction of the volume $(r/R)^3$:
$Q_{enc} = Q(r/R)^3$ $E\cdot 4πr^2 = Q_{enc}/ε_0$
$E = kQr/R^3 = ρr/(3ε_0)$
Inside, the field grows in proportion to r, from zero at the center to $kQ/R^2$ at the surface, where it meets the outside field with no jump; E jumps only where a surface itself carries charge, as at a thin shell. The common mistake is to use all of Q inside the ball; the charge farther out than r contributes nothing, by the argument that makes the field inside a shell zero. Using $(r/R)^2$, the fraction for a long cylinder, is the other. A long uniform cylinder works the same way with a coaxial Gaussian cylinder: inside, $E = ρr/(2ε_0)$, then $λ/(2πε_0r)$ outside.
A sphere and a cylinder have their surfaces. A flat sheet of charge needs a third shape.
Sheets and pillboxes
A large flat sheet carrying charge σ per square meter has a field perpendicular to it, pointing away on both sides for positive σ. The Gaussian surface that fits is a pillbox, a short cylinder straddling the sheet with flat faces of area A. No flux passes through its curved side; flux leaves through both faces:
$E\cdot 2A = σA/ε_0$ $E = σ/(2ε_0)$
The distance from the sheet never entered: a large sheet's field does not fall off until you are far enough away to see its edges. The surface of a thick conductor carrying the same σ is different. The field inside the metal is zero, so a pillbox with one face in the metal has flux through its outer face only:
$E\cdot A = σA/ε_0$ $E = σ/ε_0$
The factor of 2 is where the flux goes: a thin sheet sends half its flux each way; a conductor sends all of it out of one side. Mixing the two up is the standard mistake.
The same zero-field-in-the-metal argument decides where the charge on a hollow conductor sits.
A conductor with a cavity
A thick spherical metal shell carries net charge Q and surrounds a cavity with a charge q at its center. In equilibrium the field in the metal is zero, so a Gaussian sphere inside the metal has zero flux and encloses zero charge. It encloses q and the charge on the cavity's wall, so the wall holds exactly −q, and the outer surface holds the rest of the shell's charge:
$Q_{inner} = -q$ $Q_{outer} = Q - (-q) = q + Q$
Outside, the field is that of q + Q at the center. Gauss's law fixes the totals on each surface whatever the cavity's shape and wherever the charge sits in it; the centered charge in a spherical cavity is what also makes every field here radial. Getting the wall's sign wrong, or putting all of Q on the outside, are the mistakes here.
Every example so far has had a symmetry that made E the same all over some surface. The next section is about what happens when none does.
When symmetry fails: a finite rod
Gauss's law holds for every distribution of charge, but it gives the field directly only when symmetry makes E uniform over some surface. A rod of finite length L carrying Q has no such surface. Wrap it in a closed cylinder and the flux is $Q/ε_0$, but the field changes size along it and passes partly through the end caps, so the integral cannot be split into E times an area. Coulomb's law, added up along the rod, gives the field. On the perpendicular bisector, at distance r from the middle, with λ = Q/L,
$E = \dfrac{λ}{2πε_0r}\cdot\dfrac{L/2}{\sqrt{r^2 + L^2/4}}$
Close to the middle (r much less than L) the second factor is nearly 1 and the rod looks infinitely long: $λ/(2πε_0r)$. Far away (r much greater than L) the factor becomes L/(2r) and the rod looks like a point: $kQ/r^2$. In between, neither formula works. The mistake is to conclude that Gauss's law fails for finite objects; it holds exactly, it is just not enough on its own.
Gauss's law works for any field that spreads from its sources as the inverse square of distance, and gravity is one.
Gauss's law for gravity
Newton's gravitational field g of a point mass has the form of Coulomb's law with the sign reversed (gravity attracts) and $1/(4πε_0)$ replaced by G. Its flux through any closed surface is set by the mass inside:
$∮g\cdot dA = {-4πGM_{enc}}$
Inside a planet of uniform density, a Gaussian sphere of radius r encloses the mass fraction $(r/R)^3$, exactly as for the uniformly charged ball, and the field grows in proportion to r:
$g = g_{surface}\,r/R$
Outside, g falls as 1/r²; using that law inside the planet is the mistake. The real Earth is far denser toward its center than its mean of 5,513 kg/m³: in the Preliminary Reference Earth Model (PREM; Dziewonski and Anderson, 1981), g stays close to or above its surface value through the mantle and peaks near 10.7 m/s² at the core boundary, 3,480 km from the center. Gauss's law still holds; the uniform-density assumption is what fails.
Reference
Common mistakes
- Counting a charge outside. Its lines cross in and out in pairs; only the charge inside sets the flux.
- Counting charges instead of adding them. The net is the sum of the charges inside, with signs.
- Reading zero flux as zero field. A charge outside makes a strong field on a surface whose net flux is zero.
- Using sin θ for a patch. θ is measured from the normal: $Φ_E = EA \cos θ$.
- Dividing by $ε_0$ to find a charge. $Q_{enc} = ε_0Φ_E$: multiply.
- Using a point charge's 1/r² for a line. A line's field falls as 1/r.
- Using all of Q inside a ball. Only the fraction $(r/R)^3$ is enclosed.
- Mixing up a sheet and a conductor. $σ/(2ε_0)$ for a thin sheet, $σ/ε_0$ just outside a conductor.
- Counting the in-plane lines of point charges as flux. A flat slice follows the angle in the page, α/π, not the solid angle that carries the flux.
- Saying Gauss's law fails without symmetry. It always holds; without symmetry it just does not give E.
Equation sheet
| Part 1 | |
|---|---|
| counting | net lines = out − in; $Φ_E$ = (net lines) × (flux per line) |
| one line | $Φ_1 = (1\ \mathrm{nC})/(nε_0)$, with n lines per nC |
| Gauss | $Φ_E = Q_{enc}/ε_0$, $Q_{enc} = ε_0Φ_E$ |
| flat patch | $Φ_E = EA \cos θ$ |
| point charge | $E = Q/(4πε_0r^2) = kQ/r^2$ |
| line charge | $E = λ/(2πε_0r)$ |
| zero field | $E = 0$ inside a charged shell, in a conductor's metal, in an empty hollow in it |
| constants | $ε_0$ = 8.854 × 10⁻¹² C²/(N·m²), $k$ = 8.988 × 10⁹ N·m²/C² |
| Part 2 | |
|---|---|
| Gauss | $Φ_E = ∮E\cdot dA = Q_{enc}/ε_0$; 2-D: $∮E\cdot\hat{n}\,dl = λ_{enc}/ε_0$ |
| on the surface | face $q/2ε_0$, edge $q/4ε_0$, corner $q/8ε_0$ |
| 3-D slice | share $α/π$, $\cos α = 1 - 2{|q_-|}/q_+$ |
| uniform ball | $E = kQr/R^3$ inside, $kQ/r^2$ outside |
| sheets | thin sheet $E = σ/(2ε_0)$; conductor $E = σ/ε_0$ |
| cavity | inner wall $-q$, outer surface $q + Q$ |
| finite rod | near $λ/(2πε_0r)$, far $kQ/r^2$ |
| gravity | uniform planet $g = g_{surface}\,r/R$ |
Symbols: $Φ_E$ electric flux (N·m²/C; on the 2-D board, per meter of length) · $Q_{enc}$, $λ_{enc}$ charge enclosed · $ε_0$ permittivity of free space · $k = 1/(4πε_0)$ · $\hat{n}$ outward unit normal · θ angle between $\hat{n}$ and E · A area · λ, σ, ρ charge per length, area and volume · Ω solid angle (sr) · R radius · L length · n lines drawn per nC (nC/m).
Further reading
OpenStax, University Physics Volume 2, chapter 6 (Gauss's Law), an open textbook that covers Part 1 at the introductory level (openstax.org, CC BY-NC-SA 4.0); D. J. Griffiths, Introduction to Electrodynamics, 4th ed. (Cambridge University Press, 2017), chapter 2, for Part 2; A. M. Dziewonski and D. L. Anderson, "Preliminary reference Earth model," Physics of the Earth and Planetary Interiors 25, 297–356 (1981). The Field Manual describes the sim's model and its limits.
Flux Counter v1.4 · © 2026 Dr. David Meier · CC BY-NC-SA 4.0 · glidepathscience.org