In the above slide, it reads that $W=\int\mu B sin(\theta)d\theta=\mu B cos(\theta)$.
But, I thought that $\int\mu B sin(\theta)d\theta=-\mu B cos(\theta)$ by some calculus calculation.
Can somebody explain more explicitly, please?
In the above slide, it reads that $W=\int\mu B sin(\theta)d\theta=\mu B cos(\theta)$.
But, I thought that $\int\mu B sin(\theta)d\theta=-\mu B cos(\theta)$ by some calculus calculation.
Can somebody explain more explicitly, please?
This is an issue of not specifying the initial and final states (or whether we are calculating the work done by the magnetic torque, or the work required by an external torque to oppose the magnetic torque). In reality, what we should say is that if we start with a magnetic dipole $\vec{\mu}$ that is aligned with the magnetic field (so that $\theta=0$), WE must do work to rotate the dipole to a new angle $\theta$, by applying the torque opposite to the magnetic torque.
Let's look at the fact that zero potential energy is defined as when $\theta=\pi/2$. Then we can look at the work done by the magnetic field as it rotates from $\theta$ to $\pi/2$: $$W=\int\tau\,d\theta=\int_{\theta}^{\pi/2}\mu B\sin\theta'\,d\theta'=-\left.\mu B\cos\theta'\right|_{\theta}^{\pi/2}=\mu B\cos\theta$$ So that's where the negative sign went.
First, we define the direction of $\vec{\theta}$ between $\vec{\mu}$ and $\vec{B}$ to be positive if $\vec{\theta}$ is coming out of the screen in the sense that $\theta$ is increasing with the right-hand-rule in the counter-clockwise direction.
Then, note that the torque $\vec{\tau}=\vec{\mu}\times\vec{B}$ makes the angle between $\vec{\mu}$ and $\vec{B}$ decrease in order to line $\vec{\mu}$ with $\vec{B}$. (Note that we are defining the angle $\theta$ between $\vec{\mu}$ and $\vec{B}$ to be the acute angle between them which results in $0\leq\theta\leq \pi/2$.) Therefore, the direction of the torque $\vec{\tau}$ on the dipole is Negative, in the sense that the direction of the torque vector $\vec{\tau}$ is the opposite direction to the angle vector $\vec{\theta}$.
Then, we choose $\theta_0=\pi/2$ to be the initial angle of the work done by the magnetic field on the dipole, in order to define $U=0$ at $\theta_0=\pi/2$.
Then, we have the work done by the magnetic field on the dipole as follows: $W=\int_{\theta_0}^{\theta}\vec{\tau}\cdot d\vec{\theta}=\int_{\pi/2}^{\theta}\vec{\tau}\cdot d\vec{\theta}=\int_{\pi/2}^{\theta}(-\tau d\theta)=\int_{\theta}^{\pi/2}\tau d\theta=\int_{\theta}^{\pi/2}\mu B\sin(\theta) d\theta=-\mu B\cos (\theta)|_{\theta}^{\pi/2}=\mu B\cos(\theta)=\vec{\mu}\cdot\vec{B}$.
Then, we have the potential energy function by the magnetic field on the dipole $U_{\mbox{magnetic field}}=-W=-\vec{\mu}\cdot\vec{B}$, in the sense that the function $U$ is defined to be zero at the initial angle $\theta_0=\pi/2$ which is the angle when the magnitude of the torque $|\vec{\tau}|=|\vec{\mu}\times\vec{B}|=\mu B \sin (\theta)$ is maximum as requried in the slide.