Finding the vector potential of magnetic field via line integration

If we look at the relationship between the scalar electric potential and electric field in electrostatics, $$\vec{E} = - \vec{\nabla} \phi$$, we can easily invert this relationship by $$V (\vec{r}) = -\int \limits_{\vec{r}_0}^{\vec{r}} \mathrm{d} \vec{\ell} \cdot \vec{E}$$ where $$\vec{r}_0$$ is arbitrary.

This got me thinking; is the same possible for magnetic field $$\vec{B} = \vec{\nabla} \times \vec{A}$$? Can we find $$\vec{A}$$ (in some specific gauge) from $$\vec{B}$$ by inverting this relationship in terms of a line integral (I'm aware of finding $$\vec{A}$$ from current distribution, but that's a volume integral and it involves sources, which I'd like to avoid).

So I made a guess: $$\vec{A} (\vec{r}) \overset{?}{=} \int \limits_{\vec{r}_0}^{\vec{r}} \mathrm{d} \vec{\ell} \times \vec{B}$$

Of course, we need to verify that this is correct (it isn't, but it's only a constant factor), which we can do $$A_j \overset{?}{=} \varepsilon_{jab} \int \limits_{\vec{r}_0}^{\vec{r}} \mathrm{d} \ell_a B_b \quad \to \quad \left( \vec{\nabla} \times \vec{A} \right)_i = \varepsilon_{ikj} \partial_k A_j = \varepsilon_{ikj} \varepsilon_{jab} \partial_k \int \limits_{\vec{r}_0}^{\vec{r}} \mathrm{d} \ell_a B_b$$

I'm not so sure about this, but from what I understand, a derivative acting on a line integral like this will pluck out the index of the line element, $$\mathrm{d} \ell$$, in this case, $$a$$ becomes $$k$$ $$\left( \vec{\nabla} \times \vec{A} \right)_i = \varepsilon_{ikj} \varepsilon_{jkb} B_b = \left( \delta_{ik} \delta_{kb} - \delta_{ib} \delta_{kk} \right) B_b = B_i - 3 B_i = - 2 B_i$$

So the correct formula would seem to be $$\vec{A} (\vec{r}) \overset{\checkmark}{=} - \frac{1}{2} \int \limits_{\vec{r}_0}^{\vec{r}} \mathrm{d} \vec{\ell} \times \vec{B}$$

I verified that this should be the case on a simple magnetic field $$\vec{B} = B_0 \hat{z}$$ and for path that is a straight line between $$\vec{r}_0 = \vec{0}$$ and $$\vec{r}$$. In that case $$\mathrm{d} \vec{\ell} = \hat{r} \mathrm{d} \ell$$. We also need $$\hat{r} \times \hat{z} = - \hat{\varphi}$$ and the integral becomes $$\vec{A} (\vec{r}) = \frac{1}{2} B_0 \hat{\varphi} \int \limits_0^r \mathrm{d} \ell = \frac{1}{2} B_0 r \hat{\varphi} = \frac{1}{2} B_0 \left( -y, x, 0 \right)$$

Taking a curl of this gives the original magnetic field.

An alternative way is to plug in $$\vec{B} = \vec{\nabla} \times \vec{A}$$ under the integral $$\mathrm{d} \vec{\ell} \times \vec{B} = \mathrm{d} \vec{\ell} \times \left( \vec{\nabla} \times \vec{A} \right) = \vec{\nabla} \left( \mathrm{d} \vec{\ell} \cdot \vec{A} \right) - \left( \mathrm{d} \vec{\ell} \cdot \vec{\nabla} \right) \vec{A}$$

The problem is I am not sure what to do with the first term $$\vec{\nabla} \left( \mathrm{d} \vec{\ell} \cdot \vec{A} \right)$$, it doesn't seem to simplify to anything reasonable, whereas the second term $$\left( \mathrm{d} \vec{\ell} \cdot \vec{\nabla} \right) \vec{A}$$, when integrated, yields $$\vec{A} (\vec{r}) - \vec{A} (\vec{r}_0)$$. If my thoughts are correct though, the term $$\mathrm{d} \ell_j \partial_i A_j$$ should be equal to $$- \mathrm{d} \ell_j \partial_j A_i$$, i.e. the combination $$\partial_i A_j + \partial_j A_i$$ should be zero. I feel like this is rather a gauge choice than something that should always hold (although, it brings 6 equations, which seems like a lot for a gauge).

Can someone point me to the right direction? Is my formula correct? What about the $$\partial_i A_j + \partial_j A_i = 0$$?

• You can use Helmholtz decomposition to find a vector field provided you know boundary values (gives you the integration 'constants'), its curl (magnetic field in your case) and divergence (e.g. zero for Coulomb gauge).
– Cryo
Jun 2, 2021 at 15:58
• @Cryo as you can see in the link you provided, the integrals are volume integrals, i.e. they're inverting the Laplace's equation (thus all the factors of 1/|r-r'|). My expressions are just line integrals, a very different mathematical object. Jun 2, 2021 at 17:50

The answer is found in this Wikipedia article: https://en.wikipedia.org/wiki/Gauge_fixing#Multipolar_gauge

In specific, the relationship between the electric field and potential can be reversed as $$\varphi (\vec{r}, t) = - \vec{r} \cdot \int \limits_0^1 \vec{E} (u \vec{r}, t) \mathrm{d} u$$ and the relationship between the magnetic field and vector potential can be reversed, too $$\vec{A} (\vec{r}, t) = - \vec{r} \times \int \limits_0^1 \vec{B} (u \vec{r}, t) \, u \, \mathrm{d} u$$

To see how this works, we take the first equation and apply $$\partial_i$$ to it. We get $$\partial_i \varphi (\vec{r}, t) = - \partial_i \left[ x_j \cdot \int \limits_0^1 E_j (u \vec{r}, t) \, \mathrm{d} u \right] = - \int \limits_0^1 \left[ E_i (u \vec{r}, t) + u \, x_j \, E^\prime_{j,i} (u \vec{r}, t) \, \right] \mathrm{d} u$$

Here the chain rule when derivative is applied to $$\vec{E}$$ affects all spatial components the same way, since $$u$$ appears in all of them, which gives us a factor of $$u$$ in the second term. Now we recognize the total $$u$$ derivative $$E_i (u \vec{r}, t) + u \, x_j E^\prime_{j,i} (u \vec{r}, t) = \frac{\mathrm{d}}{\mathrm{d} u} \left[ u \, E_i (u \vec{r}, t) \right]$$ so, since the total derivative appears under the integral, this gives us $$\partial_i \varphi = - \left[ u \, E_i (u \vec{r}, t) \right]_{u = 0}^1 = - E_i (\vec{r}, t)$$

It works very similarly for $$\vec{B}$$ and $$\vec{A}$$. Let's apply curl to the equation for $$\vec{A}$$ (note: $$\vec{\nabla}$$ acts on everything to the right of it) $$\vec{\nabla} \times \vec{A} (\vec{r}, t) = - \vec{\nabla} \times \left[ \vec{r} \times \int \limits_0^1 \vec{B} (u \vec{r}, t) \, u \, \mathrm{d} u \right] = - \int \limits_0^1 \left[ \left( \vec{\nabla} \cdot \vec{B} (u \vec{r}, t) \right) \vec{r} - \left( \vec{\nabla} \cdot \vec{r} \right) \vec{B} \right] u \, \mathrm{d} u$$

Using $$\vec{\nabla} \cdot \vec{B} = 0$$ and index notation, we get $$\left( \vec{\nabla} \times \vec{A} (\vec{r}, t) \right)_i = - \int \limits_0^1 \left( B_j (u \vec{r}, t) \partial_j x_i - B_i (u \vec{r}, t) \partial_j x_j - x_j \partial_j B_i (u \vec{r}, t) \right) u \, \mathrm{d} u = \\ - \int \limits_0^1 \left( B_j (u \vec{r}, t) \, \delta_{ij} - 3 B_i (u \vec{r}, t) - u \, x_j B^\prime_{i, j} (u \vec{r}, t) \right) u \, \mathrm{d} u = \\ \int \limits_0^1 \left( 2 u \, B_i (u \vec{r}, t) + u^2 \, x_j B^\prime_{i, j} (u \vec{r}, t) \right) \, \mathrm{d} u$$

Again, we recognize a total $$u$$ derivative $$2 u \, B_i (u \vec{r}, t) + u^2 \, x_j B^\prime_{i, j} (u \vec{r}, t) = \frac{\mathrm{d}}{\mathrm{d} u} \left[ u^2 B_i (u \vec{r}, t) \right]$$ and so the integral yields $$\left( \vec{\nabla} \times \vec{A} (\vec{r}, t) \right)_i = \left[ u^2 B_i (u \vec{r}, t) \right]_{u = 0}^1 = B_i (\vec{r}, t)$$

The Wikipedia article also answers my question about the gauge: this works in a particular gauge in which $$\vec{r} \cdot \vec{A} = 0$$, which is trivial to see (dot product combined with a cross product). This is called "Poincaré gauge". You learn something new every day :)

Firstly, you do not invert $$\mathbf{E}=-\boldsymbol{\nabla}V$$ the way you wrote it since:

$$\int_{\mathbf{r}_0}^{\mathbf{r}}\boldsymbol{\nabla}'V\left(\mathbf{r}'\right).d\mathbf{r}'=V\left(\mathbf{r}\right)-V\left(\mathbf{r}_0\right)$$

