Written in May 2026, backdated to when the work happened. This post is a reflection, not a contemporaneous journal entry.
Lagrangian and Hamiltonian Mechanics: A Comprehensive Reference
The deeper reformulation of classical mechanics; and the essential prerequisite for quantum field theory.
Newton’s laws describe mechanics in terms of forces. But forces are not the most convenient starting point for most problems; and they are not the natural language in which modern physics is written. The reformulations developed by Lagrange (1788), Hamilton (1833), and Jacobi in the 19th century reveal classical mechanics as something deeper and more elegant: a theory built on the principle that nature minimizes a quantity called the action.
These reformulations are not merely more convenient. They are how every subsequent theory has been built:
- Quantum mechanics uses Lagrangian and Hamiltonian structure
- Special and general relativity are naturally formulated in terms of Lagrangians
- Classical and quantum field theory are entirely Lagrangian-based
- Gauge theory and the Standard Model rest on Lagrangian symmetries
This document covers Lagrangian and Hamiltonian mechanics at the senior undergraduate level, then extends to classical field theory; the genuine prerequisite to QFT.
Table of Contents
- Why Lagrangian Mechanics?
- Calculus of Variations
- The Principle of Least Action
- The Euler-Lagrange Equations
- Generalized Coordinates and Constraints
- Worked Examples
- Symmetries and Noether’s Theorem
- The Hamiltonian Formulation
- Phase Space and Poisson Brackets
- Canonical Transformations
- Hamilton-Jacobi Theory (Brief)
- Classical Field Theory; The Bridge to QFT
- Noether’s Theorem for Fields
- Appendix: Conventions and Identities
1. Why Lagrangian Mechanics?
Consider a bead sliding on a wire shaped like a helix, under gravity. Using Newton’s second law, you’d have to analyze the normal force from the wire (unknown, depends on constraint), the tension (if any), gravity, possibly friction, and decompose everything into components along and perpendicular to the wire.
Using Lagrangian mechanics, you write down one number; the Lagrangian; in terms of one coordinate (distance along the wire). One equation pops out. Done.
Three Concrete Advantages
1. Coordinates of your choice. Lagrangian mechanics works in any coordinates; Cartesian, spherical, rotating, oscillating, whatever fits the problem. No need to project forces onto axes.
2. Constraints handled automatically. Forces of constraint (normal forces, tension in inextensible strings, contact forces in rigid bodies) drop out; you don’t need to know them to solve the motion.
3. Symmetries to conservation laws. Every continuous symmetry of the Lagrangian produces a conservation law via Noether’s theorem. Translation invariance → momentum conservation. Time invariance → energy conservation. Rotation invariance → angular momentum conservation. The relationship is mechanical, not mysterious.
The Deeper Reason
More profoundly, Lagrangian mechanics reveals that classical physics is a variational theory. Nature does not “push things around with forces.” Nature selects, out of all conceivable paths between two points in spacetime, the one that extremizes a quantity called the action. Force is a derived concept; useful, but not fundamental.
This variational structure turns out to be universal. It survives quantization (in the path integral formulation, particles explore all paths, weighted by the action). It’s the foundation of general relativity (Einstein’s equations come from varying the Einstein-Hilbert action). It’s how every quantum field theory; including the Standard Model; is defined.
Learning Lagrangian mechanics isn’t just a reformulation. It’s a shift in how you see physics.
2. Calculus of Variations
Before the physics, the math. The calculus of variations is about finding functions that extremize (minimize or maximize) an integral. Regular calculus finds points that extremize a function; the calculus of variations finds functions that extremize a functional.
The Basic Problem
Given a functional of the form
find the function ; with fixed endpoints and ; that makes stationary (i.e., unchanged under small variations).
The Variational Derivation
Suppose is the extremizing function. Consider a nearby path
where is an arbitrary smooth function with (endpoints held fixed) and is a small parameter.
Substitute into the functional:
For to be extremizing, must be stationary with respect to :
Differentiating under the integral and using the chain rule:
Integrate the second term by parts:
The boundary term vanishes because . So:
Since is arbitrary, the bracketed quantity must vanish everywhere.
The Euler-Lagrange Equation (General Form)
This is the central equation of the calculus of variations. Every function that extremizes an integral of the given form satisfies it.
Classic Example: The Shortest Path
Problem: what curve has the shortest arc length between two points?
Arc length is
so , independent of . The Euler-Lagrange equation becomes:
which means is constant. That in turn means is constant, so ; a straight line. Exactly what you’d hope.
Classic Example: The Brachistochrone
Problem (posed by Johann Bernoulli in 1696, solved by Newton overnight): what curve between two points lets a ball rolling under gravity travel from one to the other in the least time?
Setting up the integral for transit time and applying the Euler-Lagrange equation yields; after some work; the cycloid: the curve traced by a point on a rolling wheel. This problem launched the calculus of variations.
Why This Matters for Physics
Hamilton’s principle says that classical trajectories are the ones that extremize a particular functional called the action. The Euler-Lagrange equations for this functional are the equations of motion. Every calculation in Lagrangian mechanics is, underneath, an application of the math above.
3. The Principle of Least Action
The Action
For a mechanical system described by coordinates and velocities , define the Lagrangian:
where is the kinetic energy and is the potential energy. (This choice works for most ordinary systems; the more general statement is that is whatever gives the right equations of motion under Hamilton’s principle.)
The action is the time integral of the Lagrangian:
Hamilton’s Principle
Given fixed endpoints and , the physical trajectory is the one that makes stationary:
(Often called “least action”; usually it’s actually a minimum, but strictly it just needs to be stationary. Other formulations do call out “stationary action” more carefully.)
What “Stationary” Means
Small deformations of the path with change the action by . For the physical path, to first order in . Deformations away from the true path do change (usually increasing it, sometimes decreasing; but the first-order variation vanishes).
An Important Clarification
The Lagrangian is not uniquely defined. Adding a total time derivative changes nothing:
leaves the equations of motion unchanged (the added term integrates to a boundary term that vanishes at fixed endpoints). This flexibility is occasionally useful.
Why This Works
Physically, one can derive Hamilton’s principle from Newton’s laws (or vice versa; they are equivalent for most systems). But the conceptual move; treating a trajectory as the solution of a global optimization problem rather than a step-by-step integration of forces; is profound and scales to relativistic and quantum physics in a way that force laws don’t.
4. The Euler-Lagrange Equations
Apply the calculus of variations to the action with , , , . You immediately get the equations of motion:
The Euler-Lagrange Equations
For each generalized coordinate :
One equation per degree of freedom. That’s it. That’s the entire machinery of Lagrangian mechanics.
Immediate Verification: Free Particle
For a free particle in 1D, (no potential). Then:
The Euler-Lagrange equation gives:
Newton’s second law for a free particle.
Immediate Verification: Particle in a Potential
For :
Euler-Lagrange:
Newton’s second law in the form .
So for simple systems, the Lagrangian formalism reproduces Newton exactly; with more work. The payoff comes when the coordinates are not Cartesian.
Generalized Momentum
Define the generalized momentum (or canonical momentum) conjugate to :
For Cartesian coordinates, is the ordinary momentum . But in other coordinate systems, it can be something quite different (angular momentum, for instance). The Euler-Lagrange equation then reads
that is, the generalized force equals the rate of change of generalized momentum.
Cyclic Coordinates
A coordinate is cyclic (or ignorable) if doesn’t depend on it, only on . Then:
A cyclic coordinate immediately gives you a conservation law. If your coordinate system is well-chosen, conserved quantities fall out automatically.
5. Generalized Coordinates and Constraints
The power of the Lagrangian approach comes from coordinate freedom. Let’s formalize that.
Generalized Coordinates
A generalized coordinate is any variable that helps specify the configuration of the system. There’s no requirement that it be a Cartesian position. Examples:
- For a pendulum: the angle from vertical is one coordinate
- For a particle on a sphere: angles
- For a bead on a wire: arc length along the wire
- For a rigid body: three Euler angles plus the center-of-mass position
The number of degrees of freedom is the minimum number of coordinates needed to fully specify the configuration.
Holonomic Constraints
A constraint that can be written as an equation between coordinates:
is called holonomic. A holonomic constraint reduces the degrees of freedom by one.
Examples:
- Rigid body (distances between pairs of points fixed)
- Bead on a wire
- Pendulum on a fixed-length string
Strategy: choose generalized coordinates that automatically satisfy the constraints. For a pendulum, instead of with the constraint , just use . One coordinate, no constraint, one equation of motion.
Non-Holonomic Constraints
Constraints that involve velocities or inequalities and cannot be integrated into an equation of coordinates alone. Example: a ball rolling without slipping on a plane; the constraint involves the velocities and cannot be reduced to a relation between positions alone.
Non-holonomic systems require more care: Lagrange multipliers or d’Alembert’s principle. This document sticks with holonomic cases.
The Procedure
To solve a mechanics problem by the Lagrangian method:
- Identify the degrees of freedom and choose generalized coordinates
- Write and in terms of the and
- Form the Lagrangian
- Apply the Euler-Lagrange equation for each
- Solve the resulting ODEs
The art is mainly in step 1. Steps 2-5 are mechanical.
6. Worked Examples
Nothing replaces doing these. I’ll work four in full detail.
Example 1: Simple Pendulum
A mass on a massless rigid rod of length , swinging in a vertical plane.
Step 1: Choose coordinate. One degree of freedom: angle from the vertical.
Step 2: Kinetic and potential energies. The mass moves on a circle of radius :
Height above lowest point: , so:
Step 3: Lagrangian.
Step 4: Euler-Lagrange.
The pendulum equation. For small angles, and you recover simple harmonic motion at .
What didn’t we need? The tension in the rod. It never appeared. By choosing as our coordinate, we built the constraint into the description and bypassed the constraint force entirely.
Example 2: Atwood Machine
Two masses and connected by a string over a frictionless pulley, under gravity.
Step 1: Coordinate. One degree of freedom. Let be the height of below the pulley. Then is at height below the pulley, where is the total string length (a constant).
Step 2: Energies.
(Both masses have speed because the string is inextensible.)
(Measuring potential from the pulley’s level, with downward as positive.)
Step 3: Lagrangian.
The constant doesn’t affect equations of motion.
Step 4: Euler-Lagrange.
The standard Atwood result; and notice how the tension never appeared.
Example 3: Bead on a Rotating Hoop
A bead of mass slides without friction on a hoop of radius rotating about a vertical diameter at constant angular velocity .
Step 1: Coordinate. Let be the angle of the bead from the bottom of the hoop.
Step 2: Energies.
Position:
Velocities (squared, summed):
So:
Step 3: Lagrangian.
Step 4: Euler-Lagrange.
Equation of motion:
Interpretation. There’s an equilibrium at (bottom). If , there’s also an equilibrium at ; the bead settles at a nonzero angle because centrifugal effects push it out. The equilibrium becomes unstable above this critical rotation speed. This is a pitchfork bifurcation; a genuine structural change in the dynamics.
Doing this problem with Newton’s laws requires juggling fictitious forces in rotating frames, keeping track of the normal force from the hoop, and carefully decomposing vectors. Lagrangian mechanics handed us the answer in four lines.
Example 4: Double Pendulum
Two pendulums: mass on rod of length from the ceiling, mass on rod of length from . Angles from vertical: and .
Positions:
Velocities squared:
(Cross term from the chain rule on the product of two cosines and two sines; trig identity collapses it.)
Lagrangian:
Euler-Lagrange equations for and are messy but straightforward; two coupled second-order nonlinear ODEs. Writing them out:
This is the entry point to chaos: the double pendulum is a canonical example of deterministic chaos in classical mechanics. Writing the equations by Newtonian methods is a nightmare of tensions and pivot forces; Lagrangian mechanics gets you to this point mechanically.
7. Symmetries and Noether’s Theorem
Here the Lagrangian formulation delivers something that would be almost miraculous in Newtonian mechanics: a precise, constructive connection between symmetries and conservation laws.
The Statement
Noether’s theorem (1918): Every continuous symmetry of the action corresponds to a conserved quantity.
More precisely: if the action is invariant under a continuous family of transformations parametrized by , then there is a quantity such that on the equations of motion.
The Proof Sketch
Consider a transformation that leaves invariant: .
Expand:
Use the Euler-Lagrange equation on the first term: . And . Then:
So the conserved quantity is:
Clean, constructive, and powerful.
Example: Translation Invariance → Momentum
If is invariant under (uniform shifts in space), then and
is conserved. Translation invariance → momentum conservation.
Example: Rotation Invariance → Angular Momentum
If is invariant under rotations about the -axis (), then with the -component of motion we get and
For a particle in spherical coordinates, , the -component of angular momentum. Rotation invariance → angular momentum conservation.
Example: Time Invariance → Energy
Time translation is slightly different (it’s a symmetry of the action as a whole, not the Lagrangian in isolation) but by a similar argument, if doesn’t explicitly depend on , the quantity
is conserved. This is the Hamiltonian (section 8), and it equals the total energy for typical systems. Time-translation invariance → energy conservation.
Why This Matters
Noether’s theorem is the bridge from abstract symmetries to physical conservation laws. It’s used constantly; you identify a symmetry, you immediately know there’s a conserved quantity, you use conservation to simplify. The procedure works the same in every formulation of physics from classical mechanics to quantum field theory. In fact, Noether’s theorem is arguably more important in QFT than in classical mechanics, because it’s how conserved currents (like electric current, baryon number, etc.) arise from the symmetries of the Standard Model.
8. The Hamiltonian Formulation
The Lagrangian treats and as the fundamental variables. The Hamiltonian treats and instead. This change of variables, called a Legendre transform, has far-reaching consequences; including providing the natural starting point for quantum mechanics.
The Legendre Transform
Starting from , define:
Solve for in terms of (requires this to be invertible; usually the case). Define the Hamiltonian:
where is understood as its expression in terms of and .
The Hamiltonian Is (Usually) the Energy
For a Lagrangian where is quadratic in velocities and depends only on coordinates:
Then and . So . The Hamiltonian is the total energy.
Hamilton’s Equations
Varying with respect to and yields two first-order equations of motion per degree of freedom:
Note the symmetry and the crucial minus sign. These are Hamilton’s equations, equivalent to the Euler-Lagrange equations but arranged as first-order equations rather than second-order ones.
Derivation
From , take the total differential:
The second and fourth terms on the right cancel (since ). Using the Euler-Lagrange equation, :
Comparing with yields Hamilton’s equations. Also: .
Simple Example
For a 1D particle in a potential, :
Kinetic plus potential energy, as expected. Hamilton’s equations:
The first is the definition of momentum; the second is Newton’s law.
9. Phase Space and Poisson Brackets
Phase Space
A system with degrees of freedom has coordinates and conjugate momenta . Together they form a -dimensional phase space. A point in phase space specifies the complete instantaneous state of the system; Hamilton’s equations describe how that point moves over time, tracing out a trajectory.
This geometric picture is useful. Phase space trajectories never cross (consequences of determinism). Closed orbits represent periodic motion. Chaotic systems have trajectories that fill out regions of phase space.
Liouville’s Theorem
The “flow” of phase-space points generated by Hamilton’s equations is volume-preserving: a region of phase space has the same volume at all later times as it did initially. This is Liouville’s theorem, and it is the classical precursor to the conservation of probability in quantum mechanics.
Poisson Brackets
For any two functions and on phase space, define the Poisson bracket:
Fundamental Brackets
These are the canonical commutation relations of classical mechanics.
Time Evolution in Bracket Form
For any function on phase space:
Compact and elegant: time evolution is generated by the Hamiltonian via the Poisson bracket. If has no explicit time dependence and , then is conserved.
The Bridge to Quantum Mechanics
Here is the single most important fact in all of this document.
Dirac’s rule: to go from classical mechanics to quantum mechanics, replace classical observables with operators and Poisson brackets with commutators:
Canonical commutation relations follow instantly:
And the Heisenberg equation of motion in quantum mechanics,
is just the quantum version of the classical bracket equation.
This is what “quantization” means, in operational terms. Classical Hamiltonian mechanics is structurally isomorphic to quantum mechanics via this substitution. Learning Hamiltonian mechanics deeply is learning the skeleton of quantum mechanics.
10. Canonical Transformations
Hamilton’s equations have a beautiful property: they’re preserved by a large class of coordinate changes on phase space, called canonical transformations.
The Question
Suppose we switch from to new variables . When do Hamilton’s equations retain their form in the new variables? That is, when does there exist a new Hamiltonian such that
The Answer
is canonical iff the Poisson brackets are preserved:
(Brackets computed with the original .)
Generating Functions
Canonical transformations can be generated by a generating function . Four types exist depending on which variables depends on. For example, for :
This is quite abstract at first encounter, but useful for finding integrals of motion and for certain advanced techniques.
Why This Matters
Canonical transformations are the classical analog of unitary transformations in quantum mechanics. A unitary transformation preserves inner products and commutation relations; a canonical transformation preserves symplectic structure and Poisson brackets. Many of the formal properties of quantum mechanics are direct quantizations of corresponding classical properties.
11. Hamilton-Jacobi Theory (Brief)
Hamilton-Jacobi theory is a very different reformulation: instead of looking at trajectories, you look at the action as a function of the endpoint. This is the classical precursor to the Schrödinger equation and the path integral.
Hamilton’s Principal Function
Define as the action along the classical trajectory from some fixed starting point to . Then satisfies the Hamilton-Jacobi equation:
This is a first-order partial differential equation for . Solving it gives a complete description of the dynamics.
The Quantum Connection
The Hamilton-Jacobi equation is the classical limit of the Schrödinger equation. Writing in the Schrödinger equation and taking recovers the HJ equation at leading order. This is the WKB approximation; tunneling probabilities can be computed this way, and it’s how semiclassical methods bridge classical and quantum physics.
In the path integral formulation of quantum mechanics, quantum amplitudes are sums of over all paths. The classical path (which extremizes ) gets enhanced by constructive interference of nearby paths, giving classical mechanics in the limit. Hamilton-Jacobi theory, variational mechanics, and the path integral are deeply linked.
12. Classical Field Theory; The Bridge to QFT
Here we make the critical transition. Every concept so far has been for a finite number of degrees of freedom (particles with coordinates ). To describe fields; electromagnetism, the Higgs field, quark fields; we need infinitely many degrees of freedom, one per point of space.
From Particles to Fields
A particle has coordinate : one number per moment of time. A field has coordinate : one number per spacetime point. You can think of a field as a continuous collection of “coordinates,” one for each point in space, evolving in time.
The Action for a Field
Instead of , a field theory has a Lagrangian density . The action is an integral over all of spacetime:
Here comprises time and space derivatives, indexed by .
The Euler-Lagrange Equation for Fields
Applying the variational principle to with respect to small variations that vanish on the boundary of the integration region yields:
This is the Euler-Lagrange equation for fields. Same structure as before, now with a sum over (implied by Einstein convention) instead of a time derivative alone.
Example: The Klein-Gordon Field
The Lagrangian density for a free scalar field of mass :
(Indices are raised and lowered with the Minkowski metric .)
Applying the field Euler-Lagrange equation:
So:
This is the Klein-Gordon equation; the relativistic wave equation for a spin-0 field. It’s the starting point of quantum field theory.
Example: The Electromagnetic Field
Define the field strength tensor , where is the four-potential. The Lagrangian density:
The first term is the free-field part; the second couples the field to a source current . The field Euler-Lagrange equation yields:
These are Maxwell’s equations in covariant form. The other two Maxwell equations follow automatically from the definition of as an antisymmetric combination of derivatives.
In four lines of formalism we’ve derived the whole of classical electromagnetism from a single Lagrangian. This is the power of field theory.
The Hamiltonian Density
Analogous to particle mechanics, define the canonical momentum density:
and Hamiltonian density:
The total Hamiltonian is
and Hamilton’s equations generalize to field form.
Canonical Quantization of Fields
The classical fields and get promoted to operators satisfying:
A direct generalization of . This single step; promoting fields to operators; is the heart of quantum field theory. Everything else (particle creation/annihilation operators, Feynman rules, renormalization) is consequence and technique built on this foundation.
This is why you needed Lagrangian mechanics before QFT. Quantum field theory is the canonical quantization of classical field theory, which is the Lagrangian formalism extended to fields. Without the Lagrangian foundation, QFT looks like arbitrary rules; with it, QFT is the natural next step.
13. Noether’s Theorem for Fields
Noether’s theorem extends gracefully to field theory; and becomes even more important, because it’s how we identify conserved charges in the Standard Model.
Conserved Currents
For each continuous symmetry of the action (with possibly depending on ), there is a conserved current:
satisfying the continuity equation:
The corresponding conserved charge is the spatial integral of the time component:
Then as a consequence of the continuity equation.
Example: Spacetime Symmetries
Translation invariance in direction gives a conserved current ; the stress-energy tensor. Its components are:
- = energy density
- = momentum density
- = stress (momentum flux)
The conserved charges are total energy (from time translation) and total momentum (from space translations). Just as Noether predicted.
Lorentz invariance gives six more conserved quantities; three from rotations (angular momentum) and three from boosts (center-of-mass motion).
Example: Internal Symmetries
Consider a complex scalar field with Lagrangian
This is invariant under the global phase transformation (a symmetry). The Noether current is:
and the conserved charge is what we call electric charge (up to a proportionality constant).
Gauge Symmetries
If we promote the global symmetry to a local (spacetime-dependent) symmetry; called gauging; the theory must be extended by introducing a new field that transforms in a compensating way. For , this new field is the electromagnetic potential , and the full theory is QED. Gauging gives electroweak theory; gauging gives QCD.
The entire Standard Model is constructed by gauging the internal symmetries of a Lagrangian. This is what is meant by “the Standard Model is a gauge theory.” Lagrangian mechanics is not just a prerequisite; it’s the language in which particle physics is written.
The Chain of Conservation Laws in the Standard Model
- Global of QED → electric charge conservation (exact)
- Global of baryon number (accidental, not gauged) → baryon conservation (very accurate)
- gauge symmetry → color conservation (exact)
- Weak isospin → weak charge conservation (broken by Higgs)
Every one of these emerges from Noether’s theorem applied to a symmetry of the Standard Model Lagrangian.
Appendix: Conventions and Identities
Variational Notation
- is a variation of the trajectory at fixed time
- to first order in
- Euler-Lagrange equations follow from for arbitrary vanishing at endpoints
Index Conventions
- Greek indices run over spacetime: 0, 1, 2, 3
- Latin indices run over space: 1, 2, 3
- Einstein summation: repeated indices (one up, one down) are summed
- Metric (particle physics convention)
- Raise/lower: ,
Key Formulas Summary
Particle mechanics:
| Concept | Formula |
|---|---|
| Lagrangian | |
| Action | |
| Euler-Lagrange | |
| Canonical momentum | |
| Hamiltonian | |
| Hamilton’s equations | , |
| Poisson bracket | |
| Time evolution | |
| Noether charge | (for symmetry ) |
Field theory:
| Concept | Formula |
|---|---|
| Lagrangian density | |
| Action | |
| Euler-Lagrange (field) | |
| Canonical momentum density | |
| Hamiltonian density | |
| Noether current | |
| Continuity | |
| Noether charge |
Important Lagrangians
Free non-relativistic particle:
Non-relativistic particle in a potential:
Free relativistic particle:
Charged particle in EM field:
Free scalar field (Klein-Gordon):
Free electromagnetic field (Maxwell):
QED Lagrangian:
where is the gauge-covariant derivative. The entirety of QED sits in this one-line expression. Unpacking it is most of the content of a QFT course.
Closing Note
Lagrangian and Hamiltonian mechanics are, in a sense, too good to be “just classical mechanics.” What looked like a clever reformulation in the hands of Lagrange and Hamilton has turned out to be the deep structure of physics. Every fundamental theory is written in Lagrangian form. Every quantization procedure relies on the Hamiltonian or Lagrangian. Every conservation law in the Standard Model is a Noether current.
You now have:
- The variational foundation of classical mechanics
- Lagrangian and Hamiltonian formulations as dual descriptions
- Poisson brackets as the classical skeleton of quantum mechanics
- Noether’s theorem as the engine connecting symmetries to conservation laws
- Classical field theory as the bridge to QFT
- Enough of the formal vocabulary to open a quantum field theory textbook
The natural next steps are:
-
Work problems. Pick up Taylor’s Classical Mechanics or Goldstein’s Classical Mechanics and solve problems until the formalism feels natural. This is genuinely the prerequisite for everything that follows.
-
Study special relativity in covariant form. Reproduce Maxwell’s equations from the electromagnetic Lagrangian. Get comfortable with index gymnastics.
-
Learn the Dirac equation. The relativistic wave equation for spin-½ particles. This is where antimatter falls out as a mathematical inevitability.
-
Begin quantum field theory proper. Peskin & Schroeder is the standard; Srednicki and Schwartz are alternatives with different emphases.
Whenever you’re ready, we can continue with any of these. You now have the classical foundation the rest of the edifice rests on.