A bar magnet is one of the sources of magnetic field. The bar magnet consists of two poles, a north pole (N) and a south pole (S):
When holding two magnets close to each other, the like poles will repel each other while the opposite poles attract.
Magnetic poles always exist in pair. When a bar magnet is broken, two new bar magnets are obtained:
The electric field is the force per unit charge:
however, due to the absence of magnetic monopoles, the magnetic field must be defined differently.
To define it, consider a particle of charge , moving at a velocity . Experimentally, it was found:

The observations can be summarized into:
The unit of magnetic field is tesla (). From , tesla is equal to:
Another commonly used unit is gauss (), where .
Note that is always perpendicular to the plane formed by and and cannot change the particle's speed . does no work on the particle:
However, the direction of can be changed by .
A charged particle moving at a speed experiences a magnetic force . Electric current is a collection of moving charged particles, meaning a wire carrying current also experiences the magnetic force.
Consider a long straight wire suspended in the region between two magnetic poles. The magnetic field is illustrated by the black dots and flows out of the page. When a downward current is present, the wire is deflected to the left. However, when an upward current is present, the wire is deflected to the right:
Consider a segment of wire of length and cross-sectional area . The magnetic field points into the page:
The charges move at an average drift velocity and the total charge in this segment is:
where is the number of charges per unit volume. The total magnetic force on the segment is:
where and is vector with magnitude and with the same direction as the electric current.
For a wire of arbitrary shape, the magnetic force is obtained by summing over the force acting on the small segments :
For a closed loop, the sum of the segments is zero, and thus the total force exerted is zero: