= Solution
The magnetostatic <Ampère's law> is $\oint\mathbf B\cdot d\boldsymbol\ell=\mu_0I_{\rm enc}$, equivalently $\nabla\times\mathbf B=\mu_0\mathbf J$ in vacuum. Let the wire radius be $a$ and take positive <electric current> along its axis. Cylindrical symmetry makes $\mathbf B$ azimuthal and constant in magnitude on a radius-$r$ circular path, so $2\pi rB=\mu_0I_{\rm enc}$.
Uniform <electric current> density gives $J=I/(\pi a^2)$. Inside the wire, $I_{\rm enc}=J\pi r^2=Ir^2/a^2$; outside, the full <electric current> is enclosed. Therefore
$$
\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}}
$$
The direction is set by the right-hand rule around the <electric current>. The magnitude starts at zero on the axis, rises linearly to $\mu_0I/(2\pi a)$ at the surface and then falls as $1/r$. The two expressions are continuous at $r=a$. The long-wire approximation neglects end effects and any high-frequency redistribution of <electric current>.
Back to article page