Electromagnetism · Field Theory · From First Principles

Sources of
Magnetic Fields

Where does B come from? We build the whole picture from a single moving charge — through the Biot–Savart law, parallel wires, loops, solenoids, toroids — all the way to Ampère's law. No steps skipped.

10sections
8interactive sims
rigour
01 — The Fundamental Idea

What actually creates a magnetic field?

Before any formula, here is the single truth that this entire subject rests on. Once you have this locked, everything else is just geometry and bookkeeping.

The Core Principle
Moving electric charge creates a magnetic field. A charge at rest creates only an electric field. The moment it moves, it creates a magnetic field on top of the electric one. That's it. Every wire, every loop, every solenoid is just this idea applied to different arrangements of moving charges.

Why does movement matter? Think geometrically. A stationary charge has perfect spherical symmetry — every direction looks identical. There's no preferred axis, so the field radiates outward equally in all directions: that's the electric field.

Now set the charge moving. Suddenly there's a preferred direction — the velocity vector \(\mathbf{v}\). The spherical symmetry is broken. The resulting field can no longer be purely radial; it must somehow reflect that broken symmetry. And it does: the magnetic field wraps around the velocity direction rather than pointing along it. The cross product in Biot–Savart is the mathematical embodiment of exactly this.

\[ \text{charge at rest:} \quad \mathbf{E} \text{ field only} \] \[ \text{charge moving at velocity } \mathbf{v}: \quad \mathbf{E} \text{ field} \;+\; \mathbf{B} \text{ field} \]
The fundamental split

The field of a single moving point charge

Before we graduate to whole wires, let's write down the magnetic field produced by a single point charge \(q\) moving at velocity \(\mathbf{v}\):

\[ \mathbf{B} = \frac{\mu_0}{4\pi} \frac{q\,\mathbf{v} \times \hat{\mathbf{r}}}{r^2} \]
Magnetic field of a single moving point charge
Worked Example — Single Moving Proton

A proton (\(q = 1.6\times10^{-19}\) C) moves in the \(+x\) direction at \(v = 3\times10^6\) m/s. Point \(P\) is 2 cm directly above the proton's current position (in the \(+y\) direction). Find the magnitude and direction of \(\mathbf{B}\) at \(P\).

Given: \(q = 1.6\times10^{-19}\) C, \(\;v = 3\times10^6\) m/s, \(\;r = 0.02\) m, \(\;\mathbf{v} = v\hat{x}\), \(\;\hat{\mathbf{r}} = +\hat{y}\)
Full Solution
\[\theta = 90°\]
Identify the angle. \(\mathbf{v}\) points in \(+\hat{x}\) and \(\hat{\mathbf{r}}\) points in \(+\hat{y}\). These are perpendicular, so the angle between them is \(90°\).
\[\sin\theta = \sin 90° = 1\]
Evaluate the trig factor. At broadside observation, the cross-product magnitude is at its maximum. No angular reduction.
\[\hat{\mathbf{v}}\times\hat{\mathbf{r}} = \hat{x}\times\hat{y} = \hat{z}\]
Find the direction via cross product. Using the standard right-hand rule for basis vectors: \(\hat{x}\times\hat{y} = \hat{z}\). So \(\mathbf{B}\) points in the \(+z\) direction (out of the page if \(x\) is right and \(y\) is up).
\[B = \frac{\mu_0}{4\pi}\frac{qv\sin\theta}{r^2}\]
Write the magnitude formula. This is the scalar form of Biot–Savart for a single point charge, using \(|\mathbf{v}\times\hat{\mathbf{r}}| = v\sin\theta\).
\[= (10^{-7})\cdot\frac{(1.6\times10^{-19})(3\times10^6)(1)}{(0.02)^2}\]
Substitute all values. Use \(\mu_0/4\pi = 10^{-7}\) T·m/A. Numerator: \(qv = 1.6\times10^{-19}\times3\times10^6\). Denominator: \(r^2 = (0.02)^2\). Sin factor is 1.
\[= (10^{-7})\cdot\frac{4.8\times10^{-13}}{4\times10^{-4}}\]
Evaluate the numerator and denominator separately. \(1.6\times10^{-19}\times3\times10^6 = 4.8\times10^{-13}\). \((0.02)^2 = 4\times10^{-4}\).
\[= (10^{-7})\cdot 1.2\times10^{-9}\]
Divide. \(4.8\times10^{-13}\,/\,4\times10^{-4} = 1.2\times10^{-9}\). Subtract exponents: \(-13 - (-4) = -9\). Coefficient: \(4.8/4 = 1.2\).
\[B = 1.2\times10^{-16}\;\text{T}\]
Final multiply. \(10^{-7}\times1.2\times10^{-9} = 1.2\times10^{-16}\) T. Exponent: \(-7+(-9) = -16\).
Answer
\(\mathbf{B} = 1.2\times10^{-16}\;\text{T}\) in the \(+\hat{z}\) direction. Tiny — single particles produce extraordinarily weak fields at macroscopic distances.

This equation is the atomic-level version. The cross product \(\mathbf{v} \times \hat{\mathbf{r}}\) does two jobs at once:

\[\mathbf{B} = \underbrace{\frac{\mu_0}{4\pi}}_{\text{scale}} \cdot \frac{q \;\underbrace{\mathbf{v} \times \hat{\mathbf{r}}}_{\text{direction \& angle}}}{\underbrace{r^2}_{\text{decay}}}\]
Each piece explained in the table below
\(q\)
Source charge
The electric charge of the moving particle, measured in coulombs (C). Only a charge creates fields — neutral particles don't. Sign matters: a negative charge moving right produces the same field as a positive charge moving left.
Proton: \(q = +1.6\times10^{-19}\) C  ·  Electron: \(q = -1.6\times10^{-19}\) C
\(\mathbf{v}\)
Velocity of the charge
The velocity vector of the source charge — how fast and in which direction it is moving. This is what breaks the spherical symmetry of the electric field and gives rise to the magnetic field. A charge at rest (\(\mathbf{v}=\mathbf{0}\)) produces no magnetic field at all.
Units: m/s. Doubling \(v\) doubles \(\mathbf{B}\) — the field is directly proportional to speed.
\(\hat{\mathbf{r}}\)
Unit vector from source to field point
A dimensionless vector of length 1, pointing from the location of the moving charge toward the observation point \(P\) where you want to know \(\mathbf{B}\). It encodes geometry: which direction is "away from the charge toward you?" It is computed as \(\hat{\mathbf{r}} = \mathbf{r}/|\mathbf{r}|\), where \(\mathbf{r}\) is the displacement vector from charge to field point.
Dimensionless (no units). Changing the direction of observation changes \(\hat{\mathbf{r}}\) and therefore the direction and magnitude of \(\mathbf{B}\).
\(\mathbf{v} \times \hat{\mathbf{r}}\)
direction
Cross product — sets the direction of B
The cross product of the velocity and the unit displacement vector. Its direction is perpendicular to both \(\mathbf{v}\) and \(\hat{\mathbf{r}}\), determined by the right-hand rule: point fingers along \(\mathbf{v}\), curl them toward \(\hat{\mathbf{r}}\), and your thumb points along \(\mathbf{B}\). The field wraps around the velocity direction — it never points along \(\mathbf{v}\) or along \(\hat{\mathbf{r}}\).
Example: charge moving in \(+\hat{x}\), field point in \(+\hat{y}\) direction from it \(\Rightarrow\) \(\hat{x}\times\hat{y} = \hat{z}\), so \(\mathbf{B}\) points out of the page.
\(|\mathbf{v}\times\hat{\mathbf{r}}|\)
\(= v\sin\theta\)
Cross product magnitude — encodes the angle
Here \(\theta\) is the angle between \(\mathbf{v}\) and \(\hat{\mathbf{r}}\). The cross product's magnitude is maximum when the two vectors are perpendicular (\(\theta=90°\), observing broadside) and zero when they are parallel or antiparallel (\(\theta=0°\) or \(180°\), looking directly along or against the velocity). The charge creates no magnetic disturbance directly in front of or behind it.
\(\theta=90°\): \(\sin\theta=1\) → max field.   \(\theta=0°\) or \(180°\): \(\sin\theta=0\) → zero field.
\(r^2\)
Squared distance — inverse-square falloff
The distance \(r\) from the source charge to the observation point, squared. Because the source is a point, the field spreads out over a growing spherical surface area \(4\pi r^2\) as you move away — so the field strength falls as \(1/r^2\), the same as Coulomb's electric field. Double the distance → quarter the field.
Units: m². This is the geometric dilution of influence: a point source radiating into 3D space.
\(\dfrac{\mu_0}{4\pi}\)
Permeability constant — sets the overall scale
This is a fundamental constant of nature that tells you how strongly free space responds to magnetic influences. \(\mu_0 = 4\pi\times10^{-7}\) T·m/A is called the permeability of free space (or vacuum permeability). The factor of \(4\pi\) in the denominator is a conventional bookkeeping choice that makes Ampère's law come out clean (no stray \(4\pi\) factors). It plays the exact same structural role in magnetism that \(\dfrac{1}{4\pi\varepsilon_0}\) plays in Coulomb's law for electricity.
\(\mu_0/4\pi = 10^{-7}\) T·m/A exactly (by definition in SI).   Compare: \(1/4\pi\varepsilon_0 \approx 9\times10^{9}\) N·m²/C² in Coulomb's law.

From one charge to a current: the bridge

Now here's the conceptual bridge from a point charge to Biot–Savart for wires. Suppose you have a tiny piece of wire of length \(d\ell\) containing \(n\) free electrons per unit volume, each with drift velocity \(\mathbf{v}_d\). The number of charges in this piece is \(n A\, d\ell\) (where \(A\) is the cross-sectional area). The magnetic field they collectively create is the sum of \(n A\, d\ell\) individual contributions, each of the form above.

Now recall that current is defined as the charge passing a cross-section per unit time: \(I = nqv_d A\). So the product \(q\,\mathbf{v}_d\) times the number of charges \(nA\,d\ell\) gives — with every substitution shown separately:

