TITLE: Interaction between magnetic moments and magnetic field
QUESTION [2 upvotes]: 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?

REPLY [0 votes]: Maybe, I found the solution. let's denote with $\theta_k$ the rotation around $k$-axis. Suppose that both $\vec{m}$ and $\vec{B}$ belongs to $xy$ plane. That is:
$$\vec{m} = \begin{pmatrix}
m \cos(\theta_z)\\
m \sin(\theta_z)\\
0
\end{pmatrix} ~\text{and} ~\vec{B} = \begin{pmatrix}
B \\
0\\
0
\end{pmatrix}.$$
The torque using the formula $\vec{\tau} = \vec{m} \times \vec{H}$ is:
$$
\vec{\tau} = \det\begin{pmatrix}
\vec{x} & \vec{y} & \vec{z} \\
m \cos(\theta_z) & m \sin(\theta_z) & 0\\
B & 0 & 0
\end{pmatrix} = 
\begin{pmatrix}
0 \\
0\\
-mB \sin(\theta_z)
\end{pmatrix}.$$
On the other hand, if I evaluate the torque using the potential $U = -\vec{m} \cdot \vec{B} = -mB \cos(\theta_z)$, I get:
$$\vec{\tau} = -\nabla U = -\begin{pmatrix}
\displaystyle\frac{\partial U}{\partial \theta_x} \\
\displaystyle\frac{\partial U}{\partial \theta_y}\\
\displaystyle\frac{\partial U}{\partial \theta_z}
\end{pmatrix} = 
\begin{pmatrix}
0 \\
0\\
-mB \sin(\theta)
\end{pmatrix}.$$
At the end of the story, $-mB \sin(\theta)$ is just the $z$  component of the torque.
{"set_name": "stack_exchange", "score": 2, "question_id": 248200}