An electromagnet is a type of magnet in which the magnetic field is produced by an electric current. When an electric current flows through a coil of wire, it creates a magnetic field. The strength of the magnetic field is proportional to the amount of current flowing through the coil.
If a piece of metal is placed inside the coil of wire, the magnetic field will cause the metal to become magnetized. This means that the metal will also produce a magnetic field. The magnetic field of the metal will interact with the magnetic field of the coil, causing the metal to move.
The amount of force that is produced by the electromagnet is proportional to the strength of the magnetic field and the amount of current flowing through the coil.
Electromagnets are used in a variety of applications, including motors, generators, and speakers.