If you take a piece of wood and put it next to another piece of wood, nothing happens. And if you take a pice of granite and put it next to another rock, still nothing. But if you take this piece of iron, and put it next to this other piece of iron, magic! I mean, magnet.
Magnetic objects are able to magically attract at long distances because they generate magnetic fields that extend invisibly out beyond the object. But the mystery is this: where do magnetic fields come from?
Well that's easy, Henry! We've known for a long time that electricity and magnetism are really just two sides of the same coin. Kind of like mass and energy or time and space. They can be transformed into one another. And in fact, a magnetic field is just what an electric field becomes when an electrically charged object starts moving.
That makes sense for explaining why a current of electrons flowing through a wire causes this compass needle to move, or how currents in the earth's outer core generate the geomagnetic field, but a bar magnet or the compass needle itself are just pieces of metal, without any electrical current running through them. Or are they? At the microscopic level, there are loads of electrons whizzing around the atoms and molecules that make up any solid.
Right! This brings up an excellent point. The magnetic behavior of any everyday object is influenced by a fascinating combination of effects ranging from the level of particles to atoms, collections of atoms, and collections of collections of atoms.
First, individual particles. Unlike the everyday working of gravity and electricity, permanent magnets can only be fully understood as a quantum mechanical effect. In much the same way that particles like electrons and quartz have fundamental properties called mass and electrical charge, most particles also have another intrinsic property called Tiny Magnet. Just kidding—it's called intrinsic magnetic moment. But really, that's just technical mumbo jumbo saying that particles with electric charge also happen to be tiny magnets.
If you want to know why they are tiny magnets, well, you may as well ask "why are particles charged in the first place?" Or "why do objects with mass and energy attract each other gravitationally?" No one knows! We just know that's the way the universe works.
Exactly! And since the 1920's, we've known that each individual electron or proton is basically a tiny magnet.
Which brings us to the level of atoms. An atom is a bunch of positively charged protons with a bunch of negatively charged electrons whizzing around them. The proton tiny magnets are about a thousand times weaker than the electron ones, so the nucleus of the atom has almost no effect on the magnetism of the atom as a whole. And you might thing that since many, though not all, of the electrons are also moving, that like the current in a wire, they should generate magnetic fields due to that motion. And indeed they do! These are called orbital magnetic fields.
Except these don't usually contribute to the magnetic field of an atom. Here's why: electrons and atoms are accurately and complicatedly described by quantum mechanics, but the gist of the story is the electrons congregate in shells around the nucleus. The electrons in any filled shell zoom equally in all directions, so the currents they generate cancel out and generate no electric field. These electrons also come in pairs whose tiny magnets point in opposite directions and also cancel. However, in a half-filled shell, all of the electrons are unpaired, and their tiny magnets point in same direction and add up. Meaning that it's the intrinsic magnetism of the electrons in the outer shell that gives an atom the majority of its magnetic field.
So atoms near the side of any of the major blocks of the periodic table, which have full or nearly full outer electron shells aren't magnetic. And atoms in the middle of the blocks have half full outer electron shells, and are magnetic. For example, nickel, cobalt, iron, manganese, chromium, etc.
Wait, but chromium isn't magnetic. Ah, but just because an atom is magnetic, doesn't mean a material made up of lots of that atom will be magnetic. Which brings us to the level of crystals. When a bunch magnetic atoms get together to make a solid, they generally have two options. One is for all the atoms to align their magnetic fields with each other, or they can align their magnetic fields in an alternating fashion so they all cancel out. The atoms will do whichever one requires less energy. That's why chromium, for example, is a very magnetic atom, but a very un-magnetic solid, because it's one of the most antiferromagnetic materials that we know.
Iron, on the other hand, is the namesake of ferromagnetism, so it is unsurprisingly ferromagnetic. Or, in usual parlance, magnetic—sometimes (shows picture of a cast iron skillet, with the caption "unmagnetized cast iron: still good for cooking").
The last and final level of magnetism is that of domains. Essentially, even in a magnetic material where the magnetic fields of atoms line up together, it's possible that one chunk of the material will have all its atoms lined up pointing one way, and another chunk will have all its atoms pointing another way, and so on.
[OMINOUS MEDIEVAL SOUNDTRACK] If all of these domains are of a similar size, then none may be strong enough to force the others to align with it. In which case, a piece of iron, for example, may have no magnetic field at all because of all the warring magnetic kingdoms within it.
However, if you apply a strong enough magnetic field from outside the material, you can help one domain expand its control over its neighbors, and so on, until all of the domains have been unified into one kingdom, all pointing in the same direction. And now, finally, you can rule with an iron fist! I mean, magnet (it's magnetic, because it's ferromagnetic and all of the domains are aligned).
Exactly! What's remarkable is that magnetism is a fundamentally quantum property amplified to the size of everyday objects. Every permanent magnet is a reminder that quantum mechanics underlies our universe.
In order for an everyday object to be magnetic though, it has to have a unified kingdom of magnetic domains, each made up of bajillions of atoms which also need to be aligned with each other, each of which can only be magnetic in the first place if it has an approximately half-filled outer shell of electrons so their intrinsic magnetic fields can align and not cancel each other out.
Not surprisingly, these criteria are pretty difficult to fulfill, which is why there are only a limited number of suitable materials you can use when you're building a magnet. Or, you could just run a current through any electrical conductor and produce a magnetic field that way.