Magnets are complicated.

This fact is pretty well illustrated by how hard it is to predict whether a given material will make a good magnet or not. For example, if someone tells you the chemical composition of some material and then asks you “will it be magnetic?”, you (along with essentially all physicists) will have a hard time answering.  That’s because whether a material behaves like a magnet usually depends very sensitively on things like the crystal structure of the material, the valence of the different atoms, and what kind of defects are present.  Subtle changes to any of these things can make the difference between having a strong magnet and having an inert block.  Consequently, a whole scientific industry has grown up around the question “will X material be magnetic?”, and it keeps thousands of scientists gainfully employed.

On the other hand, there is a pretty simple answer to the more general question “where does magnetism come from?”  And, in my experience, this answer is not very well-known, despite the obvious public outcry for an explanation.

So here’s the answer:  Magnetism comes from the exchange interaction.

In this post, I want to explain what the “exchange interaction” is, and outline the essential ingredients that make magnets work.  Unless you’re a physicist or a chemist, these ingredients are probably not what you expect.  (And, despite some pretty good work by talented science communicators, I haven’t yet seen a popular explanation that introduces both of them.)

## Ingredient #1: Electrons are little magnets

As I discussed in a recent post, individual electrons are themselves like tiny magnets.  They create magnetic fields around themselves in the same way that a tiny bar magnet would, or that a spinning charged sphere would.  In fact, the “north pole” of an electron points in the same direction as the electron’s “spin”.

(This is not to say that an electron actually is a little spinning charged sphere.  My physics professors always told me not to think about it that way… but sometimes I get away with it anyway.)

The magnetic field created by one electron is relatively strong at very short distances: at a distance of one angstrom, it is as strong as 1 Tesla.  But the strength of that field decays quickly with distance, as $1/(\text{distance})^3$.  At any distance $\gtrsim 3$ nm away the magnetic field produced by one electron is essentially gone — it’s weaker than the Earth’s magnetic field (tens of microTesla).

What this means is that if you want a collection of electrons to act like a magnet then you need to get a large fraction of them to point their spins (their north poles) in the same direction.  For example, if you want a permanent magnet that can create a field of 1 Tesla (as in the internet-famous neodymium magnets), then you need to align about one electron per cubic angstrom (which is more than one electron per atom).

So what is it that makes all those electron align their spins with each other?  This is the essential puzzle of magnetism.

Before I tell you the right answer, let me tell you the wrong answer.  The wrong answer is probably the one that you would first think of.  Namely, that all magnets have a natural pushing/pulling force on each other: they like to align north-to-south.  So too, you might think, will these same electrons push each other into alignment through their north-to-south attraction.  Your elementary/middle school teacher may have even explained magnets to you by showing you a picture that looks like this:

(Never mind the fact that the picture on the right, in addition to its aligned North and South poles, has a bunch of energetically costly North/North and South/South side-by-side pairs.  So it’s not even clear that it has a lower energy than the picture on the left.)

But if you look a little more closely at the magnetic forces between electrons, you quickly see that they are way too weak to matter.  Even at about 1 Angstrom of separation (which is the distance between two neighboring atoms), the energy of magnetic interaction between two electrons is less than 0.0001 electronVolts (or, in units more familiar to chemists, about 0.001 kcal/mol).

The lives of electrons, on the other hand, are played out on the scale of about 10 electronVolts: about 100,000 times stronger than the magnetic interaction.  At this scale, there are really only two kinds of energies that matter: the electric repulsion between electrons (which goes hand-in-hand with the electric attraction to nuclei) and the huge kinetic energy that comes from quantum motion.

In other words, electrons within a solid material are feeling enormous repulsive forces due to their electric charges, and they are flying around at speeds of millions of miles per hour.  They don’t have time to worry about the puny magnetic forces that are being applied.

So, in cases where electrons decide to align their spins with each other, it must be because it helps them reduce their enormous electric repulsion, and not because it has anything to do with the little magnetic forces.

## Ingredient #2: Same-spin electrons avoid each other

