Solution (source code)

= Solution

Let the wire radius be $a$, and take its <electric current> along $+z$. Cylindrical symmetry makes the <magnetic flux density> azimuthal. For a circular <Amperian loop> of radius $r$, <Ampère's law> gives $2\pi rB=\mu_0 I_{\rm enclosed}$. Uniform <current density> means $I_{\rm enclosed}=Ir^2/a^2$ inside and $I$ outside. Consequently
$$
\boxed{\mathbf B(r)=\begin{cases}
\dfrac{\mu_0Ir}{2\pi a^2}\hat{\boldsymbol\phi},&0\le r\le a,\\
\dfrac{\mu_0I}{2\pi r}\hat{\boldsymbol\phi},&r\ge a.
\end{cases}}
$$
Its direction follows the right-hand rule. The magnitude rises linearly from zero to $\mu_0I/(2\pi a)$ at the surface, is continuous there, and then falls as $1/r$.

\Image[/past-exam-of-the-physics-2-paper-of-the-university-of-oxford/2014-wire-field.png]
{title=Magnetic-field magnitude inside and outside a uniformly current-filled wire}
{description=The radius and field are normalized by the wire radius and the surface field, respectively.}