# What is a permanent magnet and how do I calculate the magentic force exerted by a permanent magnet?

So far my understanding of a permanent magnet is: Since elements like iron have atoms with orbitals that have many electrons with the same spin, these cause the metal to have a magnetic field, which exerts a magnetic force on moving charges, I would like to know if my understanding is correct or what is the correct explanation for permanent magnets (eg. a bar magnet). And also, how would you calculate the magnetic force of a permanent magnet?

In the language of electrodynamics, a permanent magnet is nothing but a spatial distribution of magnetic dipoles, described by a magnetic dipole moment density, usually called the magnetization $$\mathbf{M}(\mathbf x)$$. Think of the whole magnet being composed of tiny bar magnets, such that the tiny bar magnet at point $$\mathbf x$$ has a magnetic dipole moment given by:

$$d\boldsymbol \mu (\mathbf x) = \mathbf{M}(\mathbf x) dv$$

with $$dv$$ being the volume element. What this distribution $$\mathbf{M}(\mathbf x)$$ actually is depends on the details of the physical mechanism that makes the material magnetic: whether it's a ferromagnet, paramagnet, etc. Most of the time, the reason for the existence of these tiny dipoles is spin, which is purely quantum mechanical in nature.

Now for a specific permanent magnet, with a known magnetization distribution $$\mathbf M (\mathbf x)$$, how can we actually calculate the magnetic field? Well, we already know what the field due to a tiny magnetic dipole is (see here). For a magnetic point dipole $$d \boldsymbol \mu (\mathbf x')$$ located at $$\mathbf x'$$, the magnetic field at a point $$\mathbf x$$ is:

$$d \mathbf B(\mathbf x,\mathbf x') = \frac{\mu_0}{4 \pi} \frac{1}{|\mathbf x - \mathbf x'|^5} \Bigg[3 \bigg(d \boldsymbol \mu(\mathbf x') \cdot (\mathbf x - \mathbf x') \bigg) \mathbf (\mathbf x - \mathbf x') - d \boldsymbol \mu(\mathbf x') |\mathbf x - \mathbf x'|^2 \Bigg] \qquad (*)$$

Now the net magnetic field is simply the sum of these contributions of the different dipoles:

$$\mathbf B(\mathbf x) = \int_{\mathbf x' \in \mathcal D} d \mathbf B(\mathbf x,\mathbf x') \qquad (**)$$

with $$\mathcal D$$ being the spatial region of the magnet. Using some vector calculus identities, one can show that equations $$(*)$$ and $$(**)$$ result in (see e.g. here):

$$\mathbf B(\mathbf x) = \int_{\mathcal D} dv' \ \mathbf J_M(\mathbf x') \times \frac{\mathbf x - \mathbf x'}{|\mathbf x - \mathbf x'|^3}+ \int_{\partial \mathcal D} da' \ \mathbf K_M(\mathbf x')\times \frac{\mathbf x - \mathbf x'}{|\mathbf x - \mathbf x'|^3} \qquad (***)$$

with the second integral being a surface integral over the boundary of the magnet, and $$\mathbf J_M$$ and $$\mathbf K_M$$ being effective (volume and surface) current distributions that perfectly model the magnetic field. These are given by: $$\mathbf J_M(\mathbf x) \equiv \boldsymbol \nabla \times \mathbf M(\mathbf x)$$ $$\mathbf K_M(\mathbf x) \equiv \mathbf M(\mathbf x) \times \hat{\mathbf n}$$

where $$\hat{\mathbf n}$$ is the unit vector normal to the boundary of the magnet at each point. These current distributions model the magnetic field in the sense that to calculate the field due to a magnet with some $$\mathbf M(\mathbf x)$$, you can:

1. Calculate the effective volume and surface current densities $$\mathbf J_M$$ and $$\mathbf K_M$$ according to the formulas above.
2. Forget about there ever being a magnet, and simply use the Biot-Savart law $$(***)$$ to calculate the magnetic field that these effective currents generate in space.

See these notes for more explanations and examples.