From moving charges to the current element — step by step
\[\text{total charge in element} = (nA\,d\ell)\cdot q\]
Count the charges. The wire segment has cross-section \(A\) and length \(d\ell\), so its volume is \(A\,d\ell\). With \(n\) free charges per unit volume, total count \(= nA\,d\ell\). Multiply by charge per particle \(q\) to get total charge.
\[\text{each charge moves at }\mathbf{v}_d = v_d\,\hat{\ell}\]
Assign the velocity. The drift velocity has magnitude \(v_d\) and points along the wire direction \(\hat{\ell}\). Writing it as \(v_d\hat{\ell}\) separates the scalar speed from the direction — this will matter when we form the cross product later.
\[\text{total } q\mathbf{v} = (nA\,d\ell)\cdot q \cdot v_d\,\hat{\ell}\]
Form the aggregate \(q\mathbf{v}\) for all charges. Each of the \(nA\,d\ell\) charges contributes \(qv_d\hat{\ell}\) to the magnetic source term. Sum them: multiply the count by the individual contribution.
\[= nqv_d A \cdot d\ell \cdot \hat{\ell}\]
Regroup — collect the scalar factors. Move the scalars \(n\), \(q\), \(v_d\), \(A\) together and keep the vector part \(d\ell\,\hat{\ell}\) separate. This is just multiplication being commutative — no physics yet.
\[nqv_d A = I\]
Recognize the current. By definition, current \(I\) is the charge flowing past a cross-section per unit time. In time \(\Delta t\), the charges move \(v_d\Delta t\), so charge passing the cross-section \(= nqAv_d\Delta t\), giving \(I = nqAv_d\). The product \(nqv_dA\) is exactly \(I\).
\[\therefore\quad (nA\,d\ell)\cdot q\mathbf{v}_d = I\,d\ell\,\hat{\ell} = I\,d\boldsymbol{\ell}\]
Define the current element. Substitute \(nqv_dA = I\). What remains is \(I \cdot d\ell\,\hat{\ell}\), which we define as the current element \(I\,d\boldsymbol{\ell}\) — a vector of magnitude \(I\,d\ell\) pointing along the wire. It is not a new concept: it is literally the aggregate \(q\mathbf{v}\) of all charges in the segment.

That's the current element \(I\,d\boldsymbol{\ell}\). This is why the Biot–Savart law for wires looks exactly like the single-charge formula — \(I\,d\boldsymbol{\ell}\) plays the role of \(q\mathbf{v}\).

Geometric Insight
Magnetic field lines always form closed loops — they have no beginning or end. This is encoded in \(\nabla \cdot \mathbf{B} = 0\): magnetic "charge" (monopoles) doesn't exist in nature. Every field line that leaves a region must return to it. This topology — always looping — constrains every calculation you'll do here.
Single Moving Charge — Field Visualizer

Adjust the observation angle θ (between velocity and the line to the field point) to see how the magnetic field magnitude and direction change. At θ = 0° you're looking along the velocity — zero field. At θ = 90° you're broadside — maximum field.

θ (deg) 90°
speed v 50 m/s
charge q 10 nC
sin θ
1.000
|B| at r = 0.1 m
02 — The Master Rule

The Biot–Savart Law

Biot–Savart is the general rule for computing the magnetic field due to any current distribution. The philosophy: slice the wire into infinitesimal pieces, find the field each piece contributes, integrate over the whole wire. It's the same superposition logic that makes Coulomb's law so powerful in electrostatics.

\[ d\mathbf{B} = \frac{\mu_0}{4\pi} \frac{I\,d\boldsymbol{\ell} \times \hat{\mathbf{r}}}{r^2} \]
Biot–Savart Law — differential form

And the magnitude form, which is what you integrate:

\[ dB = \frac{\mu_0}{4\pi} \frac{I\,d\ell\,\sin\theta}{r^2} \]
magnitude — θ is angle between dℓ and r̂

Anatomy of the law

\(d\mathbf{B}\)
The infinitesimal magnetic field contribution from just this one tiny current element. To get the total field at a point, you integrate \(d\mathbf{B}\) over the entire current distribution.
\(\mu_0/4\pi\)
\(10^{-7}\) T·m/A exactly (in SI). Sets the strength scale of magnetic effects. The \(4\pi\) cancels in simple symmetric cases, which is why the infinite wire result has \(2\pi\) rather than \(4\pi\) in it.
\(I\,d\boldsymbol{\ell}\)
The current element — current magnitude times an infinitesimal vector pointing along the wire in the direction of conventional current flow. This is the "source" term, directly descended from \(q\mathbf{v}\) for the individual charges inside.
\(\hat{\mathbf{r}}\)
Unit vector pointing from the source element to the field observation point P. This encodes the geometry: where are you trying to find B, relative to the current element?
\(r^2\)
Distance squared from source to field point. The \(1/r^2\) at the differential level matches the point-charge formula. (After integrating an extended source, this often softens to \(1/r\) or other powers.)
\(\times\)
The cross product. This is not a coincidence — it's the geometric signature of magnetism. The field is always perpendicular to both the current direction and the displacement to the observation point. It can never point along either of those directions.

What the cross product is doing geometrically

The cross product \(d\boldsymbol{\ell} \times \hat{\mathbf{r}}\) enforces two things simultaneously. First, direction: the resulting \(d\mathbf{B}\) is perpendicular to the plane containing the current direction and the source-to-observer line. Use the right-hand rule: fingers curl from \(d\boldsymbol{\ell}\) toward \(\hat{\mathbf{r}}\), thumb points along \(d\mathbf{B}\). Second, magnitude: \(|d\boldsymbol{\ell} \times \hat{\mathbf{r}}| = d\ell\sin\theta\), which is maximized at \(\theta = 90°\) and zero at \(\theta = 0°\) or \(180°\). A current element doesn't radiate magnetic field along its own axis.

Superposition — the integration philosophy

The total field at point P is the vector sum of all the \(d\mathbf{B}\) contributions from every piece of the wire:

\[ \mathbf{B} = \int d\mathbf{B} = \frac{\mu_0 I}{4\pi} \int \frac{d\boldsymbol{\ell} \times \hat{\mathbf{r}}}{r^2} \]
total field by integration — superposition principle

Different parts of the wire are at different distances \(r\) and subtend different angles \(\theta\) to the observation point, so you can't just multiply by length. You have to parameterize position along the wire and integrate. That's the art of Biot–Savart calculations.

Critical Point
Superposition is vector addition — direction matters constantly. Two contributions with equal magnitude can cancel completely if they point in opposite directions, or add to double if they're parallel. You must track direction at every step, not just magnitude.
Biot–Savart — Cross Product Explorer

Vary θ — the angle between the current element \(d\boldsymbol{\ell}\) and the unit vector \(\hat{\mathbf{r}}\) to the field point. Watch how the field strength scales as \(\sin\theta\) and how the field direction (shown by the circled dot) changes.

θ 90°
sin θ — field factor
1.000
dB direction
out of page ⊙
Worked Example — dB from a Single Current Element

A wire carries \(I = 5\) A in the \(+x\) direction. A tiny element of length \(d\ell = 1\) mm is located at the origin. Find \(d\mathbf{B}\) at point \(P = (0,\,0.03,\,0)\) m — i.e., 3 cm directly above the element in the \(+y\) direction.

\(I = 5\) A, \(\;d\ell = 1\times10^{-3}\) m, \(\;r = 0.03\) m, \(\;\hat{\ell} = \hat{x}\), \(\;\hat{\mathbf{r}} = \hat{y}\)
Full Solution
\[\theta = 90°\]
Identify the angle. Current element points in \(\hat{x}\), displacement to \(P\) points in \(\hat{y}\) — these are perpendicular, so \(\theta = 90°\).
\[\sin 90° = 1\]
Evaluate the trig factor. Broadside means maximum field contribution — no angular suppression.
\[\hat{x}\times\hat{y} = \hat{z}\]
Find the direction. Right-hand rule on basis vectors. \(d\mathbf{B}\) points in \(+\hat{z}\) — out of the page.
\[dB = \frac{\mu_0}{4\pi}\frac{I\,d\ell\,\sin\theta}{r^2}\]
Write the Biot–Savart magnitude formula. Scalar form of the law. \(I\,d\ell\) is the current element magnitude; \(\sin\theta\) projects out the contributing component; \(r^2\) gives inverse-square decay.
\[= (10^{-7})\cdot\frac{(5)(1\times10^{-3})(1)}{(0.03)^2}\]
Substitute all values. \(\mu_0/4\pi = 10^{-7}\) T·m/A. \(I = 5\) A, \(d\ell = 10^{-3}\) m, \(\sin\theta = 1\), \(r = 0.03\) m.
\[= (10^{-7})\cdot\frac{5\times10^{-3}}{9\times10^{-4}}\]
Evaluate numerator and denominator. Numerator: \(5\times1\times10^{-3} = 5\times10^{-3}\). Denominator: \((0.03)^2 = 9\times10^{-4}\).
\[= (10^{-7})\cdot 5.56\]
Divide. \(5\times10^{-3}\,/\,9\times10^{-4} = 5/9 \times 10^{-3+4} = 0.556\times10^{1} = 5.56\).
\[dB = 5.56\times10^{-7}\;\text{T}\]
Final multiply. \(10^{-7}\times5.56 = 5.56\times10^{-7}\) T.
Answer
\(d\mathbf{B} = 0.556\;\mu\text{T}\;\hat{z}\). One element's contribution — you'd integrate many of these to get the total field of a finite wire.
03 — First Application

The Infinite Straight Wire

This is the foundational calculation. An infinitely long wire carries current \(I\). We want the magnetic field at perpendicular distance \(R\) from the wire. We apply Biot–Savart and integrate over the entire wire — with every step shown.

Setting up the integral

Place the wire along the \(z\)-axis. The field point \(P\) is at perpendicular distance \(R\) from the wire (in the \(xy\)-plane for concreteness, but by symmetry the result is the same anywhere at the same perpendicular distance). Label each source element by its coordinate \(z\) along the wire, measured from the foot of the perpendicular from \(P\).

