A small magnet of magnetic moment M,

A small magnet of magnetic moment M, is placed j at a distance r from the origin O with its axis | parallel to y-axis as shown. A small coil, of one turn is placed on the x- axis of the same distance from the origin, with the axis of the coil coinciding with x-axis. For what value of current in the coil does a small magnetic needle, kept at origin, remains undeflected ? What is the direction of current in the coil ?

This happens when the magnetic field of a bar magnet is equal and opposite to the magnetic field of coil.

Current is in anticlockwise direction, as seen from the Origin.