# Energy of dipole orientation

The energy of a magnetic dipole in an external magnetic field is
$$U = - \mathbf{m} \cdot \mathbf{B}$$

Yet if I try to show this by calculating the energy in the fields, I get the wrong answer. I believe the problem is that I am making some arguements which neglect strange behavior at r=0, and thus am neglecting a factor.

The math is short, so let me just write it out:

magnetic field of a dipole
$$\mathbf{B}(\mathbf{r}) = \frac {\mu_0} {4\pi r^3} \left(3(\mathbf{m}\cdot\hat{\mathbf{r}})\hat{\mathbf{r}}-\mathbf{m}\right) + \frac{2\mu_0}{3}\mathbf{m}\delta^3(\mathbf{r})$$

energy in a magnetic field
$$U = \frac{1}{2} \int d^3 r \ \frac{1}{\mu_0}B^2$$

So, for a magnetic dipole in a constant external field B_0, we have:
$$U = \frac{1}{2} \int d^3 r \ \frac{1}{\mu_0}(\mathbf{B}_0 + \mathbf{B}_{dipole})^2$$
$$U = \frac{1}{2 \mu_0} \left[ \int d^3 r \ B_0^2 + \int d^3 r \ B_{dipole}^2 + \int d^3 r \ 2 \mathbf{B}_0 \cdot \mathbf{B}_{dipole} \right]$$

The first two terms are independent of the orientations, and thus are just constants that can be ignored when calculating the energy dependence on the dipole's orientation with respect to the external field. So continuing...

$$U = \frac{1}{\mu_0} \int d^3 r \ \mathbf{B}_0 \cdot \left( \frac {\mu_0} {4\pi r^3} \left(3(\mathbf{m}\cdot\hat{\mathbf{r}})\hat{\mathbf{r}}-\mathbf{m}\right) + \frac{2\mu_0}{3}\mathbf{m}\delta^3(\mathbf{r}) \right)$$

$$U = \frac{2}{3} \mathbf{m} \cdot \mathbf{B}_0 + 4 \pi \int d^3 r \ \frac {1} {r^3} \left( 3(\mathbf{m}\cdot\hat{\mathbf{r}})(\mathbf{B}_0 \cdot \hat{\mathbf{r}})-\mathbf{B}_0 \cdot \mathbf{m} \right)$$

