Concept:
The potential energy ($ U $) of a magnetic dipole (current loop) in a uniform magnetic field $ B $ is given by the scalar product:
$$ U = -\vec{M} \cdot \vec{B} = -MB \cos \theta $$
where $ M $ is the magnetic moment and $ \theta $ is the angle between the magnetic moment and the magnetic field.
Step 1: Calculating Initial Potential Energy.
Initially, the angle $ \theta_1 = 0^\circ $.
$$ U_{\text{initial}} = -MB \cos(0^\circ) $$
Since $ \cos(0^\circ) = 1 $:
$$ U_{\text{initial}} = -MB $$
Substituting values: $ U_{\text{initial}} = -(0.5)(0.4) = -0.2 \, \text{J} $.
Step 2: Calculating Final Potential Energy.
Finally, the loop is rotated to $ \theta_2 = 180^\circ $.
$$ U_{\text{final}} = -MB \cos(180^\circ) $$
Since $ \cos(180^\circ) = -1 $:
$$ U_{\text{final}} = -MB(-1) = +MB $$
Substituting values: $ U_{\text{final}} = +(0.5)(0.4) = +0.2 \, \text{J} $.
Step 3: Calculating the Change in Potential Energy.
The change in potential energy ($ \Delta U $) is the difference between the final and initial states:
$$ \Delta U = U_{\text{final}} - U_{\text{initial}} $$
$$ \Delta U = 0.2 \, \text{J} - (-0.2 \, \text{J}) $$
$$ \Delta U = 0.2 + 0.2 = 0.4 \, \text{J} $$