# What is the mechanism by which magnetic fields do work?

I've seen some conflicted answers to this question in texts and on the web, in the case of a dipole, for example.

Do magnetic fields do work directly, or is it their induced electric fields that do work?

Magnetic fields never do work directly on electric charges. This is because the magnetic force on any charged particle, $$\mathbf{F}=q\mathbf{v}\times \mathbf{B,}$$ is always orthogonal to the velocity, and therefore the power transferred, $\mathbf{F}\cdot\mathbf{v}$, is zero.

On the other hand, this seems to contradict much of our intuition about how magnets behave. If you take two magnets and put them close to each other, they will snap together, accelerating in the process, so there's definitely something that's doing work. What that something is will usually depend on what frame of reference you're working in.

The standard example is a loop of wire moving relative to a magnet, which induces a current in it. If you consider the situation in the frame where the loop is stationary, then what you see is a changing magnetic field; by Faraday's law this means there's an induced electric field that accelerates charges around the loop. On the other hand, in the magnet's frame of reference there are only magnetic fields, so it must be something else, which turns out to be the motion of the loop.

Assume for simplicity that the loop is travelling along its normal $\mathbf{n}$. Then the charges have a velocity $\mathbf{v}\propto\mathbf{n}$, and the magnetic force will give them an impulse perpendicular to that and thus along the loop. Once you have such a current going, though, the velocity of the charges has a component that's orthogonal to $\mathbf{n}$, and this will also incur in a magnetic force, which will now be along $\mathbf{n}$ and tending to slow the loop down. You will therefore create a current at the expense of the loop's kinetic energy or out of the work performed by some extra force that's keeping the velocity constant. There is a nice in-depth explanation of this example in Griffith's Introduction to electrodynamics (example 5.3, section 5.1; p. 209 in the 3rd edition).

The attracting magnets can be treated in a somewhat similar fashion. For one, you can swap the permanent magnets for loops of current without loss of generality, because the magnetic fields they produce are actually produced by magnetization currents on their surface. Put them close enough, and you get to the core of the problem, the magnetic force between two current-carrying wires.

Consider, then, two parallel wires carrying currents in the same direction, so that they attract and move towards each other. Again, in the frame of reference of each moving wire there's an electric field induced by a changing magnetic field, and this can perform work. In the lab frame, on the other hand, you have each wire moving in the magnetic field of the other. Once they're moving towards each other, the charges in each wire have a velocity component along the wire and one along the separation vector. The second component will incur a magnetic force on the charge carriers that's against the current direction; this means that you need a current source to keep it steady (with the associated energy cost) or the current in the wires will decrease.

For the magnets, then, this means that the magnetization of two magnets that snap together will actually decrease slightly in the process, by a specific mechanism which depends on where that magnetization comes from. This is, by the way, in principle, a temporary thing: the work you perform on the magnets when you prize them apart goes, essentially, into re-establishing the magnetization.

One should note, on the other hand, that strictly speaking this applies only to charged particles and, by extension, to systems that are made up of charged particles. It does not, however, cover the case of point dipoles, such as electrons, for which the fundamental force (and torque) exerted by a magnetic field are different, and given by $$\mathbf F=\nabla(\boldsymbol \mu·\mathbf B) \quad\text{and}\quad \boldsymbol\tau=\boldsymbol \mu\times\mathbf B .$$ This leaves permanent magnets in a bit of a funny position, because they are fundamentally made up of aligned electron spins so one should in principle apply to that description.

However, in a useful description of a permanent magnet you take a macroscopic average of the local magnetic dipole density to obtain its magnetization $\mathbf M$, and in the process you cease to care where the magnetization comes from. As far as classical electrodynamics is concerned (and unless you want to meddle with individual atoms inside it), a permanent magnet is simply a material with a permanent magnetization $\mathbf M$, all of whose interactions with other charges and currents occur via its bulk and surface magnetization currents, $$\mathbf J=\nabla\times\mathbf M \quad\text{and}\quad \mathbf K=\mathbf M \times\hat{\mathbf n} .$$ If the magnetization is uniform then there is no bulk current density (each bulk dipole 'cancels out' with its neighbours) and the magnetization current is confined to the surface. Thus, a uniformly-magnetized bar of iron is well modelled by magnetization currents on its surface, and the magnetic-work paradox can also be resolved as above - by the action of an induced electric field, or by magnetic forces slowing down those currents once there is motion along the loop normal.