The basic idea behind magnetism is like this: since electrons are so strongly repulsive, they want to avoid each other as much as possible.  In principle, the simplest way to do this would be to just stop moving, but this is prohibited by the rules of quantum mechanics.  (If you try to make an electron sit still, then by the Heisenberg uncertainty principle its momentum becomes very uncertain, which means that it acquires a large velocity.)  So, instead of stopping, electrons try to find ways to avoid running into each other.  And one clever method is to take advantage of the Pauli exclusion principle.

In general, the Pauli principle says that no two electrons can have the same state at the same time.  There are lots of ways to describe “electron state”, but one way to state the Pauli principle is this:

No two electrons can simultaneously have the same spin and the same location.

This means that any two electrons with the same spin must avoid each other.  They are prohibited by the most basic laws of quantum mechanics from ever being in the same place at the same time.

Or, from the point of view of the electrons, the trick is like this: if a pair of electrons points their spin in the same direction, then they are guaranteed to never run into each other.

It is this trick that drives magnetism.  In a magnet, electrons point their spins in the same direction, not because of any piddling magnetic field-based interaction, but in order to guarantee that they avoid running into each other.  By not running into each other, the electrons can save a huge amount of repulsive electric energy.  This saving of energy by aligning spins is what we (confusingly) call the “exchange interaction”.

To make this discussion a little more qualitative, one can talk about the probability $P(r)$ that a given pair of electrons will find themselves with a separation $r$.  For electrons with opposite spin (in a metal), this probability distribution looks pretty flat: electrons with opposite spin are free to run over each other, and they do.

But electrons with the same spin must never be at the same location at the same time, and thus the probability distribution $P(r)$ must go to zero at $r = 0$; it has a “hole” in it at small $r$.  The size of that hole is given by the typical wavelength of electron states: the Fermi wavelength $\lambda_F \sim n^{-1/3}$ (where $n$ is the concentration of electrons).  This result makes some sense: after all, the only meaningful way to interpret the statement “two electrons can’t be in the same place at the same time” is to say that “two electrons can’t be within a distance $R$ of each other, where $R$ is the electron size”.  And the only meaningful definition of the electron size is the electron wavelength.

If you plot two probability distributions together, they look something like this:

If you want to know how much energy the electrons save by aligning their spins, then you can integrate the distribution $P(r)$ multiplied by the interaction energy law $V(r)$ over all possible distances $r$, and compare the result you get for the two cases.  The “hole” in the orange curve is sometimes called the “exchange hole”, and it implies means that electrons with the same spin have a weaker average interaction with each other.  This is what drives magnetism.

(In slightly more technical language, the most useful version of the probability $P(r)$ is called the “pair distribution function“, which people spend a lot of time calculating for electron systems.)

## Epilogue: So why isn’t everything magnetic?

To recap, there are two ingredients that produce magnetism:

1. Electrons themselves are tiny magnets.  For a bulk object to be a magnet, a bunch of the electrons have to point their spins in the same direction.
2. Electrons like to point their spins in the same direction, because this guarantees that they will never run into each other, and this saves them a lot of electric repulsion energy.

These two features are more-or-less completely generic.  So now you can go back to the first sentence of this post (“Magnets are complicated”) and ask, “wait, why are they complicated?  If electrons universally save on their repulsive energy by aligning their spins, then why doesn’t everything become a magnet?”

The answer is that there is an additional cost that comes when the electrons align their spins.  Specifically, electrons that align their spins are forced into states with higher kinetic energy.

You can think about this connection between spin and kinetic energy in two ways.  The first is that it is completely analogous to the problem of atomic orbitals (or the simpler quantum particle in a box).  In this problem, every allowable state for an electron can hold only two electrons, one in each spin direction.  But if you start forcing all electrons to have the same spin, then each energy level can only hold one electron, and a bunch of electrons get forced to sit in higher energy levels.

The other way to think about the cost of spin polarization is to notice that when you give electrons the same spin, and thereby force them to avoid each other, you are really confining them a little bit more (by constraining their wavefunctions to not overlap with each other).  This extra bit of confinement means that their momentum has to go up (again, by the Heisenberg uncertainty principle), and so they start moving faster.

