Similarly to charges, magnets exert forces on one another over a distance. Each magnet has two poles—a north and a south pole1. A magnet's north pole will be attracted to the south pole of another magnet, while the north poles or south poles of two magnets will repel each other.
Electricity and magnetism are closely related. Charges in motion create magnetic fields2. This means that any time we create a current, there will be an associated magnetic field. Since current is the result of charges moving, current flowing down a wire will create a magnetic field around the wire, as shown in Fig. 2.
The magnetic field induced by current in a wire can be intensified by looping the wire around a core; creating what is typically called an electromagnet3, a shown in Fig. 3. The magnetic field's strength is dependent upon the number of loops of the wire (more loops correspond to a stronger magnetic field), the current (larger currents provide stronger magnets), and the core material (ferrite cores, such as iron or steel, result in stronger fields).
The magnetic field created by the electromagnet in Fig. 3 is used in a variety of
applications—generally involving converting electrical energy to mechanical
motion. Audio speakers, for example, are often created in this way. A
time-varying current corresponding to the desired sound levels is applied to an
electromagnet. The resulting time varying magnetic field shakes a fixed magnet
which is attached to the speaker cone; the speaker cone creates pressure waves in
the air, which we hear as sound. Another common application
is the DC motor, in which an electromagnet's magnetic field is cleverly reversed periodically to
produce rotational motion.