Infinite Wire — Full Derivation, One Move Per Line
\[dB = \frac{\mu_0 I}{4\pi}\frac{d\ell\,\sin\theta}{r^2}\]
Start from Biot–Savart (scalar form). This is the magnitude of the field from one element \(d\ell\) at distance \(r\), where \(\theta\) is the angle between the current direction and \(\hat{\mathbf{r}}\).
\[r = \sqrt{R^2 + z^2}\]
Express \(r\) geometrically. Wire is along \(z\)-axis; field point \(P\) is at perpendicular distance \(R\). Source element is at height \(z\). Distance from element to \(P\): Pythagoras.
\[r^2 = R^2 + z^2\]
Square it. We need \(r^2\) in the denominator of Biot–Savart.
\[\sin\theta = \frac{R}{\sqrt{R^2+z^2}}\]
Express \(\sin\theta\) from the geometry. \(\theta\) is between \(\hat{z}\) (current direction) and \(\hat{\mathbf{r}}\) (toward \(P\)). In the right triangle: opposite side is \(R\), hypotenuse is \(r\). So \(\sin\theta = R/r\).
\[\frac{\sin\theta}{r^2} = \frac{R/\sqrt{R^2+z^2}}{R^2+z^2}\]
Form the combination that appears in Biot–Savart. Put \(\sin\theta = R/\sqrt{R^2+z^2}\) over \(r^2 = R^2+z^2\).
\[= \frac{R}{(R^2+z^2)^{3/2}}\]
Simplify the exponent. Dividing by \((R^2+z^2)\) is adding \(-1\) to the exponent \(-1/2\): \(-1/2 + (-1) = -3/2\). So \((R^2+z^2)^{-1/2}\cdot(R^2+z^2)^{-1} = (R^2+z^2)^{-3/2}\).
\[\text{all }d\mathbf{B}\text{ point in }\hat{\phi}\]
Determine direction by symmetry. Every element \(I\,dz\,\hat{z}\) crossed with the outward \(\hat{\mathbf{r}}\) gives a vector circling the wire (\(\hat{\phi}\) direction). All contributions reinforce — no cancellation of directions needed.
\[B = \frac{\mu_0 I}{4\pi}\int_{-\infty}^{+\infty}\frac{R\,dz}{(R^2+z^2)^{3/2}}\]
Set up the integral. Substitute \(\sin\theta/r^2 = R/(R^2+z^2)^{3/2}\) into Biot–Savart and integrate over all \(z\). \(R\) is a constant (perpendicular distance) so it stays outside the integral.
\[z = R\tan\phi,\quad dz = R\sec^2\phi\,d\phi\]
Trig substitution. The form \((a^2+z^2)^{3/2}\) calls for \(z = a\tan\phi\). Here \(a=R\). Differentiating: \(dz/d\phi = R\sec^2\phi\). Limits: \(z = \pm\infty \Rightarrow \phi = \pm\pi/2\).
\[R^2+z^2 = R^2+R^2\tan^2\phi = R^2(1+\tan^2\phi) = R^2\sec^2\phi\]
Simplify the denominator base. Substitute \(z = R\tan\phi\). Factor out \(R^2\). Apply the Pythagorean identity \(1+\tan^2\phi = \sec^2\phi\).
\[(R^2+z^2)^{3/2} = (R^2\sec^2\phi)^{3/2} = R^3\sec^3\phi\]
Raise to the 3/2 power. \((R^2)^{3/2} = R^{2\cdot3/2} = R^3\). \((\sec^2\phi)^{3/2} = \sec^{2\cdot3/2}\phi = \sec^3\phi\).
\[\int_{-\infty}^{+\infty}\frac{R\,dz}{(R^2+z^2)^{3/2}} \longrightarrow \int_{-\pi/2}^{\pi/2}\frac{R\cdot R\sec^2\phi\,d\phi}{R^3\sec^3\phi}\]
Substitute into the integral. Replace \(dz\) with \(R\sec^2\phi\,d\phi\) in the numerator and \((R^2+z^2)^{3/2}\) with \(R^3\sec^3\phi\) in the denominator.
\[= \int_{-\pi/2}^{\pi/2}\frac{R^2\sec^2\phi}{R^3\sec^3\phi}\,d\phi\]
Group numerator and denominator. Numerator: \(R \cdot R\sec^2\phi = R^2\sec^2\phi\). Denominator: \(R^3\sec^3\phi\). No computation yet — just rearranging.
\[= \frac{1}{R}\int_{-\pi/2}^{\pi/2}\cos\phi\,d\phi\]
Cancel factors. \(R^2/R^3 = 1/R\). \(\sec^2\phi/\sec^3\phi = 1/\sec\phi = \cos\phi\). The integrand simplifies to \((1/R)\cos\phi\).
\[\int_{-\pi/2}^{\pi/2}\cos\phi\,d\phi = \Big[\sin\phi\Big]_{-\pi/2}^{\pi/2}\]
Antiderivative of \(\cos\phi\). By definition, \(\int\cos\phi\,d\phi = \sin\phi + C\). Apply the fundamental theorem of calculus.
\[= \sin\!\left(\tfrac{\pi}{2}\right) - \sin\!\left(-\tfrac{\pi}{2}\right) = 1 - (-1) = 2\]
Evaluate at the limits. \(\sin(\pi/2) = 1\). \(\sin(-\pi/2) = -1\). Subtract: \(1-(-1) = 2\).
\[\int_{-\infty}^{+\infty}\frac{R\,dz}{(R^2+z^2)^{3/2}} = \frac{1}{R}\cdot 2 = \frac{2}{R}\]
Assemble. Multiply the prefactor \(1/R\) by the integral value 2.
\[B = \frac{\mu_0 I}{4\pi}\cdot\frac{2}{R}\]
Substitute the integral result back. Replace the integral with \(2/R\) in our expression for \(B\).
\[B = \frac{2\mu_0 I}{4\pi R}\]
Multiply out. Bring the 2 into the numerator alongside \(\mu_0 I\).
\[B = \frac{\mu_0 I}{2\pi R}\]
Simplify the fraction. \(2/4 = 1/2\). The factor of 4 in the denominator becomes 2. Done.
\[B = \frac{\mu_0 I}{2\pi R}\]
magnetic field of an infinite straight wire at perpendicular distance R
Why 1/R and not 1/R²?
A point source gives \(1/r^2\) falloff. An infinite line source gives \(1/r\) falloff. The intuition: close to the wire, nearby segments dominate and the field is strong. Far away, you're seeing the wire almost end-on and the contributions begin to cancel. The integral over the whole wire "accumulates" contributions that soften the falloff by one power of \(r\). This same effect appears in electrostatics: a point charge gives \(E \propto 1/r^2\), an infinite line charge gives \(E \propto 1/r\), an infinite plane gives a constant \(E\).

Direction: the right-hand grip rule

Wrap your right hand around the wire with the thumb pointing in the direction of current. Your curled fingers trace the direction of the magnetic field lines — circles centered on the wire, in the azimuthal \(\hat{\phi}\) direction. This is not a mnemonic trick — it is the geometric consequence of the cross product in Biot–Savart.

Worked Example — Field from a Power Line

A long straight power line carries \(I = 200\) A. What is the magnetic field magnitude 3 m directly below the wire? How does it compare to Earth's field (\(\approx 50\;\mu\text{T}\))?

Given: \(I = 200\) A, \(\;R = 3\) m
Full Solution
\[B = \frac{\mu_0 I}{2\pi R}\]
Write the formula. This is the result we derived for an infinite straight wire at perpendicular distance \(R\).
\[= \frac{(4\pi\times10^{-7})(200)}{2\pi(3)}\]
Substitute values. \(\mu_0 = 4\pi\times10^{-7}\) T·m/A, \(I = 200\) A, \(R = 3\) m.
\[= \frac{4\pi\times10^{-7}\times200}{6\pi}\]
Expand the denominator. \(2\pi \times 3 = 6\pi\).
\[= \frac{800\pi\times10^{-7}}{6\pi}\]
Multiply the numerator. \(4\pi\times10^{-7}\times200 = 800\pi\times10^{-7}\).
\[= \frac{800\times10^{-7}}{6}\]
Cancel \(\pi\). \(\pi\) appears in both numerator and denominator and cancels exactly.
\[= 133.3\times10^{-7}\;\text{T}\]
Divide. \(800/6 = 133.3\).
\[B = 1.33\times10^{-5}\;\text{T} = 13.3\;\mu\text{T}\]
Convert to standard form. \(133.3\times10^{-7} = 1.333\times10^{-5}\) T \(= 13.3\;\mu\text{T}\). Compare to Earth: \(13.3/50 \approx 27\%\).
Answer
\(B = 13.3\;\mu\text{T}\) — about 27% of Earth's field. This is why power lines can interfere with sensitive magnetic measurements.
Worked Example — Two Wires, Net Field at a Point

Two long parallel wires are 8 cm apart. Wire A carries 10 A upward; Wire B carries 10 A downward. Find the net magnetic field at a point P midway between them.

Each wire is \(R = 0.04\) m from P. \(I = 10\) A each.
Full Solution
\[B_A = \frac{\mu_0 I}{2\pi R} = \frac{(4\pi\times10^{-7})(10)}{2\pi(0.04)}\]
Field from Wire A at P. Infinite wire formula. \(R = 0.04\) m.
\[= \frac{4\pi\times10^{-6}}{8\pi\times10^{-2}} = \frac{4}{8}\times10^{-4} = 5\times10^{-5}\;\text{T} = 50\;\mu\text{T}\]
Evaluate. Numerator: \(4\pi\times10^{-6}\). Denominator: \(0.08\pi = 8\pi\times10^{-2}\). Cancel \(\pi\). Exponent: \(-6+2 = -4\).
\[\text{Direction of }B_A\text{: current up, P is to the right of A} \Rightarrow \otimes\]
Apply grip rule for Wire A. Thumb up (current direction), fingers wrap around. At a point to the right of the wire, fingers point into the page.
\[B_B = \frac{\mu_0 I}{2\pi R} = 50\;\mu\text{T}\]
Field from Wire B at P. Same magnitude — same \(I\) and same \(R\).
\[\text{Direction of }B_B\text{: current down, P is to the left of B} \Rightarrow \otimes\]
Apply grip rule for Wire B. Thumb down (current direction). At a point to the left of the wire, fingers also point into the page. Both fields are in the same direction.
\[B_\text{net} = B_A + B_B\]
Superposition. Both fields point in the same direction (\(\otimes\)) at P, so add magnitudes.
\[= 50 + 50 = 100\;\mu\text{T}\;(\otimes)\]
Final addition.
Answer
\(B_\text{net} = 100\;\mu\text{T}\) into the page. Opposite currents produce fields that reinforce between the wires — this is why anti-parallel wire pairs are used to cancel stray fields outside a circuit.
Infinite Wire — Live Calculator
Current I 10 A
Distance R 0.10 m
B = μ₀I / 2πR
20.0 μT

