\subsection{Solenoids, Parallel Currents, and Magnetic Dipoles}

This subsection covers three closely related topics: the magnetic field inside a solenoid and a toroid (derived from Amp\`ere's law), the magnetic force per unit length between two parallel current-carrying wires, and the magnetic dipole moment of a current loop. Together these describe how steady currents in geometrically ordered configurations produce well-defined magnetic fields and forces.

\dfn{Ideal solenoid}{An \emph{ideal solenoid} is a long, tightly wound helical coil of wire. When the winding is close and the length $L$ is much greater than the radius $R$, the magnetic field inside is uniform, axial, and of magnitude
\[
B = \mu_0\,n\,I,
\]
where $I$ is the current, $n = N/L$ is the number of turns per unit length ($N$ is the total number of turns, $L$ is the length of the solenoid), and $\mu_0 = 4\pi\times 10^{-7}\,\mathrm{T\!\cdot\!m/A}$ is the permeability of free space. Outside the ideal solenoid the field is approximately zero. The field direction follows the right-hand rule: curl the fingers of your right hand in the direction of the current around the coil, and your thumb points along $\vec{B}$ inside the solenoid.}

\nt{The field inside a solenoid depends only on the turn density $n$ and the current $I$; it is independent of the radius of the coil. This is analogous to the electric field inside a uniformly charged infinite sheet, which depends only on the surface charge density and not on the lateral dimensions.}

\thm{Magnetic field of a long solenoid}{For an ideal solenoid of length $L \gg R$ with $N$ turns carrying current $I$, the magnetic field inside is uniform and directed along the axis. Its magnitude is
\[
B = \mu_0\,n\,I
\qquad\text{where}\qquad
n = \frac{N}{L}.
\]
Outside the solenoid $B \approx 0$. The field lines are straight, parallel lines inside and loop back around outside (forming closed loops).}

\dfn{Toroid}{A \emph{toroid} is a solenoid bent into a circle (a doughnut shape). It consists of $N$ turns wound around a circular core of mean radius $r$. By applying Amp\`ere's law to a circular Amperian loop of radius $r$ inside the toroid, the magnetic field inside the torus is
\[
B = \frac{\mu_0\,N\,I}{2\pi\,r}.
\]
Outside the toroid ($r$ is not within the winding region), $B \approx 0$. The field lines are circles concentric with the toroid axis.}

\nt{The toroid field formula $B = \mu_0 N I/(2\pi r)$ shows a $1/r$ dependence, unlike the uniform solenoid. For a toroid with a large mean radius and small cross-section (so $r$ varies little across the windings), the field is nearly uniform and approximately $B \approx \mu_0 n I$ where $n = N/(2\pi r_{\text{avg}})$.}

\mprop{Solenoid and toroid magnetic fields}{The magnetic field produced by steady currents in these common device geometries is:
\begin{itemize}
\item \textbf{Long solenoid (inside):} $B = \mu_0\,n\,I$, where $n = N/L$ is the turn density. The field is uniform and axial.
\item \textbf{Toroid (inside the windings):} $B = \dfrac{\mu_0\,N\,I}{2\pi\,r}$, where $r$ is the radial distance from the toroid centre. The field circulates along circular field lines and decreases as $1/r$.
\item \textbf{Outside both devices:} $B \approx 0$ (ideal case).
\end{itemize}}

\pf{Solenoid field from Amp\`ere's law (outline)}{Consider an ideal solenoid with $n$ turns per unit length. Choose a rectangular Amperian loop with one long side (length $\ell$) inside the solenoid parallel to the axis, the opposite side outside, and the two short sides perpendicular to the axis. The line integral of $\vec{B}\cdot d\vec{\ell}$ around the loop receives contributions only from the inside segment, because $\vec{B}\approx 0$ outside and $\vec{B}\perp d\vec{\ell}$ on the perpendicular segments. Thus
\[
\oint \vec{B}\cdot d\vec{\ell} = B\,\ell.
\]
The enclosed current is $I_{\text{enc}} = n\,\ell\,I$ (each of the $n\ell$ turns inside the loop carries current $I$). By Amp\`ere's law, $B\,\ell = \mu_0\,n\,\ell\,I$, giving $B = \mu_0 n I$.}

\pf{Toroid field from Amp\`ere's law}{Choose a circular Amperian loop of radius $r$ inside the toroid, concentric with the toroid axis. By symmetry, $\vec{B}$ is tangent to the circle and has constant magnitude $B$ at fixed $r$. The line integral is
\[
\oint \vec{B}\cdot d\vec{\ell} = B\,(2\pi r).
\]
The loop encloses $N$ turns each carrying current $I$, so $I_{\text{enc}} = N I$. Amp\`ere's law gives $B(2\pi r) = \mu_0 N I$, yielding $B = \mu_0 N I/(2\pi r)$.}

\nt{Both derivations rely on Amp\`ere's law $\oint \vec{B}\cdot d\vec{\ell} = \mu_0 I_{\text{enc}}$ and the presence of sufficient symmetry to pull $B$ out of the integral. The solenoid requires the infinite-length approximation; the toroid requires circular symmetry. These are the two magnetostatic configurations in the AP Physics C curriculum where Amp\`ere's law gives a clean result.}

\dfn{Magnetic force between two parallel current-carrying wires}{Two long, straight, parallel wires separated by distance $d$, carrying steady currents $I_1$ and $I_2$, exert magnetic forces on each other. Wire 1 produces a magnetic field $B_1 = \dfrac{\mu_0 I_1}{2\pi d}$ at the location of wire 2. The force per unit length on wire 2 due to wire 1 is
\[
\frac{F_{12}}{L} = \frac{\mu_0\,I_1\,I_2}{2\pi\,d}.
\]
The force is \emph{attractive} when the currents flow in the \emph{same} direction and \emph{repulsive} when they flow in \emph{opposite} directions. By Newton's third law, the force per unit length on wire 1 due to wire 2 has the same magnitude and opposite direction.}

\nt{The rule for attraction and repulsion is the \emph{opposite} of what happens with electric charges. Parallel currents (same direction) \emph{attract}, while like electric charges \emph{repel}. A useful mnemonic: ``like currents attract, unlike repel'' -- but remember this refers to current \emph{directions}, not charge types.}

\thm{Force per unit length between two parallel wires}{Two long straight parallel wires separated by distance $d$ carry currents $I_1$ and $I_2$. The magnitude of the magnetic force per unit length is
\[
\frac{F}{L} = \frac{\mu_0\,I_1\,I_2}{2\pi\,d}.
\]
\begin{itemize}
\item Currents in the \textbf{same direction} $\;\rightarrow\;$ \textbf{attractive} force.
\item Currents in \textbf{opposite directions} $\;\rightarrow\;$ \textbf{repulsive} force.
\end{itemize}
The direction of the force on either wire is perpendicular to the wire and toward (or away from) the other wire, along the line connecting the wires.}

\pf{Force between parallel wires from the Lorentz force}{Wire 1 (carrying $I_1$) produces a magnetic field at the position of wire 2. By the right-hand rule for a long straight wire, $B_1$ circles wire 1 and has magnitude $B_1 = \mu_0 I_1/(2\pi d)$. The field at wire 2 is perpendicular to wire 2. The Lorentz force on a length $L$ of wire 2 is $\vec{F}_{12} = I_2\,\vec{L}\times\vec{B}_1$. Since $\vec{L}\perp\vec{B}_1$, the magnitude is
\[
F_{12} = I_2\,L\,B_1 = I_2\,L\,\frac{\mu_0 I_1}{2\pi d}.
\]
Dividing by $L$ gives $F_{12}/L = \mu_0 I_1 I_2/(2\pi d)$. The direction follows from the cross product: if both currents point upward, $\vec{B}_1$ at wire 2 points into the page, and $\vec{L}_2\times\vec{B}_1$ points toward wire 1 (attractive).}

\thm{Magnetic dipole moment of a current loop}{A planar current loop carrying current $I$ and enclosing area $A$ has a \emph{magnetic dipole moment}
\[
\vec{\mu} = I\,A\,\hat{n},
\]
where $\hat{n}$ is the unit normal to the plane of the loop, determined by the right-hand rule: curl the fingers of your right hand in the direction of the current, and your thumb points along $\hat{n}$. The SI unit of $\mu$ is the ampere-square metre ($\mathrm{A\!\cdot\!m^2}$), equivalent to joule per tesla ($\mathrm{J/T}$). For a coil with $N$ turns, $\vec{\mu} = N I A\,\hat{n}$.}

\nt{The magnetic dipole moment characterises the torque a current loop experiences in a uniform external field: $\vec{\tau} = \vec{\mu}\times\vec{B}$. It is also the quantity that determines the far-field of the loop -- at distances much greater than the loop size, a current loop produces the same magnetic field as a magnetic dipole. This is the quantum-mechanical basis of atomic magnetism (electron orbital and spin angular momenta give rise to magnetic dipole moments).}

\mprop{Magnetic dipole properties}{For a planar current loop (or coil of $N$ turns) with area $A$ and current $I$:
\begin{itemize}
\item \textbf{Dipole moment:} $\mu = N I A$. The direction is given by the right-hand rule.
\item \textbf{Torque in a uniform field:} $\vec{\tau} = \vec{\mu}\times\vec{B}$, with magnitude $\tau = \mu B \sin\theta$, where $\theta$ is the angle between $\vec{\mu}$ and $\vec{B}$.
\item \textbf{Potential energy:} $U = -\vec{\mu}\cdot\vec{B} = -\mu B \cos\theta$. The minimum energy (stable equilibrium) occurs when $\vec{\mu}$ aligns with $\vec{B}$ ($\theta = 0$).
\end{itemize}}

\cor{Rectangular and circular loops}{For a rectangular loop of sides $a$ and $b$, $A = a\,b$. For a circular loop of radius $R$, $A = \pi R^2$. In both cases $\mu = I A$ for a single turn, and the dipole moment points along the axis of symmetry.}

\ex{Illustrative example}{Two parallel wires are separated by $d = 8.0\,\mathrm{cm}$ and carry currents $I_1 = 3.0\,\mathrm{A}$ and $I_2 = 5.0\,\mathrm{A}$ in the same direction. The force per unit length is
\[
\frac{F}{L} = \frac{\mu_0 I_1 I_2}{2\pi d} = \frac{(4\pi\times 10^{-7}\,\mathrm{T\!\cdot\!m/A})(3.0\,\mathrm{A})(5.0\,\mathrm{A})}{2\pi(0.080\,\mathrm{m})} = \frac{6\times 10^{-6}}{0.080}\,\mathrm{N/m} = 7.5\times 10^{-5}\,\mathrm{N/m},
\]
attractive. A circular loop of radius $5.0\,\mathrm{cm}$ carrying $2.0\,\mathrm{A}$ has dipole moment $\mu = I(\pi R^2) = (2.0)(\pi)(0.050)^2 = 1.57\times 10^{-2}\,\mathrm{A\!\cdot\!m^2}$.}

\qs{Worked example}{A solenoid is $40.0\,\mathrm{cm}$ long, has $N = 600$ turns uniformly distributed along its length, and a circular cross-section of diameter $3.0\,\mathrm{cm}$. A steady current $I = 4.0\,\mathrm{A}$ flows through the wire.

Find:
\begin{enumerate}[label=(\alph*)]
\item the turn density $n$ of the solenoid,
\item the magnitude of the magnetic field inside the solenoid,
\item the direction of the magnetic field if the current, viewed from the left end, flows counterclockwise,
\item the magnetic dipole moment of the solenoid, and
\item the torque on the solenoid if it is placed in a uniform external magnetic field $B_{\text{ext}} = 0.15\,\mathrm{T}$ with its axis at $30^\circ$ to the field.
\end{enumerate}}

\sol \textbf{Part (a).} The turn density is the number of turns divided by the length:
\[
n = \frac{N}{L} = \frac{600}{0.400\,\mathrm{m}} = 1500\,\mathrm{turns/m}.
\]

\textbf{Part (b).} The magnetic field inside the solenoid is
\[
B = \mu_0\,n\,I.
\]
Substitute the values:
\[
B = \bigl(4\pi\times 10^{-7}\,\mathrm{T\!\cdot\!m/A}\bigr)\bigl(1500\,\mathrm{m^{-1}}\bigr)\bigl(4.0\,\mathrm{A}\bigr).
\]
Compute step by step:
\[
1500\times 4.0 = 6000,
\]
\[
B = 4\pi\times 10^{-7}\times 6000 = 4\pi\times 6.0\times 10^{-4} = 24\pi\times 10^{-4}\,\mathrm{T}.
\]
Using $\pi \approx 3.1416$:
\[
B = 24\times 3.1416\times 10^{-4}\,\mathrm{T} = 7.54\times 10^{-3}\,\mathrm{T} = 7.54\,\mathrm{mT}.
\]

\textbf{Part (c).} The current, viewed from the left end, flows counterclockwise. By the right-hand rule: curl the fingers of your right hand counterclockwise (as seen from the left), and your thumb points to the right. Thus the magnetic field inside the solenoid points to the \textbf{right} (along the solenoid axis, away from the viewer of the left end).

\textbf{Part (d).} The magnetic dipole moment of a solenoid is $\mu = N I A$, where $A$ is the cross-sectional area of one turn. The radius of the solenoid is
\[
R = \frac{3.0\,\mathrm{cm}}{2} = 1.5\,\mathrm{cm} = 0.015\,\mathrm{m}.
\]
The area is
\[
A = \pi R^2 = \pi (0.015\,\mathrm{m})^2 = \pi \times 2.25\times 10^{-4}\,\mathrm{m^2} = 7.07\times 10^{-4}\,\mathrm{m^2}.
\]
The dipole moment magnitude is
\[
\mu = N I A = (600)(4.0\,\mathrm{A})(7.07\times 10^{-4}\,\mathrm{m^2}).
\]
Compute:
\[
600\times 4.0 = 2400,
\]
\[
\mu = 2400\times 7.07\times 10^{-4}\,\mathrm{A\!\cdot\!m^2} = 1.70\,\mathrm{A\!\cdot\!m^2}.
\]
The direction of $\vec{\mu}$ is along the axis to the right (same as $\vec{B}$ inside).

\textbf{Part (e).} The torque on a magnetic dipole in a uniform field is $\vec{\tau} = \vec{\mu}\times\vec{B}_{\text{ext}}$. Its magnitude is
\[
\tau = \mu\,B_{\text{ext}}\,\sin\theta,
\]
where $\theta = 30^\circ$. Substituting:
\[
\tau = (1.70\,\mathrm{A\!\cdot\!m^2})(0.15\,\mathrm{T})\,\sin 30^\circ.
\]
Since $\sin 30^\circ = 0.5$:
\[
\tau = 1.70\times 0.15\times 0.5 = 0.1275\,\mathrm{N\!\cdot\!m} \approx 0.13\,\mathrm{N\!\cdot\!m}.
\]

\bigskip
\textbf{Final answers:}
\begin{enumerate}[label=(\alph*)]
\item $n = 1500\,\mathrm{turns/m}$
\item $B = 7.54\,\mathrm{mT}$ (or $7.5\times 10^{-3}\,\mathrm{T}$)
\item To the right (along the solenoid axis)
\item $\mu = 1.70\,\mathrm{A\!\cdot\!m^2}$
\item $\tau = 0.13\,\mathrm{N\!\cdot\!m}$
\end{enumerate}