Either way, it’s clear that aligning the electron spins means that the electrons have to acquire a larger kinetic energy.  So when you try to figure out whether the electrons actually will align their spins, you have to weigh the benefit (having a lower interaction energy) against the cost (having a higher kinetic energy).  A quantitative weighing of these two factors can be difficult, and that’s why so many of scientific types can make a living by it.

But the basic driver of magnetism is really as simple as this: like-spin electrons do a better job of avoiding each other, and when electrons line up their spins they make a magnet.

So the next time someone asks you “magnets: how do they work?”, you can reply “by the exchange interaction!”  And then you can have a friendly discussion without resorting to profanity or name-calling.

## Footnotes:

1. The simplest quantitative description of the tradeoff between the interaction energy gained by magnetism and the kinetic energy cost is the so-called Stoner model.  I can write a more careful explanation of it some time if anyone is interested.

2. One thing that I didn’t explicitly bring up (but which most popular descriptions of magnetism do bring up) is that electrons also create magnetic fields by virtue of their orbits around atomic nuclei.  This makes the story a bit more complicated, but doesn’t change it in a fundamental way.  In fact, the magnetic fields created by those orbits are nearly equal in magnitude to the ones created by the electron spin itself, so thinking about them doesn’t change any order-of-magnitude estimates.  (But you will definitely need to think about them if you want to predict the exact strength of the magnetic field in a material.)

3. There is a pretty simple version of magnetization that occurs within individual atoms.  This is called Hund’s rule, which says that when you have a partially-filled atomic orbital, the electrons within the orbital will always arrange themselves so as to maximize the amount of spin alignment.  This “magnetization of a single atom” happens for the same reason that I outlined above: when electron spins align, they do a better job of avoiding each other, and their energy is lower.

4. If I were a good popularizer of science, then I would really go out of my way to emphasize the following point.  The existence of magnetism is a visible manifestation of quantum mechanics.  It cannot be understood without the Pauli exclusion principle, or without thinking about the electron spin.  So if magnets feel a little bit like magic, that’s partly because they are a startling manifestation of quantum mechanics on a human-sized scale.

1. April 19, 2015 6:22 pm

So, because of Hund’s Rule, magnetic materials should be found near the middle of lines in the periodic table (which make them partially filled orbits) and therefore maximize electron spin alignments. I see that Iron and Neodymium both conform roughly to his conclusion. Is this true of other elements near the center of their electron shell line in the periodic table?

Also, when you use the term kinetic energy in reference to electrons, are you using it in the sense of mass in motion? If so to increase the kinetic energy of anything it must either move faster or gain mass.

Creating an electro-magnetic field around an iron nail will make it a permanent magnet. Therefore the spins of the iron’s electrons must be getting aligned by this exposure to an external magnetic force.

Last, only some materials are attracted to or repulsed by magnetism, iron in particular. Are these materials the same materials that can be made into magnets?

Sorry I got carried away with questions. This is a great topic. Thanks for tackling it.

April 19, 2015 7:54 pm

Hi Ry,

These are all good questions, and you’re mostly right about everything. Let me respond to your questions/statements one at a time:

1. Yes, my understanding is that, in general, elements near the middle of the periodic table groups are the most magnetic. This doesn’t necessarily mean that they make the best magnets when put together into a solid (i.e., that the spins on different atoms end up aligning), but the atoms themselves are the “most magnetic” when they are in the middle of periodic table groups.

