Formulation of classical electromagnetism based on the principle of least action

Classical electromagnetism is deducible from the principle of least action, by attributing to the electromagnetic field a Lagrangian. This is an understanding step needed on the learning path from classical electromagnetism to QED. (I first learned about it by the book Classical Field Theory by Landau and Lifschitz). (Small wikipedia reference).

The image of a trampoline deformed by a weight is telling how the field of electrostatic potential is deformed by the presence of a charge.
The shape of a trampoline minimizes the total energy (energy of the trampoline + energy of the loads that weigh on it). The expression of the electromagnetic field with the least action principle only somehow extends the concept to one more dimension, except that the charge becomes vectorial, in duality with a potential that is a linear form.
However, there are still some points to explain about the link between the case of the trampoline and the electrostatic field because there are differences. In particular, differences in sign.
In the Lagrangian of the electromagnetic field, the energy of the electric field and that of the magnetic field contribute with opposite signs. That of the magnetic field is the same as the potential energy whereas that of the electric field is opposite in the same way as a kinetic energy. And for the same reason: a temporal stretch extends the magnetic field but dilutes the electric field. Thus, although the energy of the electric field is positive (the positivity of energy being a general necessity in physics), its contribution to action resembles that of negative energy. This is why the charges with the same sign repel each other while loads on a trampoline attract each other (and the magnetic force attracts currents with the same sign).

The expression of the principle of least action has the same form between the trampoline and electrostatics except that all the signs change uniformly. For the trampoline these 2 contributions are the normal ones of the potential energy: the potential energy of the field (deformation) and that of the loads in the field. The potential energy of the field of the trampoline is positive, whereas that of the loads in the field is determined to be that which balances this first contribution. Thus the total energy is negative but it is normal (negative potential energy of gravitation due to a total of energy slightly lower than mc2).

On the other hand, in electrostatics, the energy of the electric field contributes negatively to a positive total due, for the same equilibrium reason, to the potential energy of the charges in the field. But this potential energy of the charges in the electric field, which needs to be writen in the expression of action, is somehow only a fictitious quantity because of gauge invariance. To explain the total energy as formed of true energy it is necessary to rewrite its expression

Energy written from the action = potential energy of charges − energy of the field
= the true energy of the field.

(1 − 1/2 = 1/2)
Main page Foundations of physics