Compare: Earth's surface field ≈ 50 μT · household wire at 10 cm ≈ 20 μT · MRI bore ≈ 1–7 T

04 — Direction Toolkit

Right-Hand Rules — Geometry, Not Ritual

The right-hand rule is not a magic trick you memorize. It is the physical manifestation of the cross product, which shows up in Biot–Savart. Understanding why the right hand is used — and what it's computing — makes all the difference.

There are really two distinct situations you'll encounter, each with its own version of the rule.

Version 1: Field direction around a straight wire

Grip rule. Point your right thumb in the direction of current flow. Your curled fingers show the direction the magnetic field circles around the wire. This is equivalent to computing \(I\hat{\ell} \times \hat{\mathbf{r}}\) — as \(\hat{\mathbf{r}}\) sweeps around the wire in a circle, the cross product always points tangentially, in the direction your fingers curl.

Version 2: Force on a moving charge or current

Flat-hand rule. Point your fingers in the direction of \(\mathbf{v}\) (or current), curl them toward \(\mathbf{B}\), and your thumb points in the direction of the force \(q\mathbf{v} \times \mathbf{B}\). This is for when you're computing the Lorentz force — the effect of the field on a moving charge.

Right-Hand Rule — Scenario Trainer

Click a scenario to see the correct direction and the underlying cross-product reasoning.

Current upward.
Field at point to the right?
Current rightward.
Field above the wire?
Current out of page.
Field to the right?
↑ B→
Charge moving up,
B pointing right.
Force direction?
→ B↑
Current rightward,
B pointing up.
Force direction?
⊗ B↑
Current into page,
B pointing up.
Force direction?

The cross-product mental model

If you think of a cross product \(\mathbf{A} \times \mathbf{B}\) as "rotate \(\mathbf{A}\) toward \(\mathbf{B}\) by the shortest path — the result points in the direction a right-handed screw would advance," then the right-hand rule is just a physical shortcut for that computation. The hand doesn't have magical powers; it's a physical analog computer for cross products.

Classic Mistake
Confusing the two versions of the RHR. The grip rule is for finding the field created by a current. The flat-hand or cross-product rule is for finding the force on a current or charge in an external field. Using one where the other is needed is the most common direction error in this entire subject.
05 — Wire Interactions

Force Between Parallel Wires

Two wires. No net charge. Yet they exert a force on each other. How? The magnetic field is the mediator. This is one of the most satisfying logical chains in electromagnetism.

Wire 1 creates a field at Wire 2. Wire 1 carries current \(I_1\). By our infinite-wire result, it creates a magnetic field \(B_1 = \frac{\mu_0 I_1}{2\pi d}\) at the location of Wire 2, where \(d\) is the separation. By the grip rule, this field is perpendicular to the plane containing the two wires.
Wire 2 feels a force in that field. Wire 2 carries current \(I_2\) through the field \(B_1\). The force per unit length on a current-carrying wire in a magnetic field is \(F/L = I_2 B_1\) (from the Lorentz force \(\mathbf{F} = I\mathbf{L}\times\mathbf{B}\)).
Substitute and simplify.
Step-by-step substitution
\[B_1 = \frac{\mu_0 I_1}{2\pi d}\]
Field of Wire 1 at Wire 2's location. This is the infinite wire result. \(d\) is the separation between the wires.
\[\frac{F}{L} = I_2\cdot B_1\]
Force per unit length on Wire 2. From the Lorentz force law \(\mathbf{F} = I\mathbf{L}\times\mathbf{B}\), the magnitude per unit length is \(F/L = I_2 B_1\) when \(B_1\) is perpendicular to the wire (which it is here).
\[= I_2\cdot\frac{\mu_0 I_1}{2\pi d}\]
Substitute \(B_1\). Replace \(B_1\) with the expression derived above.
\[\frac{F}{L} = \frac{\mu_0 I_1 I_2}{2\pi d}\]
Multiply through. Bring \(I_2\) into the numerator alongside \(I_1\). The result is symmetric in \(I_1\) and \(I_2\) — Newton's third law is automatically satisfied.
\[\frac{F}{L} = \frac{\mu_0 I_1 I_2}{2\pi d}\]
force per unit length between two parallel wires separated by d

The direction: why same currents attract

This trips people up because it seems backward. Here's the clean geometric argument. Let both currents flow in the \(+x\) direction. Wire 1 creates a field at Wire 2 pointing in the \(-z\) direction (into the page if the wires are in the xy-plane and Wire 2 is above Wire 1). The force on Wire 2 is \(I_2\hat{x} \times (-\hat{z}) = I_2(\hat{x}\times(-\hat{z})) = I_2\hat{y}\), which points from Wire 2 toward Wire 1. Attraction.

Now reverse Wire 2's current so it flows in the \(-x\) direction. The force becomes \(-I_2\hat{x} \times (-\hat{z}) = -I_2\hat{y}\), pointing away from Wire 1. Repulsion.

Contrast with Electric Forces
In electrostatics, opposite charges attract. Here, currents in the same direction attract. The physics is completely different — you're not dealing with charge–charge interaction but with a magnetic field mediating a velocity-dependent force. The resemblance in the \(1/r\) distance dependence is a coincidence of geometry.
Parallel Wires — Force Calculator
I₁ +30 A ↑
I₂ +30 A ↑
separation d 0.10 m
|F/L| = μ₀|I₁||I₂| / 2πd
Worked Example — Force Between Bus Bars

Two parallel bus bars in an electrical panel are 5 cm apart and each carries 400 A in the same direction. Find the force per unit length between them. Do they attract or repel?

\(I_1 = I_2 = 400\) A, \(\;d = 0.05\) m
Full Solution
\[\frac{F}{L} = \frac{\mu_0 I_1 I_2}{2\pi d}\]
Write the formula. Force per unit length between two parallel current-carrying wires separated by \(d\).
\[= \frac{(4\pi\times10^{-7})(400)(400)}{2\pi(0.05)}\]
Substitute values. \(\mu_0 = 4\pi\times10^{-7}\) T·m/A, \(I_1 = I_2 = 400\) A, \(d = 0.05\) m.
\[= \frac{4\pi\times10^{-7}\times1.6\times10^5}{0.1\pi}\]
Evaluate numerator and denominator separately. Numerator: \(400\times400 = 1.6\times10^5\). Denominator: \(2\pi\times0.05 = 0.1\pi\).
\[= \frac{4\times1.6\times10^{-7+5}\times\pi}{0.1\pi}\]
Group and separate \(\pi\). Isolate \(\pi\) so it cancels.
\[= \frac{6.4\times10^{-2}}{0.1}\]
Cancel \(\pi\) and compute the coefficient. \(\pi/\pi = 1\). \(4\times1.6 = 6.4\). Exponent: \(-7+5 = -2\). So numerator is \(6.4\times10^{-2}\).
\[\frac{F}{L} = 0.64\;\text{N/m}\]
Divide. \(6.4\times10^{-2}\,/\,0.1 = 6.4\times10^{-2}\times10 = 0.64\). Same direction currents → attractive.
Answer
\(F/L = 0.64\) N/m, attractive. At 1 metre of bar: a 64-gram weight's worth of force. Bus bar supports must be engineered to resist this.
06 — Symmetry in Action

The Circular Current Loop

A wire bent into a circle. This is where symmetry really starts to shine. We'll compute the field at the center, then derive the full on-axis field — both with complete derivations.

Field at the center — using pure symmetry

Every element is equidistant. For any \(d\boldsymbol{\ell}\) on the loop, the distance to the center is always exactly \(R\). So \(r = R\) is a constant — no variation with position along the loop.
Every element is perpendicular to its radius. The current direction \(d\boldsymbol{\ell}\) is always tangent to the circle, and \(\hat{\mathbf{r}}\) (from element to center) is always radial. Tangent ⊥ radial, so \(\theta = 90°\) everywhere. That means \(\sin\theta = 1\) everywhere — maximum contribution from every element.
Every \(d\mathbf{B}\) points the same direction. By the right-hand rule, \(d\boldsymbol{\ell} \times \hat{\mathbf{r}}\) at every point around the loop points in the \(+\hat{z}\) direction (through the center, perpendicular to the plane of the loop). All contributions reinforce — no cancellation.
Integrate — and show every step.
Center of loop — integration
\[dB = \frac{\mu_0 I}{4\pi}\frac{d\ell\cdot\sin\theta}{r^2}\]
Write Biot–Savart. Scalar magnitude for one element \(d\ell\).
\[r = R,\quad \sin\theta = 1\]
Apply the two symmetry facts. Every element is distance \(R\) from center. Every element is perpendicular to its radius (\(\theta=90°\)).
\[dB = \frac{\mu_0 I}{4\pi R^2}\,d\ell\]
Substitute \(r=R\) and \(\sin\theta=1\). The integrand is now just \(d\ell\) times a constant — every element contributes equally.
\[B = \int dB = \frac{\mu_0 I}{4\pi R^2}\int_{\text{loop}}d\ell\]
Integrate. Since the prefactor is constant (no dependence on position along the loop), it pulls completely outside the integral. We just need \(\int d\ell\).
\[\int_{\text{loop}}d\ell = 2\pi R\]
Evaluate the path integral. Integrating the arc length element \(d\ell\) all the way around a circle of radius \(R\) gives the circumference \(2\pi R\).
\[B = \frac{\mu_0 I}{4\pi R^2}\cdot 2\pi R\]
Substitute the circumference. Replace \(\int d\ell\) with \(2\pi R\).
\[= \frac{2\pi\mu_0 I R}{4\pi R^2}\]
Multiply numerator. Bring \(2\pi R\) into the numerator.
\[= \frac{\mu_0 I}{2R}\]
Cancel. \(2\pi/4\pi = 1/2\). \(R/R^2 = 1/R\). Result: \(\mu_0 I / 2R\).
\[B_{\text{center}} = \frac{\mu_0 I}{2R} \qquad \text{(1 loop)}\] \[B_{\text{center}} = \frac{\mu_0 N I}{2R} \qquad \text{(N loops)}\]
field at center of circular loop of radius R

