Use natural units and the Minkowski metric throughout. An Abelian gauge transformation is . For a sufficiently regular , commuting the partial derivatives gives , so the Maxwell Lagrangian is invariant pointwise.
Vary the action with respect to the electromagnetic four-potential, using variations of compact support or vanishing on the boundary. The antisymmetry of the electromagnetic field tensor gives
After integration by parts, . The principle of stationary action therefore gives the source-free Maxwell equations,
In the Lorenz gauge, , this becomes with . The PDF's name “Lorentz gauge” denotes the usual Lorenz gauge, named after Lorenz. Residual gauge transformations preserve it when ; this condition is not itself a complete removal of the gauge freedom.