# Euler-Lagrange equations of the Lagrangian related to Maxwell's equations

Clarification on Lagrangian mechanics would be much appreciated:

Suppose $$L(\phi,\,\,\phi_{,i},\,\,A_i, \dot A_i)=|\dot A+\nabla\phi|^2-|\nabla \times A|^2-c\phi+d\cdot A$$

Are the corresponding Euler-Lagrange equations then: $$c=0$$ by considering $\phi$, and $$2(\dot\phi_{,i}+\ddot A_i)+d_i=0$$ by considering $A_i$?

I am confused by the dependent variables in this Lagrangian -- they are differentiated wrt to different variables, namely $\phi$ wrt spatial elements, whereas $A_i$ wrt time. Moreover, shouldn't $L$ also be a function of $A_{i,j}$?

Help would be much appreciated!

-
Similar question on Phys.SE: physics.stackexchange.com/q/51169/2451 –  Qmechanic Jan 14 '13 at 16:09

It might help you to understand the physical significance of the lagrangian here. This is the lagrangian for Maxwell's equations in terms of the potentials. $\phi$ and $A$ are the scalar and vector potentials, and $c$ and $d$ are the charge and current distributions. The first term $|\dot A+\nabla\phi|^2$ is the electric field, second term magnetic, and the remaining terms the coupling between charges and fields.

It is just a physical fact that lagrangian does not explicitly depend on the other partial derivatives.

-

Even though the answer is already accepted, I feel that a proper derivation in the language of multivariate calculus fits here.

All relevant notes in physics use index notation for curved space-time, I still prefer the vector calculus so I will give a presentation using mathematical languages. Equations (2),(3),(4),(5),(6), and (7) in blue color are the final results.

Suppose $L(\phi,\,\,\phi_{,i},\,\,A_i, \dot A_i)=|\dot A+\nabla\phi|^2-|\nabla \times A|^2-c\phi+d\cdot A$

The Lagrangian for Maxwell's equations should have $1/2$ factor in front of the first two terms (as the one in the Physics.SE question, the derivation will be almost the same with your Lagrangian): $$L = \frac{1}{2}|\partial_t\mathbf{A} + \nabla \phi|^2 - \frac{1}{2}|\nabla \times \mathbf{A}|^2 - \rho\phi + \mathbf{J}\cdot \mathbf{A},$$ where I switched the notation using $c$ to $d$ to industry standard $\rho$ and $\mathbf{J}$. Notice the $(\phi,\mathbf{A})$ pair are the electric and magnetic potential pair.

Are the corresponding Euler-Lagrange equations then: $c=0$ by considering $\phi$, and $2(\dot\phi_{,i}+\ddot A_i)+d_i=0$ by considering $A_i$?

There must be something wrong with the derivation. I myself always prefer to use calculus of variations to derive Euler-Lagrange equation, aka, principle of least action for the action functional: $$\mathcal{S}[(\phi,\mathbf{A})]:= \int^{t}_0\int_{\Omega} L \,d\mathbf{x}dt.$$ For some smooth and simply-connected $\Omega\subset \mathbb{R}^3$. The first variation of this action functional must vanish: $$\lim_{\epsilon \to 0}\frac{d}{d\epsilon} \mathcal{S}[(\phi,\mathbf{A}) + \epsilon(\psi,\mathbf{v})] = 0, \tag{\star}$$ for any test pair $(\psi,\mathbf{v})$. The test pair satisfy: $$\color{red}{\text{The test pair do not change the boundary value of } (\phi,\mathbf{A}) \text{ in both space and time.}} \tag{\dagger}$$ i.e. the test pair satisfy homogeneous boundary conditions, for example, $\psi = 0$ or $\mathbf{v}\times \mathbf{n}_{\partial \Omega} = 0$ on boundary.

By the arbitrariness of the test pair $(\psi,\mathbf{v})$, first we can let $\psi = 0$ firstly, plugging the expression of Lagrangian into $(\star)$: $$0= \lim_{\epsilon \to 0}\frac{d}{d\epsilon} \mathcal{S}[(\phi,\mathbf{A}) + \epsilon(0,\mathbf{v})] \\ = \int^{t}_0\int_{\Omega} \Big((\partial_t \mathbf{A} + \nabla\phi) \cdot\partial_t \mathbf{v} -\nabla \times \mathbf{A} \cdot \nabla \times \mathbf{v} +\mathbf{J}\cdot \mathbf{v} \Big) \,d\mathbf{x}dt.\tag{1}$$ The first two equations for Maxwell's system is obtained by substitution (assuming everything is smooth): $$\text{Magnetic field:}\quad \mathbf{B}= \nabla \times \mathbf{A}, \\ \text{Electric field:} \quad \mathbf{E} = -\partial_t \mathbf{A} - \nabla\phi.$$ So that they implies Gauss's law for magnetism, and Faraday's law respectively: \begin{align} \color{blue}{\nabla \cdot \mathbf{B} = 0},\tag{2} \\ \color{blue}{\nabla \times \mathbf{E} = -\partial_t \mathbf{B}}.\tag{3} \end{align} Back to equation (1), we have: $$0 = \int^{t}_0\int_{\Omega} \Big( -\mathbf{E}\cdot\partial_t \mathbf{v} -\mathbf{B} \cdot \nabla \times \mathbf{v} +\mathbf{J}\cdot \mathbf{v} \Big) \,d\mathbf{x}dt,$$ integrating by parts in both space and time, using the fact of $(\dagger)$, we have for any $\mathbf{v}$: $$0 = \int^{t}_0\int_{\Omega} \Big( \partial_t \mathbf{E}\cdot\mathbf{v} -\nabla \times \mathbf{B} \cdot \mathbf{v} + \mathbf{J}\cdot \mathbf{v} \Big) \,d\mathbf{x}dt.$$ This yields Ampère's law: $$\color{blue}{\nabla \times \mathbf{B} = \partial_t \mathbf{E} + \mathbf{J}}.\tag{4}$$ Lastly, let $\mathbf{v} =\mathbf{0}$ in the test pair, integrating by parts one more time and using $\psi$'s boundary condition $(\dagger)$: $$0= \lim_{\epsilon \to 0}\frac{d}{d\epsilon} \mathcal{S}[(\phi,\mathbf{A}) + \epsilon(\psi,\mathbf{0})] \\ = \int^{t}_0\int_{\Omega} \Big((\partial_t \mathbf{A} + \nabla\phi) \cdot \nabla \psi -\rho \psi\Big) \,d\mathbf{x}dt \\ = \int^{t}_0\int_{\Omega} \Big(-\mathbf{E} \cdot \nabla \psi -\rho \psi\Big) \,d\mathbf{x}dt \\ = \int^{t}_0\int_{\Omega} \Big(\nabla \cdot\mathbf{E} \, \psi -\rho \psi\Big) \,d\mathbf{x}dt.$$ We have reached the last piece in Maxwell's equations, Gauss's law for electric field: $$\color{blue}{\nabla \cdot\mathbf{E} = \rho}. \tag{5}$$

Combining (2),(3),(4), and (5) yields Maxwell's equations.

Remark 1: here all medium-related constants are set to $1$, also neglecting the speed of light $c$. Adding speed of light the Lagrangian should be $$L' = \frac{1}{2}\left|\frac{1}{c}\partial_t\mathbf{A} + \nabla \phi\right|^2 - \frac{1}{2}|\nabla \times \mathbf{A}|^2 - \rho\phi + \frac{1}{c}\mathbf{J}\cdot \mathbf{A}.$$

Remark 2: Aside from substitution, the first one of the Euler-Lagrange equations obtained (equation (4)) in index notation should be: $$\underbrace{\color{blue}{\varepsilon_{nmi}(\varepsilon_{ijk} A_{k,j})_{,m}}}_{\nabla\times(\nabla \times \mathbf{A})} \color{blue}{+ } \underbrace{ \color{blue}{\ddot{A}_n + \dot{\phi}_{,n} }}_{\partial_{tt}\mathbf{A} + \partial_t(\nabla\phi)} \color{blue}{= }\underbrace{\color{blue}{J_n}}_{\mathbf{J}}.\tag{6}$$ Also if the Lagrangian you gave is w/o the factor of $1/2$, the equation above should have a factor of $2$ on the left side.

If we assume the magnetic potential $\mathbf{A}$ is smooth (so we can interchange the derivative w.r.t space and time) and divergence free, then the second one of the Euler-Lagrange equations should be simply the Poisson equation: $$\color{blue}{-\Delta \phi = \rho}.\tag{7}$$ In (6) and (7), $\rho$ and $\mathbf{J}$ correspond to OP's $c$ and $d$ respectively.

I am confused by the dependent variables in this Lagrangian -- they are differentiated wrt to different variables, namely $\phi$ wrt spatial elements, whereas $A_i$ wrt time.

The electric and magnetic potentials can be functions in space and/or time. In not-so-strict term, magnetic (electric) field changing along with time generating rotational electric (magnetic) field.

Moreover, shouldn't $L$ also be a function of $A_{i,j}$?

$L$ is already a function $A_{i,j} := \partial_j A_i$, for it has a term of $\nabla \times \mathbf{A}$ whose $k$-th component is $\varepsilon_{kji} \partial_j A_{i}$.

-