# Magnetic vector potential within an infinite wire

I was trying to calculate the magnetic vector potential created by a wire (radius $R$) with uniform $\mathbf J$. By taking $\mathbf A=A(s) \mathbf{\hat z}$, I found out that $$\mathbf A=-\frac{\mu_0I}{2\pi}\ln{s\over a}\mathbf{\hat z}$$ ($s$ is the distance from the wire and $a$ is an arbitrary constant) works for $s\ge R$. I know I can do the same thing for $s\le R$ but I tried a different method. I thought in this case the potential will be the same as that produced by the middle part of the wire with radius $s$ since the part beyond $s$ produces no magnetic field at that point. The total current will then be $\frac{Is^2}{R^2}$. Putting this in the formula above gives $$\mathbf A=-\frac{\mu_0Is^2}{2\pi R^2}\ln{s\over a}\mathbf{\hat z},$$ which doesn't give the right magnetic field. Why would this not work?

Your mistake is in assuming that the formula you derived for outside the wire can be applied inside the wire, with a simple substitution for the enclosed current. It can't, because what matters for the vector potential is the enclosed magnetic flux, not the enclosed current.

$$\oint \vec{A}\cdot d\vec{l} = \int \vec{B}\cdot d\vec{S} = \Phi_{\rm enclosed}$$

Inside the wire, the B-field grows linearly with radius $s$ so the enclosed magnetic flux on the RHS grows as $s^3$. Meanwhile, the line integral of $\vec{A}$ on the LHS is just $2\pi s A$.

Thus you expect $A \propto s^2$.