---
title: "Ampère's law: solenoids and toroids"
heading: Winding wire into coils to make strong, even fields
eyebrow: B5 · Lesson 8 · Solenoids and toroids
xp: 40
---

::: hook
One wire makes a weak field that spreads out in circles. Wind the wire into a long coil and the fields of all the turns add up inside it into a strong, nearly uniform field running along the axis, and almost nothing outside. That's a solenoid: the heart of every relay, valve actuator, inductor and MRI magnet. Ampère's law gives its field in one line, and bending it into a ring, a toroid, traps the field completely.

::: play
- The graph shows the field along the axis of a solenoid of length $L$ and radius $R$, wound with $n$ turns per centimeter and carrying current $I$.
- Make the solenoid long compared with its radius. How flat is the field in the middle? Compare it with $\mu_0nI$.
- At the very end of a long solenoid, what fraction of the middle field is left?
:::
:::

```sim plot
view: graph
x: z = -20..20 cm
y: B = 0..15 mT
slider: L = 2..30 step 1 = 20 cm
slider: R = 0.5..5 step 0.5 = 2 cm
slider: n = 5..50 step 5 = 20 /cm
slider: I = 0.5..5 step 0.5 = 2 A
plot: 4*pi*1e-7*n*100*I/2*((z + L/2)/sqrt((z + L/2)^2 + R^2) - (z - L/2)/sqrt((z - L/2)^2 + R^2))*1000 | samples: 800 | label: field on the axis
plot: 4*pi*1e-7*n*100*I*1000 | dashed | color: ch2 | label: μ₀nI
marker: x = -L/2 | label: end
marker: x = L/2
readout: μ₀nI = 4*pi*1e-7*n*100*I*1000 mT
```

::: predict
## A long solenoid's field in the middle is $B$. What is it at the very end of the coil, on the axis?

- [ ] $B$
- [x] $B/2$
- [ ] Zero
- [ ] $2B$

::: reveal
$B/2$. In the middle, the coil extends a long way both sides, and every turn contributes. At the end, half the coil is missing: only the turns on one side contribute, giving half the field. Just beyond the end the field spreads out and drops off quickly. That's why long, uniform fields need a coil much longer than it is wide.
:::
:::

::: nameit
## Solenoids and toroids

**Ampère's law** (A9.42): around any closed loop,

$$\oint\mathbf B \cdot d\mathbf l = \mu_0I_\text{through}$$

the total current threading the loop.

**Long solenoid.** Take a rectangular loop with one long side, length $\ell$, inside the coil along the axis, and the other outside where the field is nearly zero. Only the inside side contributes, $B\ell$, and the loop encloses $n\ell$ turns, each carrying $I$:

$$B = \mu_0nI$$

with $n$ the number of turns per meter. The field is the same everywhere inside, not just on the axis, as long as you're well away from the ends. It doesn't depend on the coil's radius at all. 1000 turns per meter carrying 1 A make 1.26 mT.

**Finite solenoid.** On the axis, the field is

$$B(z) = \frac{\mu_0nI}{2}\left(\cos\theta_1 - \cos\theta_2\right)$$

where θ₁ and θ₂ are the angles from the axis point to the two ends of the coil. At the end of a long coil one of the cosines is zero and the field is half.

**Toroid.** A solenoid bent into a ring closes on itself, so there are no ends. Ampère's law around a circle of radius $r$ inside the windings gives

$$B = \frac{\mu_0NI}{2\pi r}$$

for $N$ total turns. Outside a toroid, a loop encloses equal current going in and out, so the field there is essentially zero. Toroidal inductors and transformers keep their fields to themselves, which makes them quiet neighbors on a circuit board.

**With iron.** Filling a coil with iron multiplies its field by the iron's relative permeability, often by thousands (lesson 10). That's how a small electromagnet can lift a car.
:::

::: example
## A solenoid with 500 turns over 25 cm carries 0.5 A. What field is inside?

::: solution
1. **Turns per meter.**
   $$\begin{aligned} n &= \frac{500}{0.25} \\ &= 2000\ \text{turns/m} \end{aligned}$$
2. **Field inside.**
   $$\begin{aligned} B &= \mu_0nI \\ &= 4\pi \times 10^{-7} \times 2000 \times 0.5 \\ &= 1.26\ \text{mT} \end{aligned}$$

**Answer:** the field inside is 1.26 mT.
:::
:::

::: example
## A 1000-turn toroid with a 5 cm mean radius carries 2 A. What field is in its core?

::: solution
1. **Ampère's law around the core.**
   $$B \cdot 2\pi r = \mu_0NI$$
2. **Solve for the field.**
   $$\begin{aligned} B &= \frac{4\pi \times 10^{-7} \times 1000 \times 2}{2\pi \times 0.05} \\ &= 8\ \text{mT} \end{aligned}$$
3. **Outside the toroid.** There the field is nearly zero.

**Answer:** the field in the core is 8 mT, and outside the toroid it is nearly zero.
:::
:::

::: check
given: n = 100..2000 step 100; I = 0.5 | 1 | 2 | 5
answer: 4*pi*1e-7*n*I*1000
unit: mT
tolerance: 0.5%

## A long solenoid has {n} turns per meter and carries {I} A. What is the field inside, in mT?

::: right
Right. $\mu_0nI$ = {answer}.
:::

