Magnets are not the only source of magnetic field. In 1820, Hans christian oersted discovered that an electric current flowing through a wire caused a nearby compass to deflect. This indicated that the current in the wire was generating a magnetic field. Oersted studied the nature of the magnetic field around the long straight wire. He found that the magnetic field existed in circular From around the wire and that the intensity of the field was directly proportional to the amount of current carried by the wire. He also found that the strength of the field was strongest next to the wire and diminished with distance from the conductor until it could no longer be detected. In most conductors,the magnetic field exists only as long as the current is flow (i.e.an electrical charge is in motion). However, in ferromagnetic materials the electric current will cause some or all of the magnetic Domains to align and a residual magnetic field will remain.
Oersted also noticed that the direction of the magnetic field was dependent on the direction of the electrical current in the wire. A three - dimmensional representation of the magnetic field is shown below. There is a simple rule for remembering the direction of the magnetic field around a conductor. It is called the right-hand rule. If a person grasps a conductor in one's right hand with the thumb pointing in the direction of the current, the fingers will circle the conductor in the direction of the magnetic field.