Now, chosing spherical coordinates with the "z" axis parallel to B_0 (I'll be using the physics notation where theta is the angle from z and phi is the angle in the x-y plane from the x-axis), we see
$$(\mathbf{m}\cdot\hat{\mathbf{r}})(\mathbf{B}_0 \cdot \hat{\mathbf{r}}) = (m_x \cos \phi \sin \theta + m_y \sin \phi \sin \theta + m_z \cos \theta) B_0 \cos \theta$$

Doing the integral over $$d\phi$$ will kill the m_x and m_y terms. So we have

$$U = \mathbf{m} \cdot \mathbf{B}_0 \left[ \frac{2}{3} + 4 \pi \int d^3 r \ \frac {3\cos^2 \theta - 1} {r^3} \right]$$

However, since
$$\int_0^{\pi} (3\cos^2 \theta - 1) \sin \theta d\theta=0$$
this means:

$$U = \frac{2}{3} \mathbf{m} \cdot \mathbf{B}_0$$

which is wrong.

My arguements for showing that each "shell" at r doesn't contribute (doing the d\theta and d\phi integral yield zero) look correct to me, except at r=0.

At r=0, theta and phi aren't even valid coordinates. And since I know the answer is wrong, it seems to suggest to me that the integrand is some kind of delta function (since it seems to contribute zero for all r accept at r=0 where is must be infinite such that the integral is a constant).

But how do I go about calculating that contribution at r=0?

Last edited:

check the integral again

...................
However, since
$$\int_0^{\pi} (\cos^2 \theta - 1) \sin \theta d\theta=0$$
.................

The integrand is continuous and strictly negative, except at 3 points, on the interval of integration. You don't get 0 for the integral. I don't know if you made other errors.

The integrand is continuous and strictly negative, except at 3 points, on the interval of integration. You don't get 0 for the integral. I don't know if you made other errors.
Oops, I made a typo in the tex when copying down my work. Check above, I have fixed it now (I had to ctrl+refresh to get it to show the change on my browser though). It should be:

$$\int_0^{\pi} (3 \cos^2 \theta - 1) \sin \theta d \theta$$

which is indeed zero.

Sorry about the typo. As I said above, I believe my calculations are correct except for r=0. I don't know how to correctly handle the r=0 point mathematically, so any help would be appreciated. Thanks.

Last edited:
at first glance

It seems you are calculating total field energy rather than just potential energy if dipole interaction. This (seemingly) makes a difference. I have only seem it verified be cacluating Del X A = -B. No promises but, maybe you gotta recheck the whole scheme.
Hope I helped
More later.....

It seems you are calculating total field energy rather than just potential energy if dipole interaction. This (seemingly) makes a difference. I have only seem it verified be cacluating Del X A = -B.
I'm sorry, but your comment doesn't make any sense to me. "calculating" $$\nabla \times A$$? That is by definition B (not -B). Since it is a definition, and furthermore a definition for a quantity not necessary for calculating the energy of the system, I'm not sure what you are suggesting to actually calculate here.

I'm sorry if I am misunderstanding. Can you please elaborate?

The point is that the energy of the system should be the same (up to a constant) no matter what method I use to calculate it. The two methods being compared here are $$U = \int \mathbf{F} \cdot \mathbf{dx}$$ and $$U=\frac{1}{2}\int (\epsilon_0 E^2 + \frac{1}{\mu_0}B^2)d^3r$$. All the forces / interactions between objects in this thought problem are electromagnetic, so the two answers should be the same -- they are not. So there is a problem here and I need help figuring it out.

Can anyone else see what is causing the mismatch?

Last edited:
Ya I got the sign wrong (there is usually a - with the electrostatic potential). I was thinking vector potential rather than potential energy. Do you know that this stuff is in Jackson's electrodynamics? The coefficient of the delta function seems inconsistent with yours, but I don't think this solves the problem with your scheme.

Do you know that this stuff is in Jackson's electrodynamics?
I don't have a copy of Jackson. If he does work out this problem in the book, can you please tell me the essence of the solution here? I'm willing to work through the algebra/calc myself, but I need a push in the right direction as I can't see what is wrong.

gammamcc said:
The coefficient of the delta function seems inconsistent with yours, but I don't think this solves the problem with your scheme.
No, that coefficient should be correct. I even rederived it to check. Maybe you're thinking of the coefficient in front of the delta function for an electric dipole (that is different, it is -1/3). But, as you mentioned, unless there is some reason that coefficient should be -1, it doesn't solve the problem here.

The delta function discrepancy may be because of the edition that I have (old) of the good old JD's. I checked another text and that matches yours.

OK, what I am getting is as follows:

First, the potential energy measured by -m \dot B is the negative of the work required to rotate the dipole in the magnetic field B: That is, the energy of configuration depending only on orientation.

Moreover, the two integrals of energy you wrote depend on different limits of integration and are not easy to relate.
The integral F\dot dx is a path integral and the other is a volume integral.
You seem to be looking for the energy of configuration and not the work done on a test charge (as is integral of F \dot dx).
And, there is no integral theorem directly used here to relate the limits (boundary) of integration.

More: There is another problem. It seems that we are assuming that the uniform B field is infinite. So, an infinite volume integral of the energy density of the uniform field squared would be infinite. Indeed, the whole integral in question diverges. However, applications of the Poynting's theorem of energy seem to be used only locally (in finite volumes).

If not infinite, then what volume does one chose in this configuration? The volume does effect that integral you are retaining ( the one with B_0\dot B_{dipole}).

So, I am beginning to believe that there is a discrepancy in your scheme.

Only trying to help: If I didn't think it interesting I would even reply.
Maybe this could go to another forum as a physics Q. (I would like to know how it turns out.)

This is actually quite an interesting problem. Remember that in the derivation of the energy of a magnetic field we get
$$U = \frac{1}{2 \mu_0} \left(\int_{V} d^3 r \ B^2-\int_{\partial V} (\mathbf{A} \times \mathbf{B}) \cdot d\mathbf{a}\right)$$
over a volume V enclosing all the charge (with boundary $$\partial V$$). Now we can always extend this out to infinity, and if our currents are finite the last term vanishes. However if we have a constant magnetic field this is not the case, so we have to include this term. But I find that it still doesn't give me the right answer.

Now our constant magnetic field B_0 can be given the vector potential
$$\mathbf{A}_0 = \frac{1}{2} \mathbf{B}_0 \times \mathbf{r}$$
and the dipole has potential
$$\mathbf{A}_{\text{dipole}} = \frac{\mu_0}{4 \pi} \frac{\mathbf{m} \times \mathbf{\hat{r}}}{r^2}$$
Putting these together I get
$$(\mathbf{A}_0 \times \mathbf{B}_{\text{dipole}})\cdot \mathbf{\hat{r}} = \frac{1}{2}\frac{\mu_0}{4 \pi r^2}((\mathbf{m}\cdot\mathbf{\hat{r}})(\mathbf{B}_0\cdot\mathbf{\hat{r}}) - (\mathbf{B}_0 \cdot \mathbf{m}))$$
$$(\mathbf{A}_{\text{dipole}} \times \mathbf{B}_0)\cdot \mathbf{\hat{r}}=-2 (\mathbf{A}_0 \times \mathbf{B}_{\text{dipole}})\cdot \mathbf{\hat{r}}.$$
Now noticing the integral over a spherical shell:
$$\int d \Omega (\mathbf{m}\cdot\mathbf{\hat{r}})(\mathbf{B}_0\cdot\mathbf{\hat{r}}) = \frac{4 \pi}{3} (\mathbf{B}_0 \cdot \mathbf{m})$$
it follows directly that the integral of the surface component over a spherical shell radius R is
$$\int (\mathbf{A}_0 \times \mathbf{B}_{\text{dipole}} + \mathbf{A}_0 \times \mathbf{B}_{\text{dipole}}) = \frac{1}{2}\frac{\mu_0}{4 \pi R^2} R^2(4 \pi - \frac{4 \pi}{3}) (\mathbf{B}_0 \cdot \mathbf{m})$$
$$= \frac{\mu_0}{3} (\mathbf{B}_0 \cdot \mathbf{m})$$
And here is my problem: this term doesn't correct it; it gives
$$U=\frac{2}{3} (\mathbf{B}_0 \cdot \mathbf{m}) - \frac{1}{6} (\mathbf{B}_0 \cdot \mathbf{m})$$
$$U = \frac{1}{2} (\mathbf{B}_0 \cdot \mathbf{m})$$

So either I dropped some factors in my calculation or there is something else wrong with using this formula in this situation.

Last edited: