Vector Potential that vanishes outside infinite solenoid Consider the magnetic field $\vec{B}$ generated by an infinite solenoid on the $z$-axis with radius $R$.
Then $$\vec{B}(r)=\begin{cases}
B_z \hat{z} & \text{ if }r<R, \\
0 & \text{ elsewhere.}
\end{cases}$$
I would like to find a continuous vector potential $A$ such that curl$(A)=B$.
In the following I am considering cylindrical coordinates.
I was able to find
$$A(r)=\begin{cases}
\frac{B_z}{2}\left(r-\frac{R^2}{r}\right) \hat{\varphi} & \text{ if }r<R, \\
0 & \text{ elsewhere.}
\end{cases}$$
This is continuous at $r=R$ and
$$\text{curl}(A)
=\frac{1}{r}\frac{\partial}{\partial r}(rA)
= \frac{B_z}{2}\left(1-\frac{R^2}{r^2}\right)+ \frac{B_z}{2}\left(1+\frac{R^2}{r^2}\right)=B_z$$
as desired. My problem is that my professor stated that it wasn‘t possible to find a vector potential that vanishes everywhere outside the solenoid, yet mine does, so why is mine not valid?
His argument was that if we consider $$U=\{\vec{x} \in \mathbb{R}^3 : x_3=0 \wedge x_1^2+x_2^2 < a^2 \}$$ for an arbitrary $a$, i.e. the circle of radius $a$ in the $xy$-plane, and take the line integral of $A$ along its boundary $\partial U$ then it couldn‘t be $0$ because according to Stokes‘ theorem it has to be equal to the magnetic flux through the $xy$-plane (which clearly isn’t zero inside the solenoid).
 A: Your vector potential field $\mathbf A$ obeys the equation
$$
\mathbf B = \nabla \times \mathbf A\tag{*}
$$
everywhere except on the line $r = 0$. It is easy to check validity everywhere except $r=0$. There, one must be careful. It turns out that curl of this vector potential has delta-distribution-like singularity on this line, which magnetic field does not have. This makes the proposed field invalid as "global" solution to the equation (*).
How do we know there is singularity? The definition of curl of a field (rotation of field) is that circulation of the vector field over any oriented closed curve $\gamma$
$$
C = \oint_\gamma \mathbf A \cdot d\mathbf s
$$
can be expressed, in the first approximation, as
$$
 \Delta\boldsymbol{ \Sigma} \cdot \text{curl}~\mathbf A 
$$
where $\Delta \boldsymbol{ \Sigma}$ is surface area vector describing  $\gamma$, assuming the first approximation exists. In other words, curl exists if circulation can be expressed as area times curl.
This is not possible at $r=0$, because circulation over howsoever small loop going around the line is constant $\pi B_zR^2$ and this cannot be expressed as product of something times the small curve area (the something diverges to infinity).
A: Your proposed vector potential diverges at $r = 0$. This may not seem like an insurmountable problem—after all, we see infinite potentials all the time for things like point charges & line currents, right?  It turns out, in fact, that there's an infinite flux hiding in this problem.
Consider a a loop of radius $\epsilon$ about the origin in the $xy$-plane.  The magnetic flux through this surface is equal to the line integral of $\vec{A}$ around this curve, which is:
$$
\Phi = \oint \vec{A} \cdot d\vec{l} = \int_0^{2 \pi} \frac{B_z}{2} \left( \epsilon - \frac{R^2}{\epsilon} \right) \hat{\phi} \cdot  (\epsilon \,d\theta \hat{\phi}) = \pi B_z \left(\epsilon^2 - R^2 \right)
$$
The first term is what we would expect from the infinite solenoid;  but what's that second term doing there?  It's independent of $\epsilon$, which means that the loop is "catching" this flux no matter how small the loop is.  In other words, your proposed vector potential hides an infinitely strong, dense magnetic flux concentrated on the $z$-axis, of magnitude $-\pi B_z R^2$.  You can think of this as the limit of two nested solenoids, with opposing currents and radii $R_i < R_o$, in the limit as $R_i \to 0$.  In terms of delta-functions, the curl of this vector field would be
$$
\vec{B} = - \pi B_z R^2 \delta(x) \delta(y) \hat{z} + \begin{cases} B_z \hat{z} & r < R \\ 0 &r > R \end{cases}.
$$
The reason this doesn't show up when you take the curl using the formulas in the endpapers of Griffiths or Jackson, by the way, is that those formulas are only guaranteed to work for points where the coordinates are not singular.  Roughly speaking, a singular point of a coordinate system is any point where one or more of the basis vectors are not well-defined.  At $r = 0$ in a cylindrical coordinate system, the basis vectors $\hat{r}$ and $\hat{\phi}$ are not well-defined, and so the coordinates are singular there and the usual vector calculus formulas require caution to use.
A: Work in cylindrical coordinates, i.e., $(r,\theta,z)$ and restrict to the cases $A_r=0 \text{ and } A_z=0$;
the only nonzero component will be $A_\theta$.
Let $\mathbf{B}_0\left(=(0,0,B_z^0)\right)$ is a given constant pseudo vector for the region $r\leq R$.
Let us turn our attention to the vector potential expressed in the following equation.
$$
A_{\theta}=
    \left\{
    \begin{alignedat}{2}
        & \frac{1}{2}B_z^0r    &\quad&    \text{for }r\leq R  \\
        & \frac{1}{2}\left(B_z^0R\right)\frac{R}{r}  &     &    \text{for } R<r
    \end{alignedat}
    \right.
$$
This vector potential is continuous at the cylinder boundary $r=R$ and it seems a solution of infinite solenoid. Am I wrong?
