Get A+ with YaClass!
Register now to understand any school subject with ease and get great results on your exams!

Theory:

In the previous section, we learned the basics of electromagnetism and magnetic compass. In this session, through an activity, we will discuss the working of the magnetic compass.
 
Working principle of Magnetic compass:
The magnetic compass works with the Earth’s magnetic field principle and shows the magnetic North and South. The magnetic compass has a magnetised needle, that can freely rotate in a horizontal plane. Such a magnetic needle tends to settle in the magnetic meridian.
 
What happens if we put a compass needle near a bar magnet?
  
Magnetic_field_near_poles_2.svg.png
Deflection of compass when it is brought near a bar magnet
 
The above figure shows the bar magnet with North and South poles marked by N and S. It also has a magnetic needle with a compass.
We can see that the red portion inside the bar magnet and the needle represents the North pole. And, the grey and white portions represent the bar magnet's South pole and the needle.
 
You can observe that the North pole in the magnetic needle is always deflected towards the South pole of the bar magnet and vice-versa.
 
Why does a compass needle get deflected when brought near a bar magnet?
 
A compass needle gets deflected whenever a bar magnet is brought near to it. Because, a magnetic compass can be assumed as a pole, and the magnet creates a magnetic field.
 
If we place both a compass and the magnet at rest, the compass will be reflected in a direction and constant.
 
But if you move the magnet, it will alter the generated flux lines. Due to this, the magnetic needle experiences a force and deflects as long as you move the magnet. It can be understood by serving the field lines of a magnet. They are never the same at two points on coordinate axes (on opposite sides, magnitude is the same, but the direction is different). Likewise, if we consider moving the magnet, the resultant magnetic field at the place of a compass will change.
 
Through this we can conclude that there is a change in direction or magnitude, and the needle gets deflected near a bar magnet.
Reference:
https://commons.wikimedia.org/wiki/File:Magnetic_field_near_poles_2.svg