i.e. you only get back the potential difference between two points, not the actual value of the potential.

Secondly, this is in fact a special case of the Generalized Stokes Theorem.

$$\int_\Omega d\omega = \oint_{\partial\Omega}\omega$$

Where $$\omega$$ is a $$k$$-form and $$\Omega$$ is a $$k+1$$-chain. $$d$$ here is the exterior derivative.

I will now proceed to briefly explain how gradient and curl cases map onto the above expression.

In case of gradient: In this case $$V\to \omega$$ is a 0-form, a scalar, whilst $$\Omega$$ the curve from $$\mathbf{r}_0$$ to $$\mathbf{r}$$ is a 1-chain - essentially a set of straight-line segments that together make up the curve. $$\partial \Omega$$ is the boundary to the chain $$\Omega$$, and is itself a $$k$$-chain. Here it is simply two points.

In case of curl: $$\mathbf{A}\to \omega$$ is a 1-form (see musical isomorphisms to understand how vectors map to 1-forms). $$\Omega$$ is then a 2-chain, a set of, essentially, triangles, that mesh the two-dimensional space. Essentially it encodes normal Stokes theorem.

So a proper generalization of your starting expression with scalar potential to the case of curl, is actually Stokes theorem.

Thirdly, consider vector fields:

\begin{align} \mathbf{A}_1 &= -\mathbf{\hat{x}} \,y \\ \boldsymbol{\nabla}\times\mathbf{A}_1 &= \mathbf{\hat{z}} \\ \boldsymbol{\nabla}.\mathbf{A}_1 &= 0 \\ \mathbf{A}_2 &= \mathbf{\hat{y}} \,x \\ \boldsymbol{\nabla}\times\mathbf{A}_2 &= \mathbf{\hat{z}} \\ \boldsymbol{\nabla}.\mathbf{A}_2 &= 0 \end{align}