In the end, the difference between the two is a bit of a personal-choice thing. It is generally somewhat harder to handle point dipoles and there are in general few situations that cannot be modelled by using electric currents, so it is a good thing to keep those models, and their counter-intuitive properties, well in mind. On the other hand, it is probably true that physics could do a bit of a better job remembering to emphasize that magnetic fields never do work directly on electric charges.

As Emilio Pisanty asserts, the magnetic Lorentz force $\boldsymbol{F_m}= q \boldsymbol{v \times B }$ does not do work, since $\boldsymbol{F_m \cdot v} = 0$. I don't have access to Griffith, but I find Feynman's discussion (in v. II, ch 15) confusing, since he has magnetic forces doing work on the current while also asserting those same forces do no work.

To see what's going on (classically, at least) consider an ideal, zero-resistance, wire driven by a current source $I$ in a magnetic field $\boldsymbol{B}$. The current $I$ is carried by mobile electrons whose negative charge $q_e<0$ is balanced by a fixed lattice of (much more massive) positively charged wire ions $q_w>0$, with $q_w=-q_e$ for simplicity.

The wire's moving current-carrying electrons (average velocity $\boldsymbol{v_e}$) will be deflected by the Lorentz force $\boldsymbol{F_e} = q_e (\boldsymbol{v_e \times B})$. Consequently, the electrons will tend to "pile-up" on one side of the wire. The wire's net charge density is now no longer zero, so an electric field $\boldsymbol{E}$ is produced that opposes the deflection. In steady-state, the electric force must just balance the Lorentz force, so the net force on the electrons vanishes:

$$\boldsymbol{E} = - (\boldsymbol{v_e \times B})$$

(This is just the Hall effect.)

Now this electric field will accelerate the wire's ions, since there is no counteracting magnetic force on them. In fact, the electric force on the wire ions $\boldsymbol{F_w}$ is exactly equal to the magnetic force $\boldsymbol{F_e}$ on the electrons:

$$\boldsymbol{F_w} = q_w \boldsymbol{E} = - q_e \boldsymbol{E} = q_e (\boldsymbol{v_e \times B}) = \boldsymbol{F_e}$$

The key difference is that this electric force can and will do work on the lattice.

If the wire is initially motionless ($\boldsymbol{v_w}=0$), the average electron velocity $\boldsymbol{v_e}=\boldsymbol{v_c}$, where $\boldsymbol{v_c}$ is parallel to the wire (increment $\boldsymbol{dl}$) and $$|q_e| \, n A_c \, |v_c|=I$$ (with $n$ the electron density and $A_c$ the wire cross-sectional area),

Then $\boldsymbol{E=-v_e \times B}$ is perpendicular to $d \boldsymbol{l}$, and the line integral of $\boldsymbol{E}$ around the wire is 0, so the applied voltage is 0 and the current source provides no power to the wire. But that's not surprising, since the rate of mechanical work being done on each lattice ion is $\boldsymbol{F_w \cdot v_w}=0$ also.

For a non-zero wire velocity $\boldsymbol{v_w}$, the electron velocity $\boldsymbol{v_e}=\boldsymbol{v_c}+\boldsymbol{v_w}$, and there will be a non-zero component of $\boldsymbol{E}$ along $\boldsymbol{dl}$:
$$\boldsymbol{E} \cdot \boldsymbol{dl} = - (\boldsymbol{v_e \times B}) \boldsymbol{\cdot} \boldsymbol{dl} = - (\boldsymbol{v_w \times B}) \boldsymbol{\cdot} \boldsymbol{dl}$$

so the electrical power $P_e$ supplied by the current source is: $$P_e = VI = I \int -\boldsymbol{E \cdot dl} = I \int \boldsymbol{( v_w \times B ) \cdot dl}$$

The mechanical power $P_m$ applied to the wire is the sum of the individual ion powers: $$P_m = \sum \boldsymbol{F_w \cdot v_w} = q_m n \int \boldsymbol{E \cdot v_w} \, dV = - q_m n \int \boldsymbol{(v_e \times B) \cdot v_w} \, dV$$

By a vector identity, and since $\boldsymbol{v_e = v_c + v_w}$ and $q_m = -q_e$,

$$P_m = - q_m n \int \boldsymbol{( B \times v_w) \cdot v_e} \, dV = q_m n \int \boldsymbol{( v_w \times B ) \cdot v_c} \, dV = I \int \boldsymbol{( v_w \times B ) \cdot dl}$$

for a thin wire, and $P_m = P_e$.