---
title: "The Hamiltonian, Phase Space and the Canonical Equations"
description: "Trading velocities for momenta turns one second-order equation per coordinate into two first-order ones, and makes phase space the natural arena. An autonomous Hamiltonian is conserved along the motio"
canonical: https://lightmysky.com/learn/science/the-hamiltonian-phase-space-and-the-canonical-equations-mt_9bMDXQiq_n
source: https://lightmysky.com/learn/science/the-hamiltonian-phase-space-and-the-canonical-equations-mt_9bMDXQiq_n.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# The Hamiltonian, Phase Space and the Canonical Equations

Trading velocities for momenta turns one second-order equation per coordinate into two first-order ones, and makes phase space the natural arena. An autonomous Hamiltonian is conserved along the motion, and it equals the physical energy T + V for ordinary time-independent coordinates with a natural Lagrangian.

Subject: Science · Area: Forces & Motion · Ages 22 to 23
Page: https://lightmysky.com/learn/science/the-hamiltonian-phase-space-and-the-canonical-equations-mt_9bMDXQiq_n

## Ready when they can

- Constructs a Hamiltonian from a Lagrangian and identifies the conjugate momenta
- Writes and solves the canonical equations for a simple system
- Sketches a phase-space trajectory and reads the motion off it

## Lesson: Trading velocity for momentum

You start from a Lagrangian L(x, v, t). Define the conjugate momentum p = ∂L/∂v. Assume the map from v to p is invertible, so v can be solved in terms of x, p, and t; this holds for the regular Lagrangians met here, where ∂²L/∂v² is nonzero. The Hamiltonian is the Legendre transform H(x, p, t) = p v − L, with v replaced by its solved form. That one trade turns a single second-order equation into two first-order ones: ẋ = ∂H/∂p and ṗ = −∂H/∂x.

**Example.** For m ẍ = −k x, the Lagrangian is L = ½mv² − ½kx². The momentum is p = ∂L/∂v = mv, which inverts to v = p/m. Substitute into H = p v − L: H = p(p/m) − (½m(p/m)² − ½kx²) = p²/(2m) + ½kx². The canonical pair is ẋ = ∂H/∂p = p/m and ṗ = −∂H/∂x = −kx.

**Example.** With m, k > 0 and ω = √(k/m), solutions are x(t) = x₀ cos(ωt) + (p₀/(mω)) sin(ωt) and p(t) = p₀ cos(ωt) − mω x₀ sin(ωt), with x₀, p₀ initial. H carries no explicit t, so along the motion it stays fixed at the energy E. Check: ẋ = p/m and ṗ = −mω²x = −kx, and at t = 0 the formulas give x₀ and p₀.

*(drawing: Define momentum, solve for velocity, form H = p v − L, then read the canonical equations.)*

With x horizontal and p vertical, for m, k > 0 the Hamiltonian is H = p²/(2m) + ½kx². The level set p²/(2m) + ½kx² = E is an ellipse whenever E > 0, and the single point (0,0) when E = 0. A bigger loop means a larger E, provided both systems share the same m, k, and axes. Where p is positive, ẋ = p/m is positive, so the state point drifts rightward across the upper half; with x > 0 there, ṗ = −kx is negative and the motion is down and to the right, while with x < 0 it is up and to the right.

Whenever H carries no explicit time dependence, Hamilton's equations keep its value constant along the motion, so H is conserved. It equals the physical energy T + V for ordinary time-independent coordinates with a natural Lagrangian, where T is homogeneous quadratic in the rates and V is rate-independent; with velocity-dependent potentials or time-dependent coordinate maps, H and T + V can differ. Build p first, then form H from x and p, and check that no stray t sits inside H. If H itself depends on t, the value is free to drift.

**Recap.** Trade velocity for momentum, form H = p v − L, step two first-order equations, and read the energy off the phase loop.

## Practice

14 questions on this page, each with its working shown.

## Needs first

- [Hamilton's Principle and the Action](https://lightmysky.com/learn/science/hamiltons-principle-and-the-action-mt_a273REeeGu)

## Optional connections

- [Phase Portraits, Equilibria and Stability](https://lightmysky.com/learn/mathematics/phase-portraits-equilibria-and-stability-mt_ULuZk4lmGr)

## Opens up

- [Poisson Brackets and Constants of the Motion](https://lightmysky.com/learn/science/poisson-brackets-and-constants-of-the-motion-mt_UFzJyZRdOI)
