Let a bar magnet makes angle θ with magnetic field B and 2l be the length of the bar as show in figure.
Force on N-pole = mB along B and Force on S-pole = mB, opposite to B, since these are the equal and opposite forces they produce torque
ז = force x perpendicular distance. = mB x NA = mB x 2lsinθ therefore ז =MBsinθ
The direction of the torque is perpendicular to the the plain containing M and B, and given by right handed screw rules.
Magnetic dipole moment as the torque acting on a dipole held perpendicular to uniform magnetic field of unit strength
SI unit of M is JT-1