Difficulty: Introductory | Prerequisites: Basic understanding of electric charge and current
Magnetic fields are one of the two halves of electromagnetism, and this topic lays the groundwork for everything that follows in the course, from induction to generators to AC circuits. If you have missed the earlier material on electric current, review that first. The core question here is: what does a magnetic field look like around a permanent magnet and around a current-carrying coil, and how do we control each one? Understanding this is essential before moving to Faraday's law and electromagnetic induction.
A bar magnet produces a magnetic field that runs from north to south outside the magnet, and from south to north inside it, forming continuous closed loops. An electromagnet creates a nearly identical field pattern, but you control its strength by adjusting the current and its polarity by reversing the current direction. Field strength falls off with distance from either type of magnet.
Magnetic field
A region of space around a magnet or current-carrying conductor where a magnetic force can be detected. Think of it as the invisible "zone of influence" that a magnet creates around itself.
Magnetic field lines
Imaginary lines used to visualise the direction and strength of a magnetic field. Where the lines are packed closely together, the field is stronger; where they spread apart, the field is weaker. In simple terms, they are a map of the field's shape.
North pole / south pole
The two ends of a magnet. Field lines exit the north pole and enter the south pole on the exterior. Think of the north pole as the "source" end and the south pole as the "sink" end of the external field.
Polarity
The property of a magnet that defines which end is north and which is south. Reversing the polarity of an electromagnet means the north and south ends swap.
Electromagnet
A magnet created by passing electric current through a coil of wire. In simple terms, it is a magnet you can switch on, off, and adjust.
Direct current (DC)
Electric current that flows in one direction only, such as from a battery. The electromagnet's field remains steady while the current is steady.
Alternating current (AC)
Electric current that periodically reverses direction. When an electromagnet is driven by AC, its magnetic field direction flips back and forth at the frequency of the source.
Compass needle
A small magnet free to rotate, which aligns with the local magnetic field. In the PhET simulation, the compass needle grid serves as a visual map of the bar magnet's or electromagnet's field.
Magnetic field strength (magnitude)
How intense the magnetic field is at a given point. Stronger magnets produce denser field-line patterns. In simple terms, it is how hard the magnet "pushes" on nearby magnetic objects.
A bar magnet's field lines form closed loops: they emerge from the north (N) pole, curve through the surrounding space, enter the south (S) pole, then travel through the interior of the magnet back to the north pole.
Outside the magnet, the field direction is N → S.
Inside the magnet, the field direction is S → N.
You can verify the interior direction by dragging the compass needle inside the bar magnet in the simulation: the needle points from south to north.
Near the poles, compass needles align strongly and the field lines are densely packed. This indicates a strong field.
Far from the magnet, the needles become less aligned and more randomly oriented. The field lines spread out, indicating a weaker field.
Field strength decreases with distance. The simulation shows this through the spacing of the compass-needle grid: tightly aligned near the poles, loosely aligned far away.
The simulation's strength slider adjusts the overall intensity of the bar magnet.
A stronger magnet produces a denser, more ordered compass-needle pattern that extends further from the magnet.
A weaker magnet shows a sparser pattern that fades more quickly with distance.
Flipping the polarity swaps the labels N and S, reverses the colour coding of the magnet, and causes all compass needles to rotate 180 degrees.
When the compass sits at the midpoint of the bar magnet during a polarity flip, the needle spins abruptly because the field there is strong and the reversal is immediate.
When the compass is far from the magnet, the needle still reverses, but the transition may appear smoother because the field is weaker and Earth's field (if enabled) competes.
At low magnet strength (e.g. 10%) and large distance, the compass responds sluggishly or may align more with Earth's field than the bar magnet's field.
A coil of wire carrying electric current produces a magnetic field that looks almost identical to a bar magnet's field.
The field emerges from one end of the coil (the north pole) and enters the other (the south pole), just like a permanent magnet.
The key difference: you can turn it on and off and adjust it freely.
There is no "strength %" slider for the electromagnet in the simulation. Instead, you change the strength by adjusting the voltage (and therefore the current) supplied by the battery or AC source.
Higher voltage means more current, which means a stronger magnetic field.
In practice, electromagnet strength also depends on the number of coil turns and whether a ferromagnetic core is present, but this simulation focuses on current.
In real life, it is far easier to change the strength of an electromagnet (just turn a dial) than a bar magnet (whose strength is fixed by its material and magnetisation).
There is no "Flip Polarity" button for the electromagnet. To reverse the polarity, you reverse the direction of the current.
In the simulation, this is done by flipping the battery orientation or by letting the AC source cycle through its reversal naturally.
When polarity reverses, all compass needles rotate 180 degrees, exactly as they do for the bar magnet flip.
DC source (battery): The current flows one way, so the electromagnet has a steady, fixed field, just like a bar magnet.
AC source (oscillator): The current alternates direction, so the magnetic field continuously flips polarity.
The vertical slider on the AC source controls the amplitude (peak current), which sets how strong the field gets at its maximum.
The horizontal slider controls the frequency, which sets how rapidly the field oscillates.
Maximum amplitude and maximum frequency together produce the most dramatic "dance party" effect, where all compass needles spin rapidly and continuously.
Magnetic field of a bar magnet (qualitative)
Field lines form closed loops: exit N pole → curve through external space → enter S pole → travel through interior back to N. The pattern resembles the classic "iron filings" diagram.
Right-hand rule for a solenoid/electromagnet
Curl the fingers of your right hand in the direction the current flows through the coil. Your thumb points toward the north pole of the electromagnet.
Field strength vs. distance (qualitative)
Field strength decreases with distance from the magnet. For a magnetic dipole (which a bar magnet approximates at large distances), the field falls off roughly as 1/r³, where r is the distance from the centre. You will not need to calculate this at the conceptual level, but you should know that the drop-off is steep, much faster than, say, gravity (1/r²).
Electromagnets are everywhere. MRI machines in hospitals use superconducting electromagnets to generate the strong, uniform fields needed for medical imaging. Scrapyard cranes use large electromagnets to pick up and release metal, which would be impossible with a permanent magnet you cannot switch off. Electric doorbells, relays, and maglev trains all rely on the ability to control a magnetic field by controlling a current.
Students often think magnetic field lines "stop" at the south pole. They do not. The lines continue through the interior of the magnet, forming complete closed loops. There is no starting or ending point.
Students sometimes believe that a stronger magnet has more field lines in total. What it actually has is a greater density of field lines (more lines per unit area), which represents a stronger field.
A common mistake is thinking that reversing an electromagnet's polarity requires a special switch. All you need to do is reverse the direction of the current. Swap the battery leads or let the AC cycle handle it.
Students occasionally confuse the compass needle aligning with the field direction with the compass needle pointing toward the north pole. The needle points along the field, which means away from the north pole in the space outside the magnet.
⚠️ You will almost certainly be asked to sketch or identify the direction of field lines around a bar magnet. Remember: N → S outside, S → N inside.
⚠️ Expect a question comparing bar magnets and electromagnets. The key distinction: an electromagnet's strength and polarity are controllable via the current; a permanent magnet's are fixed.
⚠️ The right-hand rule for solenoids is a staple exam item. Practise it until you can do it without thinking.
⚠️ Know what happens to field strength with distance. "The field gets weaker" is not enough. Be specific: the compass needles become less aligned, the field-line spacing increases, and the field falls off steeply (roughly 1/r³ for a dipole).
True or false: Magnetic field lines originate at the north pole and terminate at the south pole.
Answer: False. They form closed loops. Outside the magnet they go N → S, but inside the magnet they continue S → N.
Fill in the blank: To reverse the polarity of an electromagnet, you reverse the direction of the ______.
Answer: current.
True or false: A compass needle placed far from a bar magnet will align just as strongly as one placed near the pole.
Answer: False. The field is weaker at greater distance, so the alignment is weaker.
Fill in the blank: The ______ slider on an AC source controls how fast the electromagnet's field oscillates.
Answer: frequency (horizontal slider).
True or false: An electromagnet powered by DC has a field that continuously flips direction.
Answer: False. DC produces a steady field. You need AC for continuous flipping.
Q: A bar magnet is placed on a table and iron filings are sprinkled around it. Describe the pattern you would expect to see, and explain what it tells you about the magnetic field.
A: The filings form curved lines that arc from one pole to the other, densely packed near the poles and more spread out further away. This pattern maps the magnetic field lines: the direction of each filing shows the local field direction, and the density of filings shows the local field strength.
Q: You have an electromagnet connected to a battery. Without any additional components, how can you reverse the polarity of the electromagnet? What observable change would confirm the reversal?
A: Reverse the connections to the battery (swap the leads). A compass placed near the coil would rotate 180 degrees, confirming that the north and south poles have swapped.
Q: Explain why a compass needle placed at the midpoint of a bar magnet, directly on its perpendicular bisector, points straight down (toward the south pole) rather than toward either end.
A: At the midpoint along the perpendicular bisector, the horizontal components of the field from the two poles cancel. The net field at that location points from the north-pole side directly toward the south-pole side, which is perpendicular to the magnet's long axis. The compass needle aligns with this net field direction.
Q: An electromagnet is switched from a DC source to an AC source. Describe what happens to the compass-needle grid around it and explain why.
A: The compass needles begin oscillating back and forth. Under DC, the field was steady and the needles pointed in fixed directions. Under AC, the current reverses direction periodically, so the magnetic field flips polarity at the frequency of the AC source. The needles track these reversals, spinning continuously.
Q: Why does a compass needle respond more sluggishly to a polarity reversal when it is far from the magnet and the magnet is set to low strength?
A: At large distance and low magnet strength, the bar magnet's field is very weak at the compass location. The torque it exerts on the needle is small, so the needle turns slowly. If Earth's magnetic field is also present, it competes with the magnet's weak field, making the needle's response even less decisive.
This material connects directly to Faraday's law and electromagnetic induction: once you understand how a magnetic field behaves, the next step is seeing what happens when that field changes in time near a conductor. That is the subject of pickup coils, transformers, and generators. It also links back to Coulomb's law and electric fields: just as charges create electric fields, moving charges (currents) create magnetic fields, and the two are unified in Maxwell's equations.
bar magnet, permanent magnet, electromagnet, solenoid, magnetic field lines, magnetic flux, compass needle, north pole, south pole, polarity, field direction, field strength, DC, AC, alternating current, direct current, right-hand rule, Faraday's electromagnetic lab, PhET simulation, magnetic dipole, iron filings, Hans Christian Ørsted, electromagnetism, coil, current-carrying wire