# Calculate Hamiltonian from Lagrangian for electromagnetic field

I am unable to derive the Hamiltonian for the electromagnetic field, starting out with the Lagrangian $$\mathcal{L}=-\frac{1}{4}F^{\mu\nu}F_{\mu\nu}-\frac{1}{2}\partial_\nu A^\nu \partial_\mu A^\mu$$ I found: $$\pi^\mu=F^{\mu 0}-g^{\mu 0}\partial_\nu A^\nu$$ Now $$\mathcal{H}=\pi^\mu\partial_0 A_\mu-\mathcal{L}$$ Computing this, I arrive at: $$\mathcal{H}=-\frac{1}{2}\left[\partial_0 A_\mu\partial_0 A^\mu+\partial_i A_\mu\partial_i A^\mu\right]+\frac{1}{2}\left[\partial_i A_i\partial_j A_j-\partial_j A_i\partial_i A_j\right]$$ The right answer, according to my exercise-sheet, would be the first to terms. Unfortunately the last two terms do not cancel. I have spent hours on this exercise and I am pretty sure, that I did not commit any mistakes arriving at this result as I double checked several times. My question now is: did I start out right and am I using the right scheme? Is this in principle the way to derive the Hamiltonian, or is it easier to start out with a different Lagrangian maybe using a different gauge? Any other tips are of course also welcome. Maybe the last two terms do actually cancel and I simply don't realize it. Texing my full calculation would take a very long time so I am not going to post it, but as I said, it should be correct. But if everything hints at me having committed a mistake there, I will try again.

Edit:

After reading and thinking through Stephen Blake's answer, I realized that one can get rid of the last two terms in $H$, even though they do not vanish in $\mathcal{H}$. This is done by integrating the last term by parts and dropping the surface term, leaving $A_i\partial_j\partial_i A_j$. One can now proceed to combine the last two terms: $$\partial_i A_i\partial_j A_j+A_i\partial_j\partial_i A_j=\partial_i(A_i\partial_j A_j)$$ This can be converted into a surface integral in $H$ which can be assumed to vanish, leaving us with the desired "effective" $\mathcal{H}$.

• Why do you think the Lagrangian should be that to begin with? Shouldn't it be $- F^{\mu \nu} F_{\mu \nu} / 4 - J^\mu A_\mu$? – Eric Angle Jan 3 '14 at 19:06
• Possible duplicate: physics.stackexchange.com/q/90224/2451 – Qmechanic Jan 3 '14 at 20:25
• @EricAngle We were working with a source-free EM field in Lorentz gauge, which allowed us to add the second term to the Lagrangian. I do, however, not quite understand why we did it. – user35915 Jan 4 '14 at 8:00
• I see. Since the Lorentz gauge has $\partial_\mu A^\mu = 0$, I guess you're free to add any function of $\partial_\mu A^\mu$ to the Lagrangian. – Eric Angle Jan 4 '14 at 12:41
• Or, at least a power of $\partial_\mu A^\mu$. – Eric Angle Jan 4 '14 at 13:57

There doesn't appear to be anything wrong with user35915's calculation. However, in order to get the desired answer, the canonical momenta needs to be different. Starting from user35915's action, $$S=\int d^{4} x\left( -\frac{1}{4}F_{\mu\lambda}F^{\mu\lambda}-\frac{1}{2}A^{\mu}_{,\mu}A^{\lambda}_{,\lambda}\right)$$ change the second term by integrating by parts and chuck the surface term away to get, $$S=-\frac{1}{4}\int d^{4} x( F_{\mu\lambda}F^{\mu\lambda}-2A^{\mu}A^{\lambda}_{,\lambda\mu}) \ .$$ Now expand the electromagnetic field tensor $F_{\mu\lambda}=A_{\lambda,\mu}-A_{\lambda,\mu}$ and do a bit of swopping dummy indices to get, $$S=-\frac{1}{2}\int d^{4}x \eta^{\mu\rho}\eta^{\lambda\sigma}(A_{\lambda,\mu}A_{\sigma,\rho}-A_{\lambda,\mu}A_{\rho,\sigma}-A_{\rho}A_{\lambda,\sigma\mu})\ .$$ The last two terms can be combined into a surface integral which vanishes at infinity and the final form of the action is only the first term in the last line. The Lagrangian is now, $$L=-\frac{1}{2}\int d^{3}x \eta^{\mu\rho}\eta^{\lambda\sigma}A_{\lambda,\mu}A_{\sigma,\rho}=-\frac{1}{2}\int d^{3}x A_{\mu,\lambda}A^{\mu,\lambda}\ .$$ The reason for getting the Lagrangian in this form is because it looks like the Lagrangian for four scalar fields. The canonical momenta are now, $$\pi^{\mu}=-A^{\mu}_{,0}=-\frac{\partial A^{\mu}}{\partial t}$$ which look like the momenta for four scalar fields. Now, it's straightforward to go over to the desired Hamiltonian, $$H=-\frac{1}{2}\int d^{3}x (\pi^{\mu}\pi_{\mu}+A^{\mu}_{,r}A_{\mu,r})$$
• If I might add one thing to this, it's that there is an ambiguity for the momenta. It is perfectly possible to have momentum as a generator of flows in one of the four independent parameters $(t, \vec{x})$. Marsden did some mathematical work on "multisymplectic field theories" in the past, but I don't know if it's ever really been translated from math-talk to physics-talk. – webb Jan 3 '14 at 22:58
• @StephenBlake Thank you very much. I guess that is how we were supposed to solve the exercise. A hint might have been helpful...after reading your answer, I realized, that the two terms troubling me can also be combined into a (spacial) surface integral which vanishes in $H$ so I might as well leave them out of $\mathcal{H}$. – user35915 Jan 4 '14 at 7:43