The work done in deflecting a magnet of magnetic moment 'M through al angle ‘θ' in a field of strength ‘H’ is
MH (1-cosθ)
MH (1-sinθ)
MH sinθ
MH (1+cosθ)
W=∫0θ MHsinθdθ=MH[−cosθ]0θ=MH(1−cosθ)