2. Yes, when I talk about “kinetic energy” I really am talking about how fast the electrons tend to move. (With the understanding that the “effective mass” of electrons can be different from the physical electron mass. See, for example, https://gravityandlevity.wordpress.com/2010/08/16/when-f-is-not-equal-to-m-a/ ).

3. You are right about what happens in an electromagnet. As I understand it, a pure iron crystal wants to become a magnet on its own. But because of defects in the material, it ends up instead with magnetic “domains”, which consist of many atoms but are still much smaller than the whole nail, where locally the electron spins are lined up. The different domains may not be lined up with each other, though. Turning on the external magnetic field forces all the domains to line up with each other, and once they are they can pretty much stay that way permanently.
The video I linked to at the beginning explains this pretty well: https://www.youtube.com/watch?v=hFAOXdXZ5TM

4. Again, you’re right. The only materials that a magnet will stick to are ones that already want to be magnetic themselves, like the iron on the door of your fridge. Putting a magnet on your fridge magnetizes the iron in the fridge door (or, rather, it organizes the already magnetic domains in the iron), and then the door can pull back on the fridge magnet in the usual north-to-south way.

April 20, 2015 7:45 am

Thank you for this insightful explanation.

When you say, “(If you try to make an electron sit still, then by the Heisenberg uncertainty principle its momentum becomes very uncertain, which means that it acquires a large velocity.)”, could you expand on why uncertainty generates a large velocity?

April 20, 2015 9:47 am

Hi Kieran,

When people introduce the Heisenberg uncertainty principle (say, in high school chemistry), they often make it sound like it’s just a matter of imprecise measurement. What was told to me, in fact, is that the uncertainty principle comes because any time you want to measure the position of an electron, you have to bounce something off it (like light), and that light alters the electron’s momentum.

But this is a completely wrong explanation. The truth is that an electron cannot simultaneously be confined to a small space and have a small momentum. Any attempt to squeeze will result in the electron gaining a large kinetic energy (or large velocity). In particular, if you confine an electron to a small distance $x$, then its momentum becomes as large as $p \sim \hbar/x$. The corresponding energy $p^2/2m \sim \hbar^2/mx^2$ is often called the “quantum confinement energy.”

In other words, when the Heisenberg uncertainty principle declares that “the uncertainty in the electron momentum is $p$“, it doesn’t just mean that some person doesn’t know the electron momentum very well. It means that the electron momentum really is something close to $p$. And if $p$ is large, then the electron is moving fast.

August 6, 2015 5:36 pm

I really enjoyed your clarification the uncertainty principle. It strikes me as the electron having a minimum amount of thermal energy (Not below absolute zero) and then trying to confine that moving ping-pong ball to a smaller space leads to greater velocity. Thanks.

August 6, 2015 5:38 pm

I meant to say, “Not absolute zero” and not, “below absolute zero”.

3. April 20, 2015 5:13 pm

I love this. But I can imagine it would seem a lot more mystical without the Fermi gas picture of metals (as a sea of valence electrons in a periodic lattice of nuclei) in mind. But it practically begs the question of what makes ferromagnetic materials different from other types of metal. Why should iron but not magnesium be susceptible?

April 20, 2015 7:20 pm

As I mentioned at the beginning, this stuff gets tricky quickly, and I’m not really qualified to comment on the differences between slightly different elements.

But I also suspect that in your comment you meant to single out manganese, which is right next to iron on the periodic table, instead of magnesium. At an intuitive level, magnesium isn’t a magnet because it represents a material with a filled atomic shell (the 3s shell). Spin polarization would require electrons to occupy the more energetically costly 3p shell. Manganese, on the other hand, is magnetic, and so is cobalt (iron’s other neighbor on the periodic table).

But really, the only really general rule I understand about when to expect magnetism is that magnetism arises when the density of states is high. This means that the cost of electrons going to higher kinetic energy states is small. It’s also a message that comes out pretty simply from the Stoner model, which I mentioned in Footnote 1.

4. March 24, 2016 11:11 pm

Thanks for the insightful explanations you have explained Atom-Domain theory nicely here.
Magnets are a great mystery from early childhood to many peoples, I myself used to play a lot with magnets from early childhood and wonder how can this object pull and push things without touching them. Atom-Domain theory you explained above explains the magnetic force quite well , but all the force fields like electro-magnetic field, gravitational field etc are still a mystery We have explained them in terms of atoms, elementary particles and quantum mechanics but haven’t yet come along with a simple elegant theory which explains everything and can be understood by even a young boy 🙂