---
title: Electric flux
heading: Counting field lines through a surface
eyebrow: B2 · Lesson 9 · Electric flux
xp: 40
---

::: hook
How much field passes through a window depends on how big the window is, how strong the field is, and how squarely the window faces it: turn it edge-on and nothing gets through. That quantity, the electric flux, is the field-line count through a surface. It turns out to be the key to a remarkable shortcut: the total flux out of any closed surface depends only on the charge inside, however it's arranged and whatever charges lie outside. That's Gauss's law, the next lesson.
:::

::: play
- A flat window of area $A$ sits in a uniform field $E$. The angle θ is between the field and the window's normal, the direction its face points.
- The curve is the flux through the window as it turns. Face-on (θ = 0) it's largest; edge-on (θ = 90°) it's zero; past that it goes negative, because the field passes through from the back.
- How does the flux change if you double the area? Double the field?
:::
:::

```sim plot
view: graph
x: th = 0..180 °
y: P = -15..15 V·m
slider: E = 100..1000 step 50 = 500 V/m
slider: A = 50..300 step 10 = 200 cm²
slider: th0 = 0..180 step 1 = 60 °
plot: E*A/10000*cos(th°) | label: flux through the window
marker: x = th0 | label: θ
readout: flux at θ, V·m = E*A/10000*cos(th0°) | digits: 3
```

::: predict
## A 1 nC charge sits at the center of a closed cube. What is the electric flux through one face?

- [x] About 19 V·m
- [ ] About 113 V·m
- [ ] Zero, because field lines come back in
- [ ] It depends on the size of the cube

::: reveal
About 19 V·m. The total flux out of any closed surface around the charge is $\frac{q}{\varepsilon_0} = \frac{10^{-9}}{8.85 \times 10^{-12}} = 113$ V·m, and by symmetry the six faces share it equally. The cube's size doesn't matter: a bigger cube has weaker field on its faces but bigger faces, and the two exactly compensate.
:::
:::

::: nameit
## Flux through a flat surface

For a uniform field $\mathbf E$ and a flat surface of area $A$ whose normal makes angle θ with the field:

$$\Phi_E = EA\cos\theta = \mathbf E \cdot \mathbf A$$

where $\mathbf A$ is a vector of length $A$ pointing along the normal. The units are V·m (or N·m²/C). Flux is proportional to the number of field lines crossing the surface, with sign: positive where they cross the way the normal points.

## Flux in general

For a curved surface or a varying field, add up the flux through small patches:

$$\Phi_E = \int\mathbf E \cdot d\mathbf A$$

the surface integral of A9.30. For a **closed** surface, the normals point outward, so outgoing field lines count positive and incoming ones negative.

## What the flux through a closed surface measures

- With no charge inside, every field line that enters also leaves: the net flux is **zero**, however strong or uneven the field.
- With charge $q$ inside, the net flux is $\frac{q}{\varepsilon_0}$, whatever the surface's shape and wherever the charge sits inside it. That's **Gauss's law** (lesson 10).

So a point charge's flux, $\frac{q}{\varepsilon_0}$, splits among the faces of any surface around it; for a charge at a cube's center each face gets $\frac{q}{6\varepsilon_0}$. Any open surface bounded by the same rim catches the same flux from a field with no charges between them: a hemisphere and the flat disk under it intercept the same lines.
:::

::: example
## A 10 cm by 20 cm window faces 60° away from a uniform 500 V/m field. What flux passes through it?

::: solution
1. **Area.** $A = 0.02$ m².
2. **Flux.**
   $$\begin{aligned} \Phi &= 500 \times 0.02 \times \cos 60° \\ &= 5\ \text{V·m} \end{aligned}$$
3. **Face-on.** Facing the field squarely, it would be 10 V·m.

**Answer:** 5 V·m passes through the window.
:::
:::

::: example
## A closed surface around some electronics has a net outward flux of 226 V·m. What net charge is inside?

::: solution
1. **Gauss's law.**
   $$\begin{aligned} q &= \varepsilon_0\Phi \\ &= 8.85 \times 10^{-12} \times 226 \\ &= 2.0 \times 10^{-9}\ \text{C} \\ &= 2\ \text{nC} \end{aligned}$$
2. **What counts.** The surface's shape and the charge's arrangement inside don't matter, only the total.

**Answer:** 2 nC of net charge is inside.
:::
:::

::: check
given: E = 200 | 800; A = 100 | 400; th = 30 | 50 | 70
answer: E*A/10000*cos(th°)
unit: V·m
tolerance: 0.5%

## A uniform field of {E} V/m passes a flat surface of {A} cm², at {th}° to the surface's normal. What is the flux?

::: right
Right. $EA\cos\theta$ = {answer}.
:::

::: misses
- [E*A/10000*sin(th°)] θ is measured from the normal, so use $\cos\theta$.
- [E*A*cos(th°)] Convert cm² to m².
- [any] Not yet. $\Phi = EA\cos\theta$.
:::
:::

::: check
given: q = 1 | 5 | 20
answer: q*1e-9/8.854e-12
unit: V·m
tolerance: 0.5%

## A charge of {q} nC sits inside a closed surface of any shape. What is the net flux out of it?

::: right
Right. $\frac{q}{\varepsilon_0}$ = {answer}.
:::

::: misses
- [8.988e9*q*1e-9] That's $kq$; the flux is $4\pi kq = q/\varepsilon_0$.
- [any] Not yet. Gauss: $\Phi = q/\varepsilon_0$.
:::
:::