Both vector fields have identical curls and satisfy Coulomb gauge, how can your procedure distinguish them? I think it cannot. This is sufficient to show that your approach does not generalize

• As for the first point: I don't think the potential difference matters as long as we keep the point r0 constant. The constant shift in the potential doesn't have any effects on the fields. If you find this problematic, then note, that V = 1/(4 pi r) and V = 42 + 1/(4 pi r) will give you the same E field. There is some inherent ambiguity present. For your second and third point, I found this en.wikipedia.org/wiki/Gauge_fixing#Multipolar_gauge so an analogous formula for A from B certainly exists (see the link). Jun 3, 2021 at 2:09
• With your third point, the fact you're describing, that several A will give the same B, is known as "gauge freedom" (for that also see the link above). This is not a bug, it's just a feature of the description - every time something involves derivatives, there will be some ambiguity. Consider the link you've sent under my question (on Helmholtz decomposition): wouldn't your third point apply there, too? Gauge freedom exists no matter what approach you take to calculate A. In case of Helmholtz decomposition, A is fixed by Coulomb gauge, in the line integral formula A is fixed by Poincare gauge. Jun 3, 2021 at 2:11
• @user16320, you start with field, then you constrain your potential until it has just enough freedom to accommodate the information you have about your field, then you find the constrained potential. That's a fair thing to do, but don't call it inversion :-)
– Cryo
Jun 3, 2021 at 7:44
• @user16320, also note that even complete knowledge of magnetic field along a curve may be insufficient to predict some physical phenomena. In Aharonov-Bohm effect magnetic field is identically zero around a closed curve, and can be zero even in the neighbourhood of that curve, but there is a physical measurement you can make to make statements about non-zero vector potential
– Cryo
Jun 3, 2021 at 8:01