I have an equation $\nabla \times \vec{B} = \mu_{0}\vec{J}$, where $\vec{J} = \left\langle f(x,y), g(x,y), 0 \right\rangle$ and need to solve for $\vec{B}$.

I've looked elsewhere on here for how to "undo" the curl operator, but every answer I've found has been very theoretical and abstract, and I was hoping to get a more concrete explanation for this particular problem.

Breaking down the curl of $\vec{B}$ into components and partial derivatives, I got:

$$\frac{\partial B_{2}}{\partial x} - \frac{\partial B_{1}}{\partial y} = 0$$$$\frac{\partial B_{3}}{\partial y} - \frac{\partial B_{2}}{\partial z} = \mu_{0} f(x, y)$$$$\frac{\partial B_{1}}{\partial z} - \frac{\partial B_{3}}{\partial x} = \mu_{0} g(x, y)$$

And from here I'm stuck. Other examples with explicit functions have used guesswork to figure out the components, but I'm having trouble with the arbitrary functions of $f(x,y)$ and $g(x,y)$.

  • $\begingroup$ From equation $1$, you know that $B_{2x}=B_{2y}$ . $\endgroup$ Commented Aug 31, 2014 at 21:22
  • $\begingroup$ Do you want the magnetic field on the same domain for which the current is defined, or only in a region exterior to the current density? $\endgroup$
    – Muphrid
    Commented Aug 31, 2014 at 22:14
  • $\begingroup$ math.stackexchange.com/questions/81405/anti-curl-operator $\endgroup$
    – Will Jagy
    Commented Aug 31, 2014 at 22:39

2 Answers 2


As John Hughes already mentioned, we require $\nabla \cdot \vec J=0$. Under that restriction, we proceed.

Since the curl of the gradient is zero ($\nabla \times \nabla \Phi=0$), then if

$$\nabla \times \vec B =\mu_0 \vec J$$

for the magnetic field $\vec B$, then we also have

$$\nabla \times (\vec B+\nabla \Phi) =\mu_0 \vec J$$

for any (smooth) scalar field $\Phi$. This means that there is not a unique solution to the problem since $\vec B +\nabla \Phi$ is also a solution for any (smooth) $\Phi$.

However, if we also specify the divergence of the magnetic field (we know that it is zero), then we can pursue a unique solution. For example,

$$\nabla \times \nabla \times \vec B =-\mu_0 \nabla \times \vec J$$

whereupon using the vector identity $\nabla \times \nabla \times \vec B= \nabla ( \nabla \cdot \vec B)-\nabla^2 \vec B$ and exploiting $\nabla \cdot \vec B=0$ gives

$$\nabla^2 \vec B=-\mu_0 \nabla \times \vec J$$

which has solution

$$\vec B(\vec r)=\mu_0 \int_V \frac{\nabla' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'$$

where the volume integral extends over all space where $\vec J=\ne 0$. We can integrate by parts in three dimensions by using the vector product rule identity $\nabla \times (\Phi \vec A) = \Phi \nabla \times \vec A+\nabla \Phi \times \vec A$ to write

$$\begin{align} \vec B(\vec r)&=\mu_0 \int_V \frac{\nabla' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'\\\\ &=\mu_0 \int_V \left(\nabla' \times \left(\frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}\right) -\nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') \right)dV'\\\\ &=\mu_0 \oint_S \frac{\hat n' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dS'- \mu_0 \int_V \nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV' \end{align}$$

Now, we may extend the integration region to all of space. Then, if $\vec J=0$ outside a finite region, then the surface integral vanishes and we have

$$\begin{align} \vec B(\vec r)&= -\mu_0 \int_V \nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV'\\\\ &=\mu_0 \int_V \nabla \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV'\\\\ &=\nabla \times \left( \mu_0 \int_V \frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV' \right) \end{align}$$

where the first equality is effectively the Biot-Savart law and the last equality reveals that $\vec B =\nabla \times \vec A$ for the vector potential

$$\vec A(\vec r) = \mu_0 \int_V \frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'$$

  • $\begingroup$ I have since forgotten the context of the question and haven't taken a math class in a while but I will believe your answer! $\endgroup$
    – jackarms
    Commented Aug 23, 2017 at 21:44
  • $\begingroup$ @jackarms Much appreciated Jack! $\endgroup$
    – Mark Viola
    Commented Aug 23, 2017 at 22:53
  • $\begingroup$ How come at $r=r'$, the fraction does not jump into infinity? $\endgroup$
    – ar2015
    Commented Jan 25, 2018 at 6:03
  • $\begingroup$ @ar2015 The volume integral converges. $\endgroup$
    – Mark Viola
    Commented Jan 25, 2018 at 13:52
  • 1
    $\begingroup$ Yes, $J$ is smooth and has compact support. These are sufficient conditions that can be relaxed. $\endgroup$
    – Mark Viola
    Commented Oct 15, 2021 at 15:49

It can't be solved in general. The divergence of the curl of a vector field is always zero; that means that $$ \frac{\partial}{\partial x} \mu_0 f(x, y) + \frac{\partial}{\partial y} \mu_0 g(x, y) = 0 $$ Even assuming that $\mu_0$ is a constant, that equality simply is not true for all functions. For instance, for $f(x, y) = x$ and $g(x, y) = 0$, it's false.

  • 1
    $\begingroup$ Couldn't one specify a general pre-potential to make the relation above a little tighter? I don't know the answer, just looking for completeness. $\endgroup$
    – Autolatry
    Commented May 6, 2015 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .