The Hamiltonian: A Restatement of Mechanics
The Lagrangian lives in configuration space. L(q, \dot{q}, t). You feed it positions and velocities, it spits out equations of motion. Elegant, sure. But there is a different way to think about mechanics — one that rewrites everything in terms of positions and momenta instead. This is the Hamiltonian formalism.
The Legendre transform is the door. Given a Lagrangian L(q, \dot{q}, t), define the canonical momentum:
p_i = \frac{\partial L}{\partial \dot{q}_i}
This is not a suggestion. It's a definition. The momentum is what the Lagrangian tells you momentum is. In simple cases, p = m\dot{q}. In complex ones — generalized coordinates, curved spaces, constraints — the momentum can look nothing like mv. That's fine. The formalism handles it.
Now define the Hamiltonian:
H(q, p, t) = \sum_i p_i \dot{q}_i - L(q, \dot{q}, t)
But wait — H must be a function of q and p, not q and \dot{q}. So you solve the momentum definition for \dot{q}(q, p) and substitute. The velocities are eliminated. What remains is H in the natural variables: positions and momenta.
In most physical systems, H is the total energy. H = T + V. The kinetic energy expressed in terms of momenta, plus the potential energy expressed in terms of positions. This is not always true — there are exotic Lagrangians where H differs from T + V — but for the vast majority of systems you'll encounter, H is the energy function. And that fact makes the Hamiltonian physically meaningful in a way the Lagrangian sometimes isn't.
The Hamilton equations follow:
\dot{q}_i = \frac{\partial H}{\partial p_i}
\dot{p}_i = -\frac{\partial H}{\partial q_i}
They are 2n first-order equations, where n is the number of degrees of freedom. Compare this to the single second-order Euler-Lagrange equation per degree of freedom. The Hamiltonian form doubles the equations but halves the derivatives. This trade-off is not gratuitous. First-order equations are structurally different beasts. They open the door to phase space, to conservation theorems, to quantization.
Phase space is the space of all (q, p) pairs. For a single particle in three dimensions, it's six-dimensional. Every point in phase space represents a complete state of the system — all positions and all momenta specified simultaneously. The system's evolution traces a trajectory through this space. This geometric picture replaces the more abstract notion of a path in configuration space.
The symmetry between q and p in Hamilton's equations is striking. \dot{q} comes from differentiating H with respect to p. \dot{p} comes from differentiating H with respect to q (with a minus sign). This symmetry is not cosmetic — it's the reason the Hamiltonian formalism is the natural bridge to quantum mechanics. In quantum mechanics, q and p become operators with the commutation relation [q, p] = i\hbar. The classical Poisson bracket {q, p} = 1 is the direct precursor. You cannot get this insight from the Lagrangian formulation.
Another gift of the Hamiltonian approach: Noether's theorem still works, but the bookkeeping is cleaner. Symmetries in q translate directly to conserved momenta. If H does not depend on q_i (q_i is cyclic), then \dot{p}_i = 0 and p_i is conserved. The connection between symmetry and conservation is immediate and algebraic rather than variational.
Separable Hamiltonians lead to Hamilton-Jacobi theory, which transforms mechanics into a single partial differential equation for a function S(q, t). The solution S is called the action, and its gradients give the canonical momenta. This is the most powerful formalism in classical mechanics — and it only exists because the Hamiltonian framework re-expressed the problem in the right variables.
The Hamiltonian is not just a reformulation. It is a different lens. And through that lens, you see structures that were invisible before: the geometry of phase space, the algebra of Poisson brackets, the path from classical to quantum. It rewrites mechanics in terms of positions and momenta, yes, but it also rewrites your understanding of what mechanics is about.