Consider a particle with a magnetic moment $\vec{m}$. For simplicity, suppose that this particle is a circle in the plane $xy$ which can rotate around its center of mass along the $z$ axis. If this particle is subject to an external magnetic field $\vec{B}$ in the plane $xy$, then its potential energy is:
$$ U = -\vec{m} \cdot \vec{B} = -mB\cos(\theta),$$
where $m = \|\vec{m}\|$, $B = \|\vec{B}\|$, and $\theta$ is the angle between $\vec{m}$ and $\vec{B}$.
Reading around, I found that the exerted torque on the particle is
$$\vec{\tau} = \vec{m} \times \vec{B}.$$
In the planar case I'm working on, $\vec{\tau}$ has only the $z$ component, which is
$$\tau_z = mB\sin(\theta).$$
Anyway, If I want to obtain the torque from the potential energy, I get this:
$$\tau_z = -\frac{\partial U}{\partial \theta} = -\left[-mB(-\sin(\theta)) \right] = -mB\sin(\theta).$$
Where is the truth? Am I wrong with my calculations?
Best Answer
The difference is only how you define $\theta$ and the zero of potential energy.
The $\cos \theta$ expression takes the zero of potential energy to be when $\theta = \frac \pi 2$ whereas you derivation with $\sin \theta$ in it takes the zero of potential to be when $\theta = 0$.