On-axis field — the full derivation

Now the harder and more rewarding result: the field at a point \(P\) on the axis of the loop, at distance \(x\) from the center. This is a beautiful application of the symmetry-cancellation technique.

On-Axis Loop Field — Full Derivation, One Move Per Line
\[r = \sqrt{R^2 + x^2}\]
Distance from element to on-axis point \(P\). By rotational symmetry every element on the loop is at the same distance from \(P\). Pythagoras: \(R\) is the loop radius (horizontal), \(x\) is the axial distance.
\[r^2 = R^2 + x^2\]
Square it — we'll need this in the denominator.
\[\sin\theta = 1\quad(\theta = 90°)\]
Current element is perpendicular to displacement. The current \(d\boldsymbol{\ell}\) is tangent to the loop. The displacement vector to \(P\) lies in the plane defined by the radius and the axis. Tangent ⊥ that plane, so \(\theta = 90°\), \(\sin\theta = 1\).
\[dB = \frac{\mu_0 I\,d\ell}{4\pi(R^2+x^2)}\]
Substitute into Biot–Savart. Replace \(r^2 = R^2+x^2\) and \(\sin\theta = 1\). Since both are constant across all elements, the integrand only contains \(d\ell\).
\[d\mathbf{B}\text{ is tilted — has axial and radial components}\]
Identify the direction problem. Each \(d\mathbf{B}\) vector is perpendicular to the displacement from the element to \(P\), which itself is tilted relative to the axis. So \(d\mathbf{B}\) is not purely axial — it has a perpendicular-to-axis (radial) piece too.
\[dB_\perp:\text{ cancels by symmetry}\]
Kill the radial component. For every element on the loop, the diametrically opposite element produces a \(dB_\perp\) in the exact opposite direction. They cancel in pairs. We only need to keep the axial component.
\[\sin\alpha = \frac{R}{\sqrt{R^2+x^2}}\]
Find the projection angle. Let \(\alpha\) be the angle between the displacement vector (from element to \(P\)) and the perpendicular plane. The "opposite" side is \(R\) and the hypotenuse is \(r = \sqrt{R^2+x^2}\). So \(\sin\alpha = R/r\).
\[dB_x = dB\cdot\frac{R}{\sqrt{R^2+x^2}}\]
Project onto the axis. The axial component of \(d\mathbf{B}\) is \(dB\sin\alpha = dB\cdot R/\sqrt{R^2+x^2}\).
\[dB_x = \frac{\mu_0 I\,d\ell}{4\pi(R^2+x^2)}\cdot\frac{R}{\sqrt{R^2+x^2}}\]
Substitute \(dB\). Replace \(dB\) with the expression from step 4.
\[dB_x = \frac{\mu_0 I R\,d\ell}{4\pi(R^2+x^2)^{3/2}}\]
Combine the denominator. \((R^2+x^2)\cdot\sqrt{R^2+x^2} = (R^2+x^2)^{1}\cdot(R^2+x^2)^{1/2} = (R^2+x^2)^{3/2}\).
\[B_x = \frac{\mu_0 I R}{4\pi(R^2+x^2)^{3/2}}\oint d\ell\]
Integrate. The prefactor is constant for all elements, so pull it out. Integrate \(d\ell\) around the full loop.
\[\oint d\ell = 2\pi R\]
Evaluate the path integral. Full circumference of a circle of radius \(R\).
\[B_x = \frac{\mu_0 I R}{4\pi(R^2+x^2)^{3/2}}\cdot 2\pi R\]
Substitute. Replace \(\oint d\ell\) with \(2\pi R\).
\[= \frac{2\pi\mu_0 I R^2}{4\pi(R^2+x^2)^{3/2}}\]
Multiply out the numerator. \(\mu_0 I R \cdot 2\pi R = 2\pi\mu_0 I R^2\).
\[B_x = \frac{\mu_0 I R^2}{2(R^2+x^2)^{3/2}}\]
Simplify. Cancel \(2\pi/4\pi = 1/2\). Done.
\[B_x = \frac{\mu_0 I R^2}{2(R^2+x^2)^{3/2}}\]
on-axis field of a circular loop at distance x from center
Limiting Cases — Always Check These
At \(x = 0\): \(B_x = \mu_0 I / 2R\). Correct — matches the center result. As \(x \to \infty\): \(B_x \approx \mu_0 I R^2 / 2x^3 \propto 1/x^3\). A loop looks like a magnetic dipole from far away, with field falling off as \(1/r^3\) — exactly like an electric dipole's field along its axis. This is the first glimpse of magnetic dipole physics.
Circular Loop — On-Axis Field Explorer
Current I 10 A
Radius R 0.10 m
Turns N 1
Axis pos x 0.00 m
B at center (x=0)
B at position x
Worked Example — Field at Center of a Loop

A circular loop of radius \(R = 5\) cm carries \(I = 2\) A. Find the magnetic field at the center.

\(N = 1\), \(\;I = 2\) A, \(\;R = 0.05\) m
Full Solution
\[B = \frac{\mu_0 I}{2R}\]
Write the formula. Field at the center of a single circular loop of radius \(R\).
\[= \frac{(4\pi\times10^{-7})(2)}{2(0.05)}\]
Substitute values. \(\mu_0 = 4\pi\times10^{-7}\), \(I = 2\) A, \(R = 0.05\) m.
\[= \frac{8\pi\times10^{-7}}{0.10}\]
Evaluate numerator and denominator. \(4\pi\times10^{-7}\times2 = 8\pi\times10^{-7}\). \(2\times0.05 = 0.10\).
\[= 80\pi\times10^{-7}\;\text{T}\]
Divide. \(8\pi\times10^{-7}\,/\,0.1 = 8\pi\times10^{-7}\times10 = 80\pi\times10^{-7}\).
\[= 8\pi\times10^{-6}\;\text{T}\]
Rewrite exponent. \(80\times10^{-7} = 8\times10^{-6}\).
\[B \approx 25.1\;\mu\text{T}\]
Evaluate numerically. \(8\pi \approx 25.13\). So \(B \approx 25.1\times10^{-6}\) T \(= 25.1\;\mu\text{T}\).
Answer
\(B \approx 25.1\;\mu\text{T}\), about half of Earth's field, from a loop the size of your palm carrying 2 A.
Worked Example — On-Axis Field, Dipole Limit

The same loop (\(R = 0.05\) m, \(I = 2\) A). Find \(B\) on the axis at \(x = 20\) cm from the center. Then verify the dipole approximation \(B \approx \frac{\mu_0 I R^2}{2x^3}\) (valid when \(x \gg R\)).

\(R = 0.05\) m, \(\;I = 2\) A, \(\;x = 0.20\) m
Exact formula
\[B = \frac{\mu_0 I R^2}{2(R^2+x^2)^{3/2}}\]
Write the on-axis formula.
\[R^2 = (0.05)^2 = 0.0025\;\text{m}^2\]
Compute \(R^2\).
\[x^2 = (0.20)^2 = 0.04\;\text{m}^2\]
Compute \(x^2\).
\[R^2+x^2 = 0.0025+0.04 = 0.0425\;\text{m}^2\]
Add them.
\[(0.0425)^{3/2} = \sqrt{0.0425^3} = \sqrt{7.666\times10^{-5}} = 8.755\times10^{-3}\]
Raise to 3/2 power. First cube: \(0.0425^3 = 7.666\times10^{-5}\). Then square-root.
\[\mu_0 I R^2 = (4\pi\times10^{-7})(2)(0.0025) = 2\pi\times10^{-9}\]
Compute numerator. \(4\pi\times10^{-7}\times2\times0.0025 = 4\pi\times0.005\times10^{-7} = 0.02\pi\times10^{-7} = 2\pi\times10^{-9}\).
\[B = \frac{2\pi\times10^{-9}}{2\times8.755\times10^{-3}}\]
Substitute everything.
\[= \frac{2\pi\times10^{-9}}{1.751\times10^{-2}} = \frac{6.283\times10^{-9}}{1.751\times10^{-2}}\]
Evaluate numerator. \(2\pi \approx 6.283\). Denominator: \(2\times8.755\times10^{-3} = 1.751\times10^{-2}\).
\[B = 3.59\times10^{-7}\;\text{T} \approx 0.359\;\mu\text{T}\]
Divide. \(6.283/1.751 \approx 3.59\). Exponent: \(-9-(-2) = -7\).
Dipole approximation (\(x \gg R\))
\[x \gg R \Rightarrow R^2+x^2 \approx x^2\]
The approximation. When \(x = 20\) cm and \(R = 5\) cm, \(x/R = 4\). The \(R^2\) term is \((1/16)\) the size of \(x^2\) — small but not tiny.
\[(R^2+x^2)^{3/2} \approx (x^2)^{3/2} = x^3\]
Simplify the denominator.
\[B \approx \frac{\mu_0 I R^2}{2x^3}\]
Substitute. This is the magnetic dipole approximation.
\[= \frac{(4\pi\times10^{-7})(2)(0.0025)}{2(0.20)^3}\]
Substitute values.
\[= \frac{2\pi\times10^{-9}}{2\times0.008} = \frac{2\pi\times10^{-9}}{0.016}\]
Evaluate. \(x^3 = (0.20)^3 = 0.008\). Denominator: \(2\times0.008 = 0.016\).
\[\approx \frac{6.283\times10^{-9}}{1.6\times10^{-2}} \approx 3.93\times10^{-7}\;\text{T}\]
Final division. Exponent: \(-9-(-2) = -7\). Coefficient: \(6.283/1.6 \approx 3.93\).
Answer
Exact: \(\approx0.36\;\mu\text{T}\). Dipole approx: \(\approx0.39\;\mu\text{T}\). About 9% error — at \(x = 4R\) the approximation is already quite reasonable. At \(x > 10R\) the error would be under 1%.
07 — Loops Stacked

The Solenoid

Pack \(n\) circular loops per meter together into a long helix. Each loop contributes an on-axis field of \(\mu_0 I R^2 / 2(R^2+x^2)^{3/2}\). What happens when you add up contributions from all of them?

Qualitative picture first

