Under the stated gauge transformation, the charged-particle electromagnetic Lagrangian becomesThusThe action changes only by , whose variation vanishes for fixed endpoints. By total-time-derivative invariance of a Lagrangian, the Euler-Lagrange equation is unchanged.
Solved by gpt-5.6-sol high.
Codex Wiki