# Deriving the EM Hamiltonian

RedX
For some reason I can't derive the Hamiltonian from the Lagrangian for the E&M field. Here's what I have (using +--- metric):

$$\begin{equation*} \begin{split} \mathcal L=\frac{-1}{4}F_{ \mu \nu}F^{ \mu \nu} \\ \Pi^\mu=\frac{\delta \mathcal L}{\delta \dot{A_\mu}}=-F^{0 \mu} \\ \mathcal H=\Pi^\mu \dot{A}_\mu -\mathcal L=-F^{0 \mu}\dot{A}_\mu +\frac{1}{4}F_{ \mu \nu}F^{ \mu \nu} =-F^{0 \mu}\dot{A}_\mu+\frac{1}{4}(2F_{0i}F^{0i}+F_{ij}F^{ij}) \end{split} \end{equation*}$$

But F0i=Ei, and Fij=-Bk, so this is equal to:

$$\mathcal H=-F^{0 \mu}\dot{A}_\mu+\frac{1}{2}(-E_{i}^2+B_{i}^2)$$

The Hamiltonian however should be one half the sum of the squares of the electric and magnetic fields. But I can't figure out what I did wrong. I almost have it, as the first term almost adds to the 2nd term to give that, but not quite.

Also, I'm not quite sure when using the (+---) metric whether the canonical momenta is:

$$\Pi^\mu=\frac{\delta \mathcal L}{\partial^0 A_\mu}$$
or

$$\Pi^\mu=\frac{\delta \mathcal L}{\partial_0 A_\mu}$$

I don't think it matters in the derivation of the Hamiltonian, but which one do you use in the canonical commutation relations for example?

## Answers and Replies

Science Advisor
Homework Helper
Gold Member
OK, I missed a term the first time around. We can write

$$-F^{0 \mu}\dot{A}_\mu = -F^{0 i}\partial_0{A}_i = - F^{0i}( F_{0i} + \partial_i A_0 ) = E_i^2 + E_i (\partial_i A_0)$$

Then

$$\mathcal H=-F^{0 \mu}\dot{A}_\mu+\frac{1}{2}(-E_{i}^2+B_{i}^2) =\frac{1}{2}(E_{i}^2+B_{i}^2) + E_i (\partial_i A_0).$$

The last term can be written as

$$\partial_i ( A_0 E_i) - A_0 ( \partial_i E_i) .$$

The total derivative will vanish in the volume integral, while the second term vanishes by Gauss' law in the absence of sources.

I believe that there's a cleaner way of doing things by treating the choice of gauge as either a 1st or 2nd class constraint, but I don't remember the details.

Last edited:
Science Advisor
Homework Helper
Also, I'm not quite sure when using the (+---) metric whether the canonical momenta is:

$$\Pi^\mu=\frac{\delta \mathcal L}{\partial^0 A_\mu}$$
or

$$\Pi^\mu=\frac{\delta \mathcal L}{\partial_0 A_\mu}$$

It doesn't matter whether the 0 is upstairs or downstairs, if you're using the (+---) metric. It would have mattered however if you were using the (-+++) metric, of course. However, for consistency and esthetical reasons, the 0 should be downstairs when it's the time derivative of the vector potential. So the second formula in my quote is the right one to use.

And the canonical hamiltonian for a constrained system is always computed on the hypersurface of primary constraints. In your case, it's the hypersurface $\Pi_{0} = \Pi^{0} = 0$.

To find the hamiltonian in terms of the classical fields E and B, first compute wrt the potentials and the canonical momenta.