Inside the solenoid, every loop contributes a field pointing in the same axial direction. They add constructively. Outside, adjacent loops on opposite sides of the helix contribute fields that tend to cancel (they point in opposite azimuthal senses when viewed from outside). For an ideal infinite solenoid, the exterior field is exactly zero and the interior field is perfectly uniform.

UNIFORM B INSIDE B≈0 B≈0 n turns/meter, current I

Quantitative derivation via integration

Consider a solenoid with \(n\) turns per unit length. A ring of turns of thickness \(dx\) at position \(x\) from the field point contains \(n\,dx\) turns, each contributing the on-axis loop field. Integrating over the infinite solenoid:

Solenoid Field — Integration Derivation, One Move Per Line
\[dB = \frac{\mu_0(n\,dx)I R^2}{2(R^2+x^2)^{3/2}}\]
Start from the on-axis loop formula. A thin ring of thickness \(dx\) at axial position \(x\) contains \(n\,dx\) turns. Substitute \(N \to n\,dx\) into the loop formula \(B = \mu_0 N I R^2 / 2(R^2+x^2)^{3/2}\).
\[B = \frac{\mu_0 n I R^2}{2}\int_{-\infty}^{+\infty}\frac{dx}{(R^2+x^2)^{3/2}}\]
Integrate over all rings. Pull constants \(\mu_0 n I R^2 / 2\) outside the integral. Integrate over \(x\) from \(-\infty\) to \(+\infty\) (infinite solenoid).
\[x = R\cot\phi, \quad dx = -\frac{R}{\sin^2\phi}\,d\phi\]
Trig substitution to crack the integral. The denominator has the form \((a^2+x^2)^{3/2}\). Substituting \(x = R\cot\phi\) will simplify it. Derivative: \(dx/d\phi = -R/\sin^2\phi\).
\[R^2+x^2 = R^2+R^2\cot^2\phi = R^2(1+\cot^2\phi) = \frac{R^2}{\sin^2\phi}\]
Simplify the sum. Factor out \(R^2\). Use the Pythagorean identity \(1+\cot^2\phi = \csc^2\phi = 1/\sin^2\phi\).
\[(R^2+x^2)^{3/2} = \left(\frac{R^2}{\sin^2\phi}\right)^{3/2} = \frac{R^3}{\sin^3\phi}\]
Raise to the 3/2 power. \((R^2)^{3/2} = R^3\). \((1/\sin^2\phi)^{3/2} = 1/\sin^3\phi\).
\[\int_{-\infty}^{+\infty}\frac{dx}{(R^2+x^2)^{3/2}} \to \int_\pi^0 \frac{-R/\sin^2\phi\;d\phi}{R^3/\sin^3\phi}\]
Substitute into the integral. Replace \(dx\) and the denominator. Limits: as \(x:\,-\infty\to+\infty\), \(\phi:\,\pi\to 0\) (since \(\cot\pi = -\infty\to\cot 0 = +\infty\), reversed).
\[= \int_\pi^0 \frac{-R\sin^3\phi}{R^3\sin^2\phi}\,d\phi = \int_\pi^0 \frac{-\sin\phi}{R^2}\,d\phi\]
Cancel factors. Numerator: \(-R/\sin^2\phi\). Denominator: \(R^3/\sin^3\phi\). Dividing: \((-R\cdot\sin^3\phi)/(R^3\cdot\sin^2\phi) = -\sin\phi/R^2\).
\[= \frac{1}{R^2}\int_0^\pi \sin\phi\,d\phi\]
Flip the limits to absorb the minus sign. \(\int_\pi^0(-\sin\phi)\,d\phi = \int_0^\pi\sin\phi\,d\phi\). Pull out the \(1/R^2\).
\[\int_0^\pi\sin\phi\,d\phi = \Big[-\cos\phi\Big]_0^\pi\]
Antiderivative of \(\sin\phi\). \(\int\sin\phi\,d\phi = -\cos\phi + C\).
\[= -\cos\pi + \cos 0 = -(-1) + 1 = 2\]
Evaluate at the limits. \(\cos\pi = -1\), \(\cos 0 = 1\). So \(-(-1)+1 = 2\).
\[\int_{-\infty}^{+\infty}\frac{dx}{(R^2+x^2)^{3/2}} = \frac{1}{R^2}\cdot 2 = \frac{2}{R^2}\]
Assemble. Multiply \(1/R^2\) by the integral value 2.
\[B = \frac{\mu_0 n I R^2}{2}\cdot\frac{2}{R^2}\]
Substitute the integral result back.
\[= \frac{2\mu_0 n I R^2}{2R^2}\]
Multiply numerator.
\[B = \mu_0 n I\]
Cancel \(R^2\) and the factor of 2. \(2/2 = 1\), \(R^2/R^2 = 1\). The radius dropped out entirely — the interior field is independent of the solenoid's radius.
\[B = \mu_0 n I\]
field inside ideal infinite solenoid — n = turns per unit length
R dropped out — why?
The solenoid field is independent of radius because adding more rings at the same spacing always compensates for the increased distance. Qualitatively: a wider solenoid has loops that are farther away but subtend larger solid angles. These effects exactly cancel, leaving only \(n\) (turns/m) and \(I\). This is a non-obvious result and it's one of the reasons the integration via Ampère's law (next section) is so elegant — symmetry lets you skip all of this.
Solenoid — Interior Field Calculator
Current I 10 A
n (turns/m) 1000 /m
B = μ₀nI inside
12.57 mT
Worked Example — Designing an Electromagnet

You need a solenoid that produces a 50 mT field inside. You have a power supply that can deliver up to 5 A. How many turns per meter do you need?

Target: \(B = 50\times10^{-3}\) T, \(\;I = 5\) A. Solve for \(n\).
Full Solution
\[B = \mu_0 n I\]
Write the formula. Interior field of an ideal infinite solenoid.
\[n = \frac{B}{\mu_0 I}\]
Isolate \(n\). Divide both sides by \(\mu_0 I\).
\[= \frac{50\times10^{-3}}{(4\pi\times10^{-7})(5)}\]
Substitute values. \(B = 0.050\) T, \(\mu_0 = 4\pi\times10^{-7}\) T·m/A, \(I = 5\) A.
\[= \frac{0.050}{20\pi\times10^{-7}}\]
Evaluate denominator. \(4\pi\times10^{-7}\times5 = 20\pi\times10^{-7}\).
\[= \frac{0.050}{6.283\times10^{-6}}\]
Evaluate \(20\pi\). \(20\pi \approx 62.83\), so \(20\pi\times10^{-7} = 6.283\times10^{-6}\).
\[= \frac{5\times10^{-2}}{6.283\times10^{-6}}\]
Rewrite 0.050 in scientific notation. \(0.050 = 5\times10^{-2}\).
\[= \frac{5}{6.283}\times10^{-2+6} = 0.7958\times10^{4}\]
Divide coefficients and subtract exponents. \(-2 - (-6) = +4\). \(5/6.283 \approx 0.7958\).
\[n \approx 7{,}958\;\text{turns/m}\]
Final value. \(0.7958\times10^4 = 7958\). Radius of solenoid is completely irrelevant — only \(n\) and \(I\) determine the interior field.
Answer
\(n \approx 7{,}958\) turns/m. For a 20 cm solenoid: \(7958\times0.20 \approx 1{,}592\) total turns — roughly 8 layers of 200.
08 — The Elegant Shortcut

Ampère's Law

Biot–Savart is honest and completely general. But sometimes you spend a full page integrating to get a result that symmetry would've handed you in two lines. Ampère's law is that shortcut — and understanding when and why it works turns it from a magic formula into a tool you can trust.

\[\oint \mathbf{B}\cdot d\boldsymbol{\ell} = \mu_0 I_{\text{enc}}\]
Ampère's Law

Decoding the left side: magnetic circulation

The symbol \(\oint\) means a closed line integral — you integrate all the way around a closed path called the Ampèrian loop. At each point on the loop, you take the component of \(\mathbf{B}\) tangent to the loop (\(\mathbf{B}\cdot d\boldsymbol{\ell}\)) and sum it up around the entire loop. This is called the circulation of \(\mathbf{B}\).

Decoding the right side: enclosed current

\(I_{\text{enc}}\) is the total current threading through the surface bounded by your chosen loop. Only current that passes through the loop matters — current outside can affect the local direction of \(\mathbf{B}\), but when you integrate \(\mathbf{B}\cdot d\boldsymbol{\ell}\) around the whole loop, those external contributions add to zero by symmetry.

The Deep Message
Ampère's law says: the magnetic circulation around any closed path is exactly \(\mu_0\) times the current threading through that path. It is a statement about the topology of magnetic fields — how they wrap around currents. It is always true, but only computationally useful when symmetry lets you factor \(B\) out of the integral.

The symmetry strategy — how to choose your Ampèrian loop

To extract \(B\) from Ampère's law, you need a loop where you can evaluate \(\oint \mathbf{B}\cdot d\boldsymbol{\ell}\) without knowing \(\mathbf{B}\) in advance. The trick: choose a loop where one of these conditions holds everywhere on it:

Application 1: Infinite straight wire

Choose the loop. A circle of radius \(R\) centered on the wire, in a plane perpendicular to it. By rotational symmetry: \(\mathbf{B}\) has the same magnitude everywhere on this circle and must point tangentially (it can't point radially — that would violate \(\nabla\cdot\mathbf{B}=0\), and it can't point axially by the right-hand rule for the current geometry).
Evaluate the left side:
Evaluating the left side
\[\oint \mathbf{B}\cdot d\boldsymbol{\ell}\]
The integral to evaluate. Around our circular loop of radius \(R\).
\[\mathbf{B}\parallel d\boldsymbol{\ell}\text{ everywhere, and }|\mathbf{B}| = B = \text{const}\]
Apply symmetry. \(\mathbf{B}\) is azimuthal and constant in magnitude on the loop. So \(\mathbf{B}\cdot d\boldsymbol{\ell} = B\,d\ell\) everywhere — the dot product reduces to a scalar product.
\[= B\oint d\ell\]
Factor out \(B\). Since \(B\) is constant on the loop, it comes outside the integral.
\[\oint d\ell = 2\pi R\]
Evaluate path integral. Integrating the arc length element around a circle of radius \(R\) gives the circumference.
\[\oint \mathbf{B}\cdot d\boldsymbol{\ell} = B(2\pi R)\]
Result.
Set equal to right side and solve:
Solving for B
\[B(2\pi R) = \mu_0 I\]
Apply Ampère's law. Set left side equal to \(\mu_0 I_\text{enc} = \mu_0 I\).
\[B = \frac{\mu_0 I}{2\pi R}\]
Divide both sides by \(2\pi R\). Same result as Biot–Savart, in three lines instead of a page.

Application 2: Solenoid

Choose a rectangular loop with one side of length \(L\) inside the solenoid (parallel to the axis) and one side outside. The other two sides cross the solenoid wall perpendicularly.
Evaluate each side:
• Outside leg: \(B_{\text{outside}} \approx 0\) for ideal solenoid → contributes 0
• Two short legs (crossing the wall): \(\mathbf{B}\perp d\boldsymbol{\ell}\) → each contributes 0
• Inside leg: \(\mathbf{B}\parallel d\boldsymbol{\ell}\), magnitude \(B\) → contributes \(B\cdot L\)
Count enclosed current: Over length \(L\) there are \(nL\) turns each carrying current \(I\), so \(I_{\text{enc}} = nLI\).
Apply Ampère's law — one piece at a time:
Evaluating each side of Ampère's law
\[\oint\mathbf{B}\cdot d\boldsymbol{\ell} = \underbrace{B\cdot L}_{\text{inside leg}} + \underbrace{0}_{\text{outside}} + \underbrace{0+0}_{\text{two short legs}}\]
Evaluate each segment. Outside leg: \(B\approx 0\) for ideal solenoid → zero. Short legs cross the wall: \(\mathbf{B}\perp d\boldsymbol{\ell}\) → zero. Inside leg: \(\mathbf{B}\parallel d\boldsymbol{\ell}\), magnitude \(B\) → contributes \(B\cdot L\).
\[\oint\mathbf{B}\cdot d\boldsymbol{\ell} = BL\]
Simplify. Only the inside leg survives.
\[I_\text{enc} = n L \cdot I\]
Count enclosed current. Over length \(L\) there are \(nL\) turns, each carrying current \(I\).
\[BL = \mu_0(nLI)\]
Set left = right. Ampère's law: \(\oint\mathbf{B}\cdot d\boldsymbol{\ell} = \mu_0 I_\text{enc}\).
\[B = \mu_0 nI\]
Cancel \(L\) from both sides. \(L\) cancels perfectly — the result is independent of where inside the solenoid you drew the loop.
Ampère's Law — Circulation Verifier

Verify Ampère's law numerically for a straight wire. The left side \(\oint \mathbf{B}\cdot d\boldsymbol{\ell} = B \cdot 2\pi R\) must exactly equal \(\mu_0 I_\text{enc}\) regardless of loop radius.

Current I 30 A
Loop radius R 0.05 m
B × (2πR) — left side
μ₀ · I_enc — right side

Change the loop radius — the two sides always match, regardless of R. This shows that Ampère's law is a statement about circulation, not about the field at any one point.

Worked Example — Ampère's Law on a Coaxial Cable

A coaxial cable has an inner conductor (radius \(a = 1\) mm) carrying \(I = 3\) A in the \(+z\) direction, and an outer cylindrical shell (radius \(b = 5\) mm) carrying \(3\) A in the \(-z\) direction (return current). Find \(B\) at \(r = 3\) mm and at \(r = 8\) mm.

Inner: \(I_\text{inner} = +3\) A, \(a = 1\) mm. Outer shell: \(I_\text{outer} = -3\) A, \(b = 5\) mm.
At r = 3 mm (between conductors)
\[r = 0.003\;\text{m},\quad a < r < b\]
Identify the region. 3 mm is outside the inner conductor (1 mm) but inside the outer shell (5 mm).
\[I_\text{enc} = +3\;\text{A}\]
Count enclosed current. Only the inner conductor threads through a loop at \(r = 3\) mm. The outer shell is entirely outside — not enclosed.
\[\oint\mathbf{B}\cdot d\boldsymbol{\ell} = B(2\pi r)\]
Evaluate left side of Ampère's law. By symmetry \(B\) is constant and tangential on a circular loop of radius \(r\).
\[B(2\pi r) = \mu_0 I_\text{enc} = \mu_0(3)\]
Apply Ampère's law. Set left = \(\mu_0 I_\text{enc}\).
\[B = \frac{\mu_0(3)}{2\pi(0.003)}\]
Isolate \(B\). Divide both sides by \(2\pi r\).
\[= \frac{(4\pi\times10^{-7})(3)}{6\pi\times10^{-3}}\]
Substitute \(\mu_0\). Denominator: \(2\pi\times0.003 = 6\pi\times10^{-3}\).
\[= \frac{12\pi\times10^{-7}}{6\pi\times10^{-3}}\]
Evaluate numerator. \(4\pi\times10^{-7}\times3 = 12\pi\times10^{-7}\).
\[= \frac{12}{6}\times10^{-7+3} = 2\times10^{-4}\;\text{T}\]
Cancel \(\pi\) and simplify. \(12\pi/6\pi = 2\). Exponent: \(-7-(-3) = -4\).
\[B = 200\;\mu\text{T}\]
Convert. \(2\times10^{-4}\) T \(= 200\times10^{-6}\) T \(= 200\;\mu\text{T}\).
At r = 8 mm (outside both conductors)
\[r = 0.008\;\text{m},\quad r > b\]
Identify the region. 8 mm is outside both the inner conductor (1 mm) and the outer shell (5 mm).
\[I_\text{enc} = (+3) + (-3) = 0\;\text{A}\]
Count enclosed current. The Ampèrian loop encloses both conductors. Their currents are equal and opposite — total enclosed current is zero.
\[B(2\pi r) = \mu_0 \cdot 0 = 0\]
Apply Ampère's law. Right side is zero.
\[B = 0\]
Divide both sides by \(2\pi r\). The field is exactly zero outside a coaxial cable.
Answer
\(B = 200\;\mu\text{T}\) at \(r = 3\) mm. \(B = 0\) at \(r = 8\) mm. This zero external field is the whole point of coaxial cables — the return current in the outer shell cancels the field externally, preventing radiation and interference.
09 — More Ampère Applications

Toroid and the Thick Conductor

Two more classic Ampère's law applications that appear constantly — the toroid and the field inside a thick conducting wire.

The Toroid

A solenoid bent into a donut (torus) shape, with \(N\) total turns. The symmetry argument: by rotational symmetry around the donut axis, \(\mathbf{B}\) must be azimuthal (circling the donut axis) and constant in magnitude on any concentric circle of radius \(r\) inside the donut.

Inside the donut (\(r_1 < r < r_2\)): Choose a circular Ampèrian loop of radius \(r\) centered on the toroid axis. By symmetry \(B\) is constant and tangential: \[\oint \mathbf{B}\cdot d\boldsymbol{\ell} = B(2\pi r)\] All \(N\) turns thread through this loop: \(I_\text{enc} = NI\). \[B = \frac{\mu_0 NI}{2\pi r}\]
Outside the donut (\(r > r_2\)): A circular loop outside the donut encloses equal numbers of forward and return current turns — total enclosed current is zero. So \(B = 0\) outside.
In the donut hole (\(r < r_1\)): No current threads through a circular loop in the hole. \(I_\text{enc} = 0\), so \(B = 0\) in the hole.
\[B_{\text{toroid}} = \frac{\mu_0 N I}{2\pi r} \quad (r_1 < r < r_2)\] \[B = 0 \quad \text{(outside and in hole)}\]
field inside a toroid
Toroid vs. Solenoid
The solenoid field is uniform: \(B = \mu_0 nI\), independent of position inside. The toroid field varies as \(1/r\) — it's stronger near the inner radius and weaker near the outer radius. If \(r_2 - r_1 \ll r_{\text{avg}}\) (a "thin" toroid), then \(r \approx r_\text{avg}\) throughout and the field approaches the solenoid result \(\mu_0 nI\) where \(n = N/2\pi r_\text{avg}\).

Field inside a thick cylindrical conductor

Real wires have finite radius. Suppose a solid cylindrical conductor of radius \(a\) carries total current \(I\) distributed uniformly across its cross-section. What's the field at radius \(r\)?

Key idea: Apply Ampère's law with a circular loop of radius \(r\). For \(r > a\) (outside), all the current is enclosed. For \(r < a\) (inside), only the current in the inner disk of radius \(r\) is enclosed.

Outside (\(r > a\)): \(I_\text{enc} = I\), so \(B(2\pi r) = \mu_0 I \Rightarrow B = \frac{\mu_0 I}{2\pi r}\). Same as an infinite thin wire. The details of the interior don't matter when you're outside.
Inside (\(r < a\)):
Deriving B inside the wire
\[J = \frac{I}{\pi a^2}\]
Current density. Total current \(I\) spread uniformly over cross-section \(\pi a^2\).
\[I_\text{enc} = J\cdot\pi r^2\]
Enclosed current. Multiply density by the area of the inner disk of radius \(r\).
\[= \frac{I}{\pi a^2}\cdot\pi r^2 = I\frac{r^2}{a^2}\]
Substitute and simplify. The \(\pi\) cancels.
\[B(2\pi r) = \mu_0\cdot I\frac{r^2}{a^2}\]
Apply Ampère's law.
\[B = \frac{\mu_0 I r}{2\pi a^2}\]
Divide both sides by \(2\pi r\). One \(r\) cancels: \(r^2/r = r\). Field grows linearly with \(r\) inside.
\[B = \frac{\mu_0 I r}{2\pi a^2} \quad (r \leq a) \quad\longrightarrow\quad B \propto r\] \[B = \frac{\mu_0 I}{2\pi r} \quad (r \geq a) \quad\longrightarrow\quad B \propto \frac{1}{r}\]
field inside and outside a thick cylindrical conductor of radius a
Thick Conductor — B vs. r Profile
Current I 50 A
Wire radius a 0.015 m
Probe at r 0.015 m
Region
At surface
B at r
Worked Example — Toroid for an MRI Gradient Coil

A toroid has inner radius \(r_1 = 0.10\) m, outer radius \(r_2 = 0.15\) m, and \(N = 500\) turns carrying \(I = 20\) A. Find the field at the inner radius, the center of the winding, and outside.

