Lagrangian Hamiltonian and the Recovery of Maxwell equations
Sections
- Lagrangian
- Adding the Source Term
- Equations of Motion
- Conservation Comes for Free
- Hamiltonian
- Canonical Momentum
- The Hamiltonian Density
- Hamiltonian with a Source
- The Loose End
- Constrained Hamiltonian
- A note on symbols
- The recipe
- Getting into canonical variables
- Collecting the $\phi$ terms
- Consistency: the Dirac chain
Lagrangian§
For the principle of relativity to hold, we demand our lagrangian must be frame independant. At this stage we see is indeed frame independant, it is a scalar. But, notice that this is not a gauge invariant choise, someone using a different gauge convention will gain different answer even with the same expression. So then, given that we have a frame-independant quantity forming a gauge invariant from it is actaully already done on previous article, it is and it is directly related to and . Which, should hint heavily on us to use it as our lagrangian ( since lagrangian is directly related to energy and energy in maxwell's frameworks are directly related to and ). So, then let's take
At this point, we can't know if this is the correct choice, at most we know this should be a lorentz and gauge invariant quantity. Well, then let's check it against the known EM result of
And since is the only directly dependants of which is also lorentz covariant. We propose that we should vary with . And we will justify it by seeing if it produce expected results like the energy.
Let's first find its variation.
By anti-symmetry of , we can relabel those indices and simplifies
Adding the Source Term§
The obvious gauge-covariant way to couple in a source is to add a term linear in , since a linear coupling is the minimal choice consistent with the symmetries we already imposed. Take
with the index convention fixed once and for all as
Notice this new piece isn't manifestly gauge invariant on its own — under it picks up . That term vanishes (up to a boundary term we can throw away) only if . So gauge invariance is quietly demanding charge conservation from us before we've even written down the equations of motion — good to keep in the back pocket, we'll see it show up again twice more, each time from a completely different angle.
Equations of Motion§
We already did the hard part of this variation above:
Integrating the first term by parts (dropping the boundary term) gives , so the Euler-Lagrange condition for arbitrary gives us straight away
(the exact constant on the right is just a unit-system bookkeeping choice — absorb it into how is normalized). This is the equation we derived earlier using maxwell's equation. Thus, we see that maxwells equation and the lagrangian are consistence togather.
Written out, the two components are the ones we already know:
We will need both of these explicitly when we come to the constrained Hamiltonian.
Conservation Comes for Free§
Here's the conclusion worth flagging on its own. Take a divergence of the equation of motion:
The left side is a symmetric derivative operator () contracted against an antisymmetric tensor (), so it vanishes identically — no equations of motion needed, no on-shell condition, just index symmetry. That forces
which is the continuity equation, i.e. charge conservation. This is the same condition gauge invariance demanded of us a moment ago, but now it's dropped out as a mathematical consequence of the field equations rather than something we imposed by hand — a nice consistency check that the theory isn't fighting itself. It's really a preview of Noether's theorem: gauge invariance is the symmetry, and -conservation is the associated conserved current, though making that identification precise is a story for its own note.
Hamiltonian§
Classically the Lagrangian framework already gives us every answer we want, and the section above shows it reproducing Maxwell exactly. The reason to push into the Hamiltonian framework is that in the quantum framework the Hamiltonian is the time evolution operator, the thing that generates the EOM of everything. So before quantising anything, let's see what the Hamiltonian framework says classically, and check it against what we already know.
Canonical Momentum§
The Hamiltonian is built from , so what we want is the momentum conjugate to directly. Since we have , and
The covariant route gives the same answer but needs care with index placement, and it is worth doing once to see where the factors come from. The identity holds for a genuinely lowered , and with the raised component is . So
This is conjugate to , not to . Converting picks up two things: a factor because , and a minus sign because . Together,
agreeing with the direct computation. From here on only is used; does not appear again.
The Hamiltonian Density§
Where from we get
Let's do the source-free case first ( noticing the source is nowhere in the original lagrangian ). Then
Thus
The last term is not zero pointwise but it is a total divergence
and in the source free case by Gauss law so
Gauss's law is being imported here from the Maxwell equations we already have, not derived from anything in this section — which is fine, since the whole point of this section is to check the Lagrangian against known results rather than to generate new ones. It is worth noting in advance that the constrained treatment below produces Gauss's law from the Hamiltonian structure alone, with nothing imported.
This integrates to a boundary term when forming and vanishes if the fields fall off at infinity so it drops from the total Hamiltonian though not from the density itself giving
which now matches the expected form . Matching term by term means reading and together — which is just saying that our carries no out front. Restoring it everywhere means writing and carrying the factor through; nothing below depends on that choice, so we keep the simpler normalization.
Hamiltonian with a Source§
Worth checking what the source does to before moving on. Since carries no dependence at all, it doesn't touch the canonical momentum — comes out exactly the same as the source-free case, . But it does sit inside itself, and since , splitting gives
so the source term flips sign once (it entered with a minus) and lands in unchanged, with no extra factors picked up along the way. With the convention fixed above this is , the interaction term of the Hamiltonian. Note it is not an interaction energy density — the magnetic piece has the wrong sign to be one — which is a hint that is not behaving like an ordinary dynamical variable here.
Now redo the total-divergence trick, this time with the source present. Gauss's law is , so
The here cancels the sitting inside exactly, and the divergence integrates away as before, leaving
So disappears from the total Hamiltonian entirely. This is the concrete symptom of the loose end below, and it is exactly the expression the constrained treatment will hand back as the genuine energy.
The Loose End§
identically since is antisymmetric. So has no conjugate momentum at all, it is a Lagrange multiplier enforcing Gauss law as a constraint rather than a dynamical field with its own equation of motion. Everything above sidestepped this in two ways: the Legendre transform was performed only over , never over ; and the -dependence was disposed of at the level of the total by importing Gauss's law from outside. A fully rigorous treatment needs the Dirac–Bergmann constrained Hamiltonian procedure, which is what the rest of this note does.
Constrained Hamiltonian§
The Hamiltonian above was built with two provisional steps. The Legendre transform was performed only over , never over , because has no conjugate momentum to invert for. And the -dependence was disposed of at the level of the total by importing Gauss's law from outside. The Dirac–Bergmann procedure repairs both at once, and the repair pays for itself: Gauss's law comes back out as a consequence rather than an input.
A note on symbols§
In the general Dirac framework the primary constraints are conventionally written . Here is the scalar potential — the same from , equal to up to a factor of . It is never a constraint. The constraints in this note are called and .
The recipe§
The total hamiltonian ( constrained hamiltonian ) is the canonical hamiltonian plus the primary constraint carrying an arbitrary coefficient. Two things are worth saying about why that extra term is there at all.
It is not a penalty term added to push a straying solution back onto the constraint surface. It is the velocity the Legendre map threw away. When the map is singular, some velocity direction is invisible to the momenta — no value of records it — and that lost direction reappears as a free coefficient multiplying the constraint it was lost to. We will see this explicitly in two lines: the multiplier turns out to be exactly .
It also leaves the energy alone on the constraint surface, since the term is a multiple of something that vanishes there. Off the surface it is not zero, and that is the point — it generates a flow.
The momenta conjugate to and are
with equal-time brackets
These are just with the discrete label replaced by the continuous label — a field has one degree of freedom per point of space, so the Kronecker delta becomes a Dirac delta. The Kronecker delta that survives in the second bracket says "same vector component"; the Dirac delta says "same point".
The first equation is the primary constraint . Primary means it did not come from any equation of motion — it holds identically the moment the Legendre map is written down, since could only have entered through . The weak equality means it holds on the constraint surface but is not an identity across all of phase space; this distinction matters, because has nonvanishing brackets even though it vanishes.
Getting into canonical variables§
is not a phase-space coordinate — is. Until every is traded for we cannot take a single Poisson bracket, since the bracket is defined by derivatives with respect to the canonical pair. Substituting that and :
Now the claim about the multiplier can be checked. Hamilton's equation for picks out the only term containing :
so the multiplier is the velocity , exactly as promised. The arbitrary coefficient we introduced by hand was never arbitrary decoration; it is the missing time derivative wearing a different name.
Collecting the terms§
currently appears twice in : once differentiated, in , and once bare, in . We want it to appear once, undifferentiated, because that is the shape of a Lagrange multiplier — a variable sitting in front of a quantity that does not contain it. Getting there means moving the derivative off , which is what integrating by parts does.
The product rule gives
Integrating over all space, the second piece is a total divergence, so by the divergence theorem it becomes a surface integral of at infinity and vanishes for fields falling off fast enough — the same disposal we used on earlier. What survives has the derivative transferred from onto , with a sign picked up along the way:
Both terms are now bare, so they collect:
Everything else in is -free, giving
Three things this form makes visible that the previous one hid.
First, the underbraced energy is precisely the total we obtained above by importing Gauss's law — but here nothing was imported. The -dependence simply sorted itself into a separate term instead of cancelling.
Second, now stands to exactly as stands to . The scalar potential is itself a multiplier. Everything past the energy is a constraint term, which is the same structure as lapse and shift in ADM gravity.
Third, now exists as an object one can point at. Before the integration by parts there was no single term in that could be called Gauss's law.
A caveat: this identity holds for the total , not for the density pointwise, since the two densities differ by which is generally nonzero at any given point. That is why the displayed equation is written as .
(The integration by parts is for display, not for computation. The functional derivative would have done it for us: , the same . But then the constraint would stay buried inside a derivative instead of standing on the page.)
Consistency: the Dirac chain§
We now have a constraint that must hold at . But a constraint is not self-enforcing — writing does not stop the Hamiltonian flow from carrying the state off that surface. So we demand it stay true, which means demanding , and see what that costs.
Preserve .
Notice what did not happen: did not appear. It cannot, because the only term carrying it is and by antisymmetry. A constraint can never use its own multiplier to repair itself. So instead of determining , this condition produces a new constraint:
Since , this is Gauss's law,
This is the payoff promised at the top. Here it is not imported and not an initial condition imposed by hand — it is forced by demanding that survive time evolution. It is called a secondary constraint because it required the equations of motion to find, unlike which came straight from the Legendre map.
Preserve . The algorithm does not stop; a new constraint must itself be preserved. The other Hamilton equations are
the first reproducing and the second being Ampère's law, — both matching what the Lagrangian gave, which is the consistency check we came here for. Hence
The divergence of a curl vanishes identically, so the entire condition collapses to charge conservation. For a conserved source it holds automatically: no new constraint appears, nothing further is demanded, and the chain closes. For a non-conserved source it would read , and the theory would have no solutions at all — electromagnetism simply cannot couple to a current that is not conserved.
This is charge conservation showing up for the third time — first demanded by gauge invariance of the coupling term, then handed back for free by , and now as the closure condition of the Dirac algorithm. Three independent routes, one condition.
Discussion
No comments yet — yours could open the discussion.