# Non-uniform magnetic fields and magnetic moment

Hey all, I'm having some issues with electromagnetism here.

Let's say we have a particle with magnetic moment ##\vec{\mu} = \mu_0 \hat{x}## and magnetic field ##\vec{B(x)} = B_0 \frac{x}{a} \hat{x}## where ##\mu_0,B_0,a## are constants.

If we assume that the magnetic field ##B_0## is far, far bigger than the magnetic field produced by the dipole moment itself, we can assume that the potential ##U(x) =- \vec{\mu} \cdot \vec{B(x)}## has a corresponding conservative force field ##\vec{F} =- \nabla U(x) = \nabla ( \vec{\mu}\cdot \vec{B(x)}) = \mu_0 B_0 \frac{1}{a} \hat{x}##...

Which means that this dipole will drift along ##\hat{x} ##! How is this possible? The magnetic force can only be perpendicular to the current from the magnetic moment, it can never point in the same direction as the magnetic field that creates it!

Charles Link and DuckAmuck

## Answers and Replies

Homework Helper
Gold Member
Interesting puzzle that you have. Perhaps the solution to your puzzle is that the magnetic field must have some y and/or z components if it is going to have an x-component that varies, because ## \nabla \cdot B=0 ##. In your function for the magnetic field ## B ##, you have a non-zero ## \nabla \cdot B ##...editing...if you make a magnetic field with a gradient such that the flux lines are coming together in the forward x-direction, the y and z components (of B) that are present do push the magnetic moment in the correct direction.

Last edited:
vanhees71
Gold Member
2021 Award
Hey all, I'm having some issues with electromagnetism here.

Let's say we have a particle with magnetic moment ##\vec{\mu} = \mu_0 \hat{x}## and magnetic field ##\vec{B(x)} = B_0 \frac{x}{a} \hat{x}## where ##\mu_0,B_0,a## are constants.

If we assume that the magnetic field ##B_0## is far, far bigger than the magnetic field produced by the dipole moment itself, we can assume that the potential ##U(x) =- \vec{\mu} \cdot \vec{B(x)}## has a corresponding conservative force field ##\vec{F} =- \nabla U(x) = \nabla ( \vec{\mu}\cdot \vec{B(x)}) = \mu_0 B_0 \frac{1}{a} \hat{x}##...

Which means that this dipole will drift along ##\hat{x} ##! How is this possible? The magnetic force can only be perpendicular to the current from the magnetic moment, it can never point in the same direction as the magnetic field that creates it!
Note that this magnetic field is unphysical, i.e., it doesn't make sense. You must have ##\vec{\nabla} \cdot \vec{B}=0##, which is one of the very fundamental laws of nature (one of Maxwell's equations).

Wminus
Of course, I forgot about that divB must be 0. You guys are totally right.

Thanks!