\subsection{The Biot--Savart Law}

Currents produce magnetic fields. The Biot--Savart law gives the magnetic field at a point in space due to a steady current distribution. It is the magnetic analogue of Coulomb's law in electrostatics: just as Coulomb's law tells you the electric field of a charge distribution by integrating over point charges, the Biot--Savart law tells you the magnetic field of a current distribution by integrating over current elements.

\dfn{Biot--Savart law (differential form)}{Let a steady current $I$ flow through a thin wire. Consider a differential element of the wire of length $d\ell$ carrying current $I$, represented by the vector $d\vec{\ell}$ pointing in the direction of the current. Let $P$ be an observation point, and let $\vec{r}$ be the displacement vector from the current element to $P$, with magnitude $r = |\vec{r}|$ and unit vector $\hat{r} = \vec{r}/r$. The differential magnetic field at $P$ due to this current element is
\[
d\vec{B} = \frac{\mu_0}{4\pi}\,\frac{I\,d\vec{\ell}\times\hat{r}}{r^2}
         = \frac{\mu_0}{4\pi}\,\frac{I\,d\vec{\ell}\times\vec{r}}{r^3}.
\]
Here $\mu_0 = 4\pi\times 10^{-7}\,\mathrm{T\cdot m/A}$ is the permeability of free space (the magnetic constant).}

\nt{The Biot--Savart law is fundamentally a \emph{superposition principle}: the total field is the vector sum (integral) of all the differential contributions from every current element. Because each contribution involves a cross product, $d\vec{B}$ is always perpendicular to both the current element $d\vec{\ell}$ and the displacement $\vec{r}$. The $1/r^2$ dependence mirrors Coulomb's law, making the Biot--Savart law a Green's-function solution to the static Maxwell equations for $\vec{B}$.}

\thm{Biot--Savart law}{For a steady current $I$ flowing along a wire path $C$, the total magnetic field at a point $P$ is
\[
\vec{B} = \int_C \frac{\mu_0}{4\pi}\,\frac{I\,d\vec{\ell}\times\hat{r}}{r^2}.
\]
\begin{itemize}
\item \textbf{Constants:} $\mu_0 = 4\pi\times 10^{-7}\,\mathrm{T\cdot m/A}$ (permeability of free space). In SI units, $d\vec{B}$ has units of tesla ($\mathrm{T}$).
\item \textbf{Geometry:} $d\vec{\ell}$ points along the wire in the direction of conventional current. The vector $\vec{r}$ points \emph{from} the current element \emph{to} the observation point. The unit vector $\hat{r} = \vec{r}/r$ is the normalized version of this displacement.
\item \textbf{Direction:} The direction of $d\vec{B}$ is given by the right-hand rule for the cross product $d\vec{\ell}\times\hat{r}$. $d\vec{B}$ is perpendicular to the plane containing $d\vec{\ell}$ and $\vec{r}$.
\item \textbf{Magnitude:} The magnitude of the differential field is
\[
dB = \frac{\mu_0}{4\pi}\,\frac{I\,d\ell\,\sin\theta}{r^2},
\]
where $\theta$ is the angle between $d\vec{\ell}$ and $\vec{r}$.
\item \textbf{Symmetry considerations:} In many symmetric geometries (long straight wires, circular loops, solenoids), symmetry allows you to argue that certain components of $\vec{B}$ cancel upon integration, dramatically simplifying the calculation.
\end{itemize}}

\pf{Biot--Savart law from the macroscopic field of a long wire and superposition}{The field of a long straight wire carrying current $I$ is known experimentally (from Amp\`ere's law or direct measurement) to be
\[
B = \frac{\mu_0 I}{2\pi s},
\]
where $s$ is the perpendicular distance from the wire. The Biot--Savart law is the differential statement that, when integrated for an infinite straight wire, reproduces this result.

Consider an infinite straight wire along the $z$-axis carrying current $I$ in the $+\hat{k}$ direction. The observation point is in the $xy$-plane at distance $s$ from the wire. A current element at position $z$ has
\[
d\vec{\ell} = dz\,\hat{k}, \qquad
\vec{r} = s\,\hat{s} - z\,\hat{k}, \qquad
r = \sqrt{s^2+z^2}.
\]
The cross product is
\[
d\vec{\ell}\times\vec{r} = dz\,\hat{k}\times(s\,\hat{s}-z\,\hat{k}) = s\,dz\,(\hat{k}\times\hat{s}) = s\,dz\,\hat{\phi},
\]
which points in the azimuthal direction. The magnitude of the field contribution is
\[
dB = \frac{\mu_0}{4\pi}\,\frac{I\,s\,dz}{(s^2+z^2)^{3/2}}.
\]
Integrating from $z=-\infty$ to $z=+\infty$ using $z = s\tan\theta$, $dz = s\,\sec^2\theta\,d\theta$:
\[
B = \frac{\mu_0 I}{4\pi}\int_{-\infty}^{\infty}\frac{s\,dz}{(s^2+z^2)^{3/2}}
  = \frac{\mu_0 I}{4\pi}\int_{-\pi/2}^{\pi/2}\frac{s^2\,\sec^2\theta}{s^3\,\sec^3\theta}\,d\theta
  = \frac{\mu_0 I}{4\pi s}\int_{-\pi/2}^{\pi/2}\cos\theta\,d\theta
  = \frac{\mu_0 I}{4\pi s}\Bigl[\sin\theta\Bigr]_{-\pi/2}^{\pi/2}
  = \frac{\mu_0 I}{2\pi s}.
\]
This matches the known result for the field of an infinite wire. By linearity, the Biot--Savart law applied to any current distribution gives the correct total field via superposition.
\qed}

\mprop{Field of a long straight wire}{An infinitely long straight wire carrying steady current $I$ produces a magnetic field at perpendicular distance $s$ given by
\[
B = \frac{\mu_0 I}{2\pi s}.
\]
The field lines are concentric circles around the wire, with direction given by the right-hand rule: point your right thumb along the current, and your fingers curl in the direction of $\vec{B}$. In cylindrical coordinates $(s,\phi,z)$ with the wire along the $z$-axis,
\[
\vec{B} = \frac{\mu_0 I}{2\pi s}\,\hat{\phi}.\]
}

\mprop{Field at the center of a circular current loop}{A circular loop of radius $R$ carrying steady current $I$ produces a magnetic field at its center given by
\[
B = \frac{\mu_0 I}{2R}.
\]
The direction is perpendicular to the plane of the loop, given by the right-hand rule: curl your fingers in the direction of the current, and your thumb points along $\vec{B}$. For $N$ tightly wound turns, multiply by $N$:
\[
B = \frac{\mu_0 N I}{2R}.\]
}

\mprop{Field on the axis of a circular current loop}{A circular loop of radius $R$ carrying steady current $I$ produces a magnetic field on its symmetry axis at distance $z$ from the center given by
\[
B(z) = \frac{\mu_0 I\,R^2}{2\,(R^2+z^2)^{3/2}}.
\]
The field points along the axis in the direction given by the right-hand rule. At the center ($z=0$), this reduces to $B = \mu_0 I/(2R)$. Far from the loop ($z\gg R$), the field falls off as
\[
B \approx \frac{\mu_0 I\,R^2}{2\,z^3} = \frac{\mu_0}{4\pi}\,\frac{2\pi R^2 I}{z^3} = \frac{\mu_0}{4\pi}\,\frac{2\mu}{z^3},
\]
which is the dipole-field form, where $\mu = \pi R^2 I$ is the magnetic dipole moment of the loop.
}

\cor{Far-field (dipole) limit of a current loop}{Far from any compact current loop, the magnetic field has the universal dipole form
\[
\vec{B}_{\text{dipole}}(\vec{r}) = \frac{\mu_0}{4\pi}\left[\frac{3(\vec{\mu}\cdot\hat{r})\hat{r}-\vec{\mu}}{r^3}\right],
\]
where $\vec{\mu} = I\,A\,\hat{n}$ is the magnetic dipole moment ($A$ is the loop area, $\hat{n}$ its normal). This is the analogue of the electric dipole field in electrostatics.}

\cor{Straight wire of finite length}{For a finite straight wire segment of length $L$ carrying current $I$, the field at a point perpendicular to the midpoint of the wire at distance $s$ is
\[
B = \frac{\mu_0 I}{2\pi s}\,\frac{L/2}{\sqrt{s^2+(L/2)^2}}.
\]
In the limit $L\to\infty$, the fraction approaches $1$, recovering the infinite-wire result $B=\mu_0 I/(2\pi s)$.}

\ex{Illustrative example}{A square loop of side $a$ carries current $I$. Each of the four sides contributes equally. From the finite-wire formula with $L=a$ and the perpendicular distance from the midpoint to the center being $s=a/2$:
\[
B_{\text{one side}} = \frac{\mu_0 I}{2\pi(a/2)}\cdot\frac{a/2}{\sqrt{(a/2)^2+(a/2)^2}}
= \frac{\mu_0 I}{\pi a}\cdot\frac{a/2}{a/\sqrt{2}}
= \frac{\mu_0 I}{\pi a}\cdot\frac{\sqrt{2}}{2}.
\]
Four sides contribute in the same direction (perpendicular to the square's plane), so
\[
B_{\text{center}} = 4\cdot\frac{\mu_0 I\sqrt{2}}{2\pi a}
= \frac{2\sqrt{2}\,\mu_0 I}{\pi a}.\]
\qed}

\nt{Key symmetry principles for Biot--Savart calculations:}
\begin{itemize}
\item \textbf{Straight wire segments aimed directly at (or away from) the observation point} contribute \emph{zero} field: when $d\vec{\ell}\parallel\vec{r}$, the cross product $d\vec{\ell}\times\hat{r}=\vec{0}$. This is a very useful shortcut.
\item \textbf{Circular arcs} centered on the observation point contribute field proportional to the arc angle. For an arc of angle $\theta$ (in radians) and radius $R$, $B = (\mu_0 I/4\pi R)\cdot\theta$.
\item \textbf{Perpendicular geometry} maximises the contribution: when $d\vec{\ell}\perp\vec{r}$ at every point (as on a circular arc centered at $P$), the magnitude is $dB = (\mu_0/4\pi)\,I\,d\ell/R^2$ with no angle factor.
\end{itemize}

\qs{Worked example}{A wire bent into the shape shown carries a steady current $I$ in the direction indicated. The wire consists of three segments:
\begin{enumerate}[label=(\roman*)]
\item A straight horizontal segment running from $x=-\infty$ to $x=-R$ along the line $y=0$, approaching the origin.
\item A circular arc of radius $R$ centered at the origin, extending from the point $(R,0)$ counterclockwise through the upper half-plane to the point $(-R,0)$ (a semicircle).
\item A straight horizontal segment running from $x=-R$ along the line $y=0$ to $x=+\infty$, extending to the right.
\end{enumerate}
Find the magnetic field $\vec{B}$ at the origin $O$ (the center of the circular arc).

Assume the wire lies entirely in the $xy$-plane and the current $I$ flows to the right on the incoming straight segment, then counterclockwise along the arc, then to the right on the outgoing straight segment. Use $\mu_0 = 4\pi\times 10^{-7}\,\mathrm{T\cdot m/A}$.}

\textbf{Given quantities:}
\begin{itemize}
\item Current: $I$
\item Arc radius: $R$
\item Arc: semicircle in the upper half-plane ($y\geq 0$), counterclockwise
\item Observation point: origin $O$
\end{itemize}

\sol \textbf{Strategy.} By the superposition principle, $\vec{B}_{\text{total}} = \vec{B}_{\text{straight, incoming}} + \vec{B}_{\text{arc}} + \vec{B}_{\text{straight, outgoing}}$. We evaluate each contribution separately.

\medskip
\noindent\textbf{(i) Incoming straight wire (segment from $x=-\infty$ to $x=-R$, along $y=0$).}

The current flows along the $x$-axis (the line $y=0$) toward the origin. The observation point (the origin) lies \emph{on the line} of the wire. For every current element $d\vec{\ell}$ on this segment, the displacement vector $\vec{r}$ from the element to the origin points along the $+x$ direction, which is \emph{parallel} to $d\vec{\ell}$ (current flows in the $+x$ direction). Therefore
\[
d\vec{\ell}\times\hat{r} = 0
\]
for all elements of this segment, and
\[
\vec{B}_{\text{incoming}} = \vec{0}.
\]
The same reasoning applies to the outgoing wire.

\medskip
\noindent\textbf{(ii) Outgoing straight wire (segment from $x=-R$ to $x=+\infty$, along $y=0$).}

Again, the observation point lies on the line of the wire. The displacement $\vec{r}$ from every current element to the origin is collinear with $d\vec{\ell}$, so $d\vec{\ell}\times\hat{r}=\vec{0}$. Thus
\[
\vec{B}_{\text{outgoing}} = \vec{0}.
\]

\medskip
\noindent\textbf{(iii) Semicircular arc (radius $R$, upper half-plane, counterclockwise).}

For the circular arc, every current element is at distance $R$ from the origin, and every $d\vec{\ell}$ is tangent to the circle. The displacement vector from each element to the origin points radially inward (toward the center). The angle between $d\vec{\ell}$ (tangential) and $\vec{r}$ (radial) is $90^\circ$, so $\sin 90^\circ = 1$ everywhere.

The magnitude of each differential contribution is
\[
dB = \frac{\mu_0}{4\pi}\,\frac{I\,d\ell}{R^2}.
\]
The direction: by the right-hand rule, $d\vec{\ell}\times\hat{r}$ for counterclockwise current on the upper semicircle points in the $+\hat{k}$ direction (out of the page) everywhere along the arc.

The total magnitude is
\[
B_{\text{arc}} = \int_{\text{arc}} \frac{\mu_0 I}{4\pi R^2}\,d\ell
= \frac{\mu_0 I}{4\pi R^2}\int_{\text{arc}} d\ell
= \frac{\mu_0 I}{4\pi R^2}\cdot(\pi R)
= \frac{\mu_0 I}{4 R}.
\]
Here we used that the arc length is $\pi R$ (a semicircle).

In vector form, with $\hat{k}$ pointing out of the $xy$-plane:
\[
\vec{B}_{\text{arc}} = \frac{\mu_0 I}{4 R}\,\hat{k}.
\]

\medskip
\noindent\textbf{(iv) Total field.}

Summing the three contributions:
\[
\vec{B}_{\text{total}} = \vec{0} + \frac{\mu_0 I}{4 R}\,\hat{k} + \vec{0}
= \frac{\mu_0 I}{4 R}\,\hat{k}.
\]

\bigskip
\textbf{Final answer:}
\[
\boxed{\vec{B} = \frac{\mu_0 I}{4 R}\,\hat{k}}
\]
The field points out of the page (perpendicular to the wire plane, in the $+\hat{k}$ direction by the right-hand rule for the counterclockwise arc current).

\bigskip
\textbf{Check.} If the arc were a full loop, we would recover $B = \mu_0 I/(2R)$ (the result from the centre-of-loop formula). Since we have a semicircle (half a loop), the field should be half of that: $B = \mu_0 I/(4R)$. This matches our result, confirming consistency.