\(N = 500\), \(\;I = 20\) A, \(\;r_1 = 0.10\) m, \(\;r_2 = 0.15\) m, \(\;r_\text{mid} = 0.125\) m
At inner radius r = 0.10 m
\[B = \frac{\mu_0 N I}{2\pi r}\]
Write the toroid formula. Valid inside the donut (\(r_1 < r < r_2\)).
\[= \frac{(4\pi\times10^{-7})(500)(20)}{2\pi(0.10)}\]
Substitute values.
\[= \frac{4\pi\times10^{-7}\times10^4}{0.2\pi}\]
Evaluate numerator and denominator. \(500\times20 = 10^4\). Denominator: \(2\pi\times0.10 = 0.2\pi\).
\[= \frac{4\times10^{-3}}{0.2} = 20\times10^{-3}\;\text{T}\]
Cancel \(\pi\) and compute. \(4\pi/0.2\pi = 4/0.2 = 20\). Exponent: \(-7+4 = -3\).
\[B = 20\;\text{mT}\]
Convert. \(20\times10^{-3}\) T \(= 20\) mT.
At midpoint r = 0.125 m
\[B = \frac{(4\pi\times10^{-7})(500)(20)}{2\pi(0.125)}\]
Same formula, different \(r\). All other values identical.
\[= \frac{4\pi\times10^{-3}}{0.25\pi}\]
Evaluate denominator. \(2\pi\times0.125 = 0.25\pi\).
\[= \frac{4}{0.25}\times10^{-3} = 16\times10^{-3}\;\text{T} = 16\;\text{mT}\]
Cancel \(\pi\) and divide. \(4/0.25 = 16\).
Answer
20 mT at inner edge, 16 mT at midpoint, 0 outside. The field varies by 25% across the winding — compare to a solenoid's perfectly uniform interior.
Worked Example — Field Inside a Thick Wire

A solid copper conductor with radius \(a = 4\) mm carries a total current \(I = 100\) A uniformly distributed. Find \(B\) at \(r = 2\) mm (inside), \(r = 4\) mm (surface), and \(r = 8\) mm (outside).

\(I = 100\) A, \(\;a = 0.004\) m
Inside at r = 2 mm = 0.002 m
\[J = \frac{I}{\pi a^2}\]
Define current density. Current is uniformly spread over cross-section \(\pi a^2\). Units: A/m².
\[I_\text{enc} = J\cdot\pi r^2 = \frac{I}{\pi a^2}\cdot\pi r^2 = I\cdot\frac{r^2}{a^2}\]
Find enclosed current. Only the disk of radius \(r\) is enclosed. Multiply density by the enclosed area \(\pi r^2\). The \(\pi\) cancels.
\[B(2\pi r) = \mu_0\cdot I\frac{r^2}{a^2}\]
Apply Ampère's law. Left side: \(B(2\pi r)\) by symmetry. Right side: \(\mu_0 I_\text{enc}\).
\[B = \frac{\mu_0 I r}{2\pi a^2}\]
Divide both sides by \(2\pi r\). One factor of \(r\) cancels from the \(r^2/r\).
\[= \frac{(4\pi\times10^{-7})(100)(0.002)}{2\pi(0.004)^2}\]
Substitute values. \(r = 0.002\) m, \(a = 0.004\) m.
\[= \frac{8\pi\times10^{-8}}{2\pi\times1.6\times10^{-5}}\]
Evaluate numerator and denominator. Numerator: \(4\pi\times10^{-7}\times100\times0.002 = 8\pi\times10^{-8}\). Denominator: \(2\pi\times(0.004)^2 = 2\pi\times1.6\times10^{-5}\).
\[= \frac{8\times10^{-8}}{3.2\times10^{-5}} = \frac{8}{3.2}\times10^{-3}\]
Cancel \(\pi\) and compute exponent. \(-8-(-5) = -3\).
\[B = 2.5\;\text{mT}\]
Final division. \(8/3.2 = 2.5\).
At surface r = a = 0.004 m
\[B = \frac{\mu_0 I}{2\pi a}\]
Use the outside formula at \(r = a\). Both inside and outside formulas must agree at the surface.
\[= \frac{(4\pi\times10^{-7})(100)}{2\pi(0.004)}\]
Substitute values.
\[= \frac{4\pi\times10^{-5}}{8\pi\times10^{-3}} = \frac{4}{8}\times10^{-5+3}\]
Evaluate. Numerator: \(4\pi\times10^{-7}\times100 = 4\pi\times10^{-5}\). Denominator: \(2\pi\times0.004 = 8\pi\times10^{-3}\). Cancel \(\pi\).
\[B = 0.5\times10^{-2} = 5.0\;\text{mT}\]
Simplify. \(4/8 = 0.5\). Exponent: \(-5+3 = -2\). This is the maximum — the field peaks at the surface.
Outside at r = 8 mm = 0.008 m
\[I_\text{enc} = I = 100\;\text{A}\]
All current enclosed. Outside the wire, the loop encloses the entire current.
\[B = \frac{\mu_0 I}{2\pi r} = \frac{(4\pi\times10^{-7})(100)}{2\pi(0.008)}\]
Standard wire formula. Substitute \(r = 0.008\) m.
\[= \frac{4\pi\times10^{-5}}{16\pi\times10^{-3}} = \frac{4}{16}\times10^{-2}\]
Evaluate. Numerator: \(4\pi\times10^{-5}\). Denominator: \(2\pi\times0.008 = 16\pi\times10^{-3}\). Cancel \(\pi\). Exponent: \(-5+3 = -2\).
\[B = 0.25\times10^{-2} = 2.5\;\text{mT}\]
Simplify. \(4/16 = 0.25\). Field at \(2a\) is half the surface field — consistent with \(B\propto 1/r\) outside.
Answer
2.5 mT at \(r = a/2\), 5.0 mT at the surface (maximum), 2.5 mT at \(r = 2a\). The field grows linearly inward (\(\propto r\)), peaks at the surface, and falls off inversely outward (\(\propto 1/r\)).
10 — Master Reference

Tool Choice, Common Mistakes, and All Key Equations

When to use which tool

ToolUse whenClassic examples
Biot–Savart No clean symmetry. Need to explicitly sum contributions from specific geometry. The path isn't infinite or doesn't loop back on itself. Arc segment, finite straight wire, center of loop, off-axis loop field, complex wire shapes
Ampère's Law Strong symmetry lets you find a closed path where \(B\) is constant and parallel to \(d\boldsymbol{\ell}\) (or zero) on each segment. Infinite wire, ideal solenoid, toroid, thick conductor (inside and outside)
Decision Rule
The first question is always: does this geometry have enough symmetry to use Ampère's law? If you can draw a closed path where \(B\) is obviously constant by symmetry, use Ampère. If the geometry is arbitrary or finite, use Biot–Savart and integrate. Trying to use Ampère on an asymmetric problem doesn't give you a wrong answer — it gives you a true but useless equation where you still can't extract \(B\).

The seven most common mistakes

Treating B as a scalar. Magnetic field is a vector. Two contributions of equal magnitude pointing in opposite directions cancel to zero. You must track direction before adding.
Confusing source and target. Wire 1 creates a field; Wire 2 feels a force in that field. These are separate steps. The field at a location doesn't depend on whether there's another wire there or not.
Using Ampère's law without sufficient symmetry. Ampère is always true, but it's only useful when you can factor \(B\) out of the integral. If you can't argue by symmetry that \(B\) is constant on your chosen path, the law doesn't simplify — you still can't find \(B\) without more information.
Wrong \(\theta\) in Biot–Savart. \(\theta\) is the angle between \(d\boldsymbol{\ell}\) and \(\hat{\mathbf{r}}\) — the vector from the source element to the field point. Not the angle from the wire to the field point. Not the elevation angle. Draw the geometry carefully.
Forgetting current direction matters for force direction. The force between parallel wires depends on whether the currents are parallel or antiparallel. Same direction attracts; opposite direction repels. Always apply the RHR explicitly — don't guess.
Applying the infinite-wire formula to a finite wire. \(B = \mu_0 I / 2\pi R\) is derived by integrating from \(-\infty\) to \(+\infty\). For a finite wire of length \(2L\), the result involves trigonometric factors. The infinite formula is only valid when the field point is very close to the middle of a very long wire.
Mixing up \(R\) (loop radius) and \(r\) (distance to field point) in loop problems. In the on-axis loop derivation these are completely different quantities. \(R\) is fixed (the loop radius). \(x\) is the axial distance. \(r = \sqrt{R^2+x^2}\) is the slant distance from element to field point.

All key equations — consolidated

Single moving charge
\[\mathbf{B} = \frac{\mu_0}{4\pi}\frac{q\mathbf{v}\times\hat{\mathbf{r}}}{r^2}\]
Biot–Savart Law
\[d\mathbf{B} = \frac{\mu_0}{4\pi}\frac{I\,d\boldsymbol{\ell}\times\hat{\mathbf{r}}}{r^2}\]
Infinite straight wire
\[B = \frac{\mu_0 I}{2\pi R}\]
Force between wires
\[\frac{F}{L} = \frac{\mu_0 I_1 I_2}{2\pi d}\]
Loop center
\[B = \frac{\mu_0 N I}{2R}\]
Loop on-axis
\[B = \frac{\mu_0 I R^2}{2(R^2+x^2)^{3/2}}\]
Solenoid interior
\[B = \mu_0 n I\]
Toroid interior
\[B = \frac{\mu_0 N I}{2\pi r}\]
Thick wire — inside
\[B = \frac{\mu_0 I r}{2\pi a^2}\]
Ampère's Law
\[\oint\mathbf{B}\cdot d\boldsymbol{\ell} = \mu_0 I_\text{enc}\]
The Chain of Reasoning

Moving charge → magnetic field (single-charge formula). Aggregate moving charges in a wire → current element \(I\,d\boldsymbol{\ell}\). Biot–Savart integrates all elements → total field for any geometry. When symmetry is high, Ampère gives the same result in seconds. Those fields then exert forces on other moving charges and currents — which is how wires attract/repel, how motors work, how MRI machines are built. It's all one connected chain from \(q\mathbf{v}\).