# The electromagnetic Lagrangian

### The action due to the electromagnetic field

The action for the Newtonian electromagnetic force, $$\vec{F} = q \vec{E} + q \left( \vec{v} \times \vec{B} \right)$$ with potentials, \begin{align*} -\nabla V &= \vec{E} \\ \nabla \times \vec{A} &= \vec{B} \end{align*} is given by $$\int_{t_1}^{t_2} \tfrac{1}{2}m \left( \vec{v} \cdot \vec{v} \right) - qV + \vec{A} \cdot \vec{v} \;\mathrm{d}t$$

Thus, the Lagrangian is \begin{align*}L &= \tfrac{1}{2}m \left( \vec{v} \cdot \vec{v} \right) - qV + q\vec{A} \cdot \vec{v}\\&= \tfrac{1}{2}m\left(\dot{x}^2 + \dot{y}^2 + \dot{z}^2 \right) - qV + q \left( A_x \dot{x} + A_y \dot{y} + A_z \dot{z} \right)\end{align*}

### Euler-Lagrange equations

The canonical momentum conjugate to $x$ is $$p_x = \frac{\partial L}{\partial \dot{x}} = m \dot{x} + qA_x$$ so as before, this momentum contains a term other than the mechanical momentum.

Also notice that changing the vector potential, or gauge, does affect both the Lagrangian and the conjugate momentum. That is, the momentum is not gauge-invariant - meaning that it wouldn't be a quantity that would be measured in an experiment.

It follows that \begin{align*}\dot{p_x} &= \frac{\mathrm{d}}{\mathrm{d}t} \left( \frac{\partial L}{\partial \dot{x}} \right)\\&= m \ddot{x} + q\dot{A_x}\\&= m \ddot{x} + q \left( \frac{\partial A_x}{\partial x}\dot{x} + \frac{\partial A_x}{\partial y}\dot{y} + \frac{\partial A_x}{\partial z}\dot{z}\right)\end{align*}

Also, $$\frac{\partial L}{\partial x} = -q\frac{\partial V}{\partial x} + q\left( \frac{\partial A_x}{\partial x}\dot{x} + \frac{\partial A_y}{\partial x}\dot{y} + \frac{\partial A_z}{\partial x}\dot{z}\right)$$

The Euler-Lagrange equation is then \begin{align*}0 &= \frac{\mathrm{d}}{\mathrm{d}t} \left( \frac{\partial L}{\partial \dot{x}} \right) - \frac{\partial L}{\partial x}\\&=m \ddot{x} + q \left( \frac{\partial A_x}{\partial x}\dot{x} + \frac{\partial A_x}{\partial y}\dot{y} + \frac{\partial A_x}{\partial z}\dot{z}\right) - \left\{ -q\frac{\partial V}{\partial x} + q\left( \frac{\partial A_x}{\partial x}\dot{x} + \frac{\partial A_y}{\partial x}\dot{y} + \frac{\partial A_z}{\partial x}\dot{z}\right) \right\}\end{align*}

Re-arranging, we get \begin{align*}m \ddot{x}&= -q\frac{\partial V}{\partial x} + q\left\{\dot{x} \left( \frac{\partial A_x}{\partial x} - \frac{\partial A_x}{\partial x} \right) + \dot{y} \left( \frac{\partial A_y}{\partial x} - \frac{\partial A_x}{\partial y} \right) +\dot{z} \left( \frac{\partial A_z}{\partial x} - \frac{\partial A_x}{\partial z} \right)\right\}\\&= -q\frac{\partial V}{\partial x} + q\left( v_y \left [ \nabla \times \vec{A} \right ]_z - v_z \left [ \nabla \times \vec{A} \right ]_y \right)\\&= -q\frac{\partial V}{\partial x} + q\left [ \vec{v} \times \left( \nabla \times \vec{A} \right) \right ]_x\\&= q E_x + q\left [ \vec{v} \times \vec{B} \right ]_x\end{align*}

The other two equations can be derived similarly, and so the Lagrangian, as defined, is valid.