::: check
given: q = 1..20 int
answer: q*1e-9/(6*8.854e-12)
unit: V·m
tolerance: 0.5%

## A {q} nC charge sits at the center of a cube. What flux passes through one face?

::: right
Right. A sixth of $\frac{q}{\varepsilon_0}$: {answer}.
:::

::: misses
- [q*1e-9/8.854e-12] That's all six faces together.
- [any] Not yet. Symmetry splits the total equally.
:::
:::

::: check
given: E = 300 | 1000; R = 5 | 20
answer: E*pi*(R/100)^2
unit: V·m
tolerance: 0.5%

## A hemisphere of radius {R} cm sits with its flat side square to a uniform {E} V/m field. What flux passes through its curved surface?

::: right
Right. The same lines cross the flat disk under it: $E\pi R^2$ = {answer}.
:::

::: misses
- [E*2*pi*(R/100)^2] Count field lines: those crossing the dome also cross the flat disk below it, of area $\pi R^2$.
- [any] Not yet. The dome and its base catch the same field lines.
:::
:::

::: check
given: P = 113 | 340 | 565
answer: P*8.854e-12*1e9
unit: nC
tolerance: 0.5%

## A closed surface has a net outward flux of {P} V·m. What net charge does it enclose?

::: right
Right. $\varepsilon_0\Phi$ = {answer}.
:::

::: misses
- [P/8.988e9*1e9] Use $q = \varepsilon_0\Phi$, which is $\Phi/(4\pi k)$.
- [any] Not yet. Gauss's law, solved for $q$.
:::
:::

::: check
kind: choice

## A closed box sits in a strong, uniform electric field, with no charge inside. What is the net flux out of it?

- [x] Zero
- [ ] The field times the box's total area
- [ ] The field times one face's area
- [ ] It depends on how the box is turned

::: right
Right. Every line that enters through one side leaves through another.
:::

::: misses
- [2] Flux in through one side counts negative and cancels the flux out through the other.
- [3] That's the flux through one face; the opposite face has the same amount going the other way.
- [4] Turning the box moves flux between faces but the total stays zero.
:::
:::

::: check
kind: python

## Write `disk_flux(q, z, R, n)` for a point charge q a height z above the center of a flat disk of radius R: split the disk into n rings, add up $E_\perp\,dA$ over them with the midpoint rule, and return the flux. Compare it with the exact $\frac{q}{2\varepsilon_0}\left(1 - \frac{z}{\sqrt{z^2 + R^2}}\right)$. Use ε₀ = 8.854 × 10⁻¹².

```python starter
import numpy as np
eps0 = 8.854e-12

def disk_flux(q, z, R, n):
    return q / eps0

print(disk_flux(1e-9, 0.1, 0.1, 1000))
```

```python solution
import numpy as np
eps0 = 8.854e-12

def disk_flux(q, z, R, n):
    dr = R / n
    r = (np.arange(n) + 0.5) * dr
    Ez = q / (4 * np.pi * eps0) * z / (r**2 + z**2)**1.5
    return float(np.sum(Ez * 2 * np.pi * r * dr))

print(disk_flux(1e-9, 0.1, 0.1, 1000))
```

```python tests
import numpy as np
eps0 = 8.854e-12
for z, R in ((0.1, 0.1), (0.02, 0.5), (1.0, 0.1)):
    exact = 1e-9 / (2 * eps0) * (1 - z / np.sqrt(z**2 + R**2))
    got = disk_flux(1e-9, z, R, 1000)
    assert abs(got - exact) < 1e-4 * exact, f"For z = {z}, R = {R} expect {exact:.4f} V·m; got {got:.4f}."
assert disk_flux(1e-9, 1e-3, 1, 20000) / (1e-9 / eps0) > 0.499, "A disk a thousand times wider than the height catches almost half the flux."
```

::: right
Right. A disk as wide as the charge is high catches 14.6% of the total flux $q/\varepsilon_0$, and a disk far wider than the height catches almost half: the other half goes up.
:::
:::

::: explain
## Why doesn't the flux from a point charge through a surround depend on the surround's size?

::: model
A point charge's field weakens as $1/r^2$, but the area of a sphere around it grows as $r^2$. Their product, the flux, stays the same at every radius: the same field lines, spread over more area. Any other closed surface around the charge is crossed by exactly those field lines too, each crossing once going out (or an odd number of times, the extra crossings canceling). So the flux is set by the charge alone, $q/\varepsilon_0$.
:::
:::

::: practice

::: check
given: E = 400 | 900; A = 0.01 | 0.05
answer: E*A
unit: V·m
tolerance: 0.5%

## What flux does a {E} V/m field send through {A} m² facing it squarely?

::: misses
- [any] $EA$.
:::
:::

::: check
given: q1 = 3 | 5; q2 = -1 | -2
answer: (q1 + q2)*1e-9/8.854e-12
unit: V·m
tolerance: 0.5%

## A closed surface contains charges of {q1} nC and {q2} nC. What is the net flux out?

::: misses
- [any] Total enclosed charge over $\varepsilon_0$.
:::
:::

::: check
given: th = 15 | 30 | 40 | 60 | 75 | 80
answer: cos(th°)
tolerance: 0.5%

## A surface is turned {th}° away from facing a field squarely. What fraction of the face-on flux passes through it?

::: misses
- [sin(th°)] Turning the normal by θ multiplies by $\cos\theta$.
- [any] $\cos\theta$.
:::
:::
:::