::: misses
- [4*pi*1e-7*n*I] That's in teslas. Convert to mT.
- [2e-7*n*I*1000] That's the straight-wire coefficient. A solenoid's is $\mu_0 = 4\pi \times 10^{-7}$.
- [any] Not yet. $B = \mu_0nI$.
:::
:::

::: check
given: N = 100..1000 step 100; L = 10 | 20 | 50; I = 1..5 int
answer: 4*pi*1e-7*N/(L/100)*I*1000
unit: mT
tolerance: 0.5%

## A solenoid {L} cm long has {N} turns and carries {I} A. What is the field in its middle, if it's long compared with its width?

::: right
Right. $n = N/L$ turns per meter, and $B = \mu_0nI$ = {answer}.
:::

::: misses
- [4*pi*1e-7*N*I*1000] Use turns per meter: divide N by the length.
- [4*pi*1e-7*N/L*I*1000] Convert centimeters to meters.
- [any] Not yet. $B = \mu_0(N/L)I$.
:::
:::

::: check
given: N = 100..1000 step 100; r = 2 | 5 | 10; I = 1..5 int
answer: 4*pi*1e-7*N*I/(2*pi*r/100)*1000
unit: mT
tolerance: 0.5%

## A toroid has {N} turns carrying {I} A. What is the field inside its windings, {r} cm from its center?

::: right
Right. $\mu_0NI/(2\pi r)$ = {answer}.
:::

::: misses
- [4*pi*1e-7*N*I/(r/100)*1000] The circle's length is $2\pi r$.
- [4*pi*1e-7*N*I*1000] Divide by the circle's length.
- [any] Not yet. Ampère's law around a circle inside: $B \cdot 2\pi r = \mu_0NI$.
:::
:::

::: check
given: B = 1..9 int; n = 1000 | 2000 | 5000
answer: B*1e-3/(4*pi*1e-7*n)
unit: A
tolerance: 0.5%

## A solenoid with {n} turns per meter must make {B} mT. What current does it need?

::: right
Right. $I = B/(\mu_0n)$ = {answer}.
:::

::: misses
- [B/(4*pi*1e-7*n)] Convert millitesla to teslas.
- [B*1e-3*4*pi*1e-7*n] Divide by $\mu_0n$.
- [any] Not yet. Solve $B = \mu_0nI$ for I.
:::
:::

::: check
kind: choice

## What is the magnetic field just outside an ideal toroid?

- [x] Essentially zero
- [ ] The same as inside
- [ ] Half the inside value
- [ ] It depends on how close you are

::: right
Right. A loop around the outside encloses the current going in and the current coming out, so the net is zero.
:::

::: misses
- [2] Ampère's law around an outside loop encloses zero net current.
- [3] Half applies at the end of a solenoid; a toroid has no ends.
- [4] Outside, at any distance, the enclosed current is zero.
:::
:::

::: check
kind: parts
given: N = 200 | 500 | 1000; L = 10 | 20 | 50; I = 0.5 | 2; r = 2 | 5

## A solenoid has {N} turns over {L} cm and carries {I} A; a toroid with the same {N} turns has a mean radius of {r} cm.

::: part
answer: 4*pi*1e-7*N/(L*1e-2)*I*1e3
unit: mT
tolerance: 0.5%

### What field is inside the solenoid?

::: misses
- [4*pi*1e-7*N*I*1e3] Divide by the length: $n = N/L$.
- [any] Not yet. $B = \mu_0nI$.
:::
:::

::: part
answer: 4*pi*1e-7*N*I/(2*pi*r*1e-2)*1e3
unit: mT
tolerance: 0.5%

### What field is inside the toroid at its mean radius?

::: misses
- [4*pi*1e-7*N*I/(r*1e-2)*1e3] Ampère's loop is the circumference $2\pi r$.
- [any] Not yet. $B = \mu_0NI/(2\pi r)$.
:::
:::

::: right
Right. Both come from Ampère's law with a loop that encloses the windings' current.
:::
:::

::: explain
## Why is the field inside a long solenoid the same everywhere, regardless of its radius?

::: model
Apply Ampère's law to a rectangle with one long side inside the solenoid and the other outside, where the field is negligible. The only contribution is the field along the inside side, times its length, and that must equal $\mu_0$ times the current threading the rectangle, which depends only on the turns per meter and the current. Moving the inside side anywhere within the coil gives the same answer, so the field is uniform, and nothing about the radius enters.
:::
:::

::: practice

::: check
given: n = 500 | 1000 | 2000; I = 1 | 2 | 3
answer: 4*pi*1e-7*n*I*1000
unit: mT
tolerance: 0.5%

## {n} turns per meter carrying {I} A make what field, in mT?

::: misses
- [any] $B = \mu_0nI$.
:::
:::

::: check
given: B = 2..20 int
answer: B/2
unit: mT
tolerance: 0.5%

## The middle of a long solenoid has {B} mT. What is the field at the ends, on the axis?

::: misses
- [B] At the ends only half the coil contributes.
- [any] Half the middle value.
:::
:::

::: check
given: k = 2 | 3 | 4
answer: k
tolerance: 0.5%

## You wind a solenoid {k} times more tightly (more turns per meter), same current. By what factor does its field change?

::: misses
- [1/k] More turns per meter means more field.
- [any] $B \propto n$.
:::
:::
:::
