Hamilton's Principal Function

Every formalism of mechanics has a central character. The Lagrangian picture has the action functional — a number assigned to every conceivable path. Hamilton's discovery of 1834 was that if you stop varying over all paths and instead evaluate the action only along the true one, regarding the result as a function of where and when the path ends, that single scalar function knows everything. Its gradient is the momentum. Its time derivative is minus the energy. Choose the endpoint differently and it hands you the trajectory itself. This on-shell action, written S(q,α,t)S(q,\alpha,t), is Hamilton's principal function — the protagonist of Hamilton-Jacobi theory. The same object wears a second costume. Viewed through canonical-transformation theory, SS is the type-2 generating function that drives the new Hamiltonian to zero, freezing all new coordinates and momenta into constants; the demand that it accomplish this is precisely the Hamilton-Jacobi equation. The two costumes are the same body: the variational identities ∂S/∂qi=pi\partial S/\partial q_i=p_i and ∂S/∂t=−H\partial S/\partial t=-H, derived by nothing more than endpoint variation, are the Hamilton-Jacobi equation once you substitute one into the other. This article is about SS itself: what it is, why dS/dt=L\mathrm{d}S/\mathrm{d}t=L along the motion, how the two-endpoint version generates time evolution as a canonical map, and how to compute it explicitly — including the oscillator formula that, a century later, Feynman placed in the exponent of the quantum propagator. The equation it satisfies has its own article; here we get to know the function.

Key takeaways
  • Hamilton's principal function S(q,α,t)S(q,\alpha,t) is the type-2 generating function that maps the Hamiltonian to zero, making every new coordinate and momentum a constant; the condition on it is the Hamilton-Jacobi equation.
  • Physically, SS is the classical action ∫L dt\int L\,\mathrm{d}t evaluated along the true path, regarded as a function of the endpoint: hence dS/dt=L\mathrm{d}S/\mathrm{d}t=L on the motion.
  • Endpoint variation gives its two defining derivatives: ∂S/∂qi=pi\partial S/\partial q_i=p_i (gradient = momentum) and ∂S/∂t=−H\partial S/\partial t=-H (time slope = minus energy).
  • The two-point version S(q,t;q0,t0)S(q,t;q_0,t_0) is the generating function of time evolution itself: p=∂S/∂qp=\partial S/\partial q, p0=−∂S/∂q0p_0=-\partial S/\partial q_0 package the flow map as a canonical transformation.
  • The trajectory is extracted algebraically from a complete integral via βi=∂S/∂αi=const\beta_i=\partial S/\partial\alpha_i=\text{const}; for conservative systems S=W(q,α)−EtS=W(q,\alpha)-Et hands off to the characteristic function.
  • Key idea: choose a canonical transformation whose generating function S(q,α,t)S(q,\alpha,t) drives the new Hamiltonian to zero; then the new variables are constants and the entire motion is encoded in SS, the on-shell action, with p=∂S/∂qp=\partial S/\partial q and ∂S/∂α=const\partial S/\partial\alpha=\text{const}.

Where this lives today

The two-point principal function is quietly one of the most-computed objects in modern physics: it is the exponent of the semiclassical propagator K(q,t;q0,t0)∝eiS(q,t;q0,t0)/ℏK(q,t;q_0,t_0)\propto e^{iS(q,t;q_0,t_0)/\hbar}. Every semiclassical simulation of molecular dynamics, every WKB tunneling-rate estimate in chemistry, and the entire trajectory-based description of attosecond ionization experiments amounts to evaluating Hamilton's function along classical paths and interfering the phases. The oscillator formula derived above is not a museum piece — because quadratic actions exponentiate exactly, it is the analytic core of Gaussian-beam propagation, of the thermal harmonic propagator in path-integral molecular dynamics, and of every "harmonic approximation about the instanton" rate calculation run in 2026. The other modern life of SS is as a value function. Optimal-control theory's cost-to-go — the object every model-predictive controller and reinforcement-learning agent tries to know — satisfies the Hamilton-Jacobi-Bellman equation and inherits the identities of this article: its gradient is the costate (momentum), its time slope minus the optimal Hamiltonian. When a 2026 legged robot plans a jump by differentiating a learned value landscape, it is running Hamilton's 1834 program with a neural network as the complete integral.

The physical picture

Imagine a taxi meter wired to the Lagrangian. As the system rides its true trajectory, the meter accumulates ∫L dt\int L\,\mathrm{d}t — kinetic minus potential energy, second by second. Hamilton's principal function is the meter reading as a function of the destination: deliver the system to configuration qq at time tt, and S(q,t)S(q,t) is the fare. The two fundamental identities of the subject say the fare is exquisitely informative about the journey's end: move the drop-off point and the fare changes at the rate pp (the arriving momentum); delay the drop-off and it changes at the rate −H-H (minus the arriving energy).

Figure
The action meter — S is the accumulated Lagrangian along the true path, read as a function of the endpoint
t q (q₀, t₀) (q, t) other paths — not taken, not counted ∂S/∂q = p ∂S/∂t = −H S = ∫ L dt accumulates along the true path one scalar function of the endpoint; its two slopes are the momentum and minus the energy of arrival

The second picture explains the constants. A complete integral S(q,α,t)S(q,\alpha,t) is not one function but an nn-parameter family of action landscapes, labeled by α1,…,αn\alpha_1,\dots,\alpha_n. Each label choice corresponds to a different bundle of trajectories (a different initial-momentum profile); differentiating with respect to a label and freezing the result, βi=∂S/∂αi\beta_i=\partial S/\partial\alpha_i, pins you onto exactly one trajectory of the family. The pair (α,β)(\alpha,\beta) is your initial-condition data in Hamilton-Jacobi packaging — and the frozen coordinates of the transformed, motionless phase space:

Figure
A complete integral is a family of action landscapes — fixing the label derivative selects one trajectory
t q α′, β₁ α′, β₂ α, β ✱ α, β₃ β = ∂S/∂α pins one member the α's label which action landscape you ride; the β's label which trajectory within it — 2n constants, all explicit

Hold on to the taxi-meter image through the algebra below: SS simultaneously remembers how much action the journey cost and how the journey ends — one scalar carrying both.

The core identities

Everything about SS flows from its behavior under endpoint variation, so we state the two central identities first. For the on-shell action ending at (q,t)(q,t),

pi=∂S∂qi,∂S∂t=−H(1)p_i=\frac{\partial S}{\partial q_i},\qquad \frac{\partial S}{\partial t}=-H \qquad (1)

where: pip_i — the momentum with which the trajectory arrives at the endpoint; HH — the energy there. These are proven by the variational derivation below, and they immediately deliver the governing PDE: substituting the first identity into the second gives ∂tS+H(q,∂S/∂q,t)=0\partial_t S+H(q,\partial S/\partial q,t)=0 — the Hamilton-Jacobi equation, whose theory (complete integrals, Jacobi's theorem, solution technique) lives in its own article. Here the point is the origin of the equation: it is nothing but "gradient = momentum" and "time slope = minus energy" said simultaneously. Along the actual motion, the two identities combine into the statement that started this article — the meter runs at the rate of the Lagrangian:

dSdt=∂S∂t+∑i∂S∂qi q˙i=−H+∑ipiq˙i=L(2)\frac{\mathrm{d}S}{\mathrm{d}t}=\frac{\partial S}{\partial t}+\sum_i\frac{\partial S}{\partial q_i}\,\dot q_i=-H+\sum_i p_i\dot q_i=L \qquad (2)

where: L=∑ipiq˙i−HL=\sum_i p_i\dot q_i-H — the Legendre transform run backwards. Integrating along the path recovers the definition: S=∫t0tL dt′+constS=\int_{t_0}^{t}L\,\mathrm{d}t'+\text{const}. Notice what this equation does not say: SS is not the action of arbitrary paths, only of true ones — the endpoint function is defined on-shell. As a generating function, SS appears with the constants as its second argument. A complete integral

S=S(q1,…,qn,α1,…,αn,t),det⁡ ⁣(∂2S∂qi ∂αj)≠0(3)S=S(q_1,\dots,q_n,\alpha_1,\dots,\alpha_n,t),\qquad \det\!\left(\frac{\partial^2 S}{\partial q_i\,\partial\alpha_j}\right)\neq0 \qquad (3)

where: αi\alpha_i — the new (constant) momenta; the determinant condition guarantees the family is genuinely nn-parameter. It generates the dynamics through

pi=∂S∂qi,βi=∂S∂αi=const(4)p_i=\frac{\partial S}{\partial q_i},\qquad \beta_i=\frac{\partial S}{\partial\alpha_i}=\text{const} \qquad (4)

where: βi\beta_i — the new (constant) coordinates. The first relation reads the momentum field off the action landscape; the second, inverted for q(t)q(t), is the trajectory. For conservative systems the time dependence factors out, S(q,α,t)=W(q,α)−EtS(q,\alpha,t)=W(q,\alpha)-Et, where WW is Hamilton's characteristic function with its own article; every property of SS below survives the split.

Which equation answers which question

you wantusenotes
momentum at the endpointpi=∂S/∂qip_i=\partial S/\partial q_i, eq. (1)gradient of the action landscape
energy at the endpointH=−∂S/∂tH=-\partial S/\partial t, eq. (1)the two identities together = HJ equation
rate of accumulationdS/dt=L\mathrm{d}S/\mathrm{d}t=L, eq. (2)on the true path only
the trajectoryinvert βi=∂S/∂αi\beta_i=\partial S/\partial\alpha_i, eq. (4)needs the non-degeneracy in (3)
initial momentum from a two-point SSp0=−∂S/∂q0p_0=-\partial S/\partial q_0flow map as canonical transformation (derivation below)
conservative shortcutS=W(q,α)−EtS=W(q,\alpha)-Ethands off to the characteristic function
Derivation AEndpoint variation — the gradient is momentum and the time slope is minus energy

We derive both identities of equation (1) by varying the on-shell action with respect to its endpoint. The strategy: write the first variation of ∫L dt\int L\,\mathrm{d}t with free upper endpoint, kill the bulk term with the equations of motion, and read off the boundary term; then repeat with a varied arrival time. The subtle step is the time variation — moving the arrival time also moves the arrival point along the path, and forgetting that cross term is the classic way to lose the −H-H and get −L-L instead.

Step 1. Let S(q,t)=∫t0tL(q(t′),q˙(t′),t′) dt′S(q,t)=\int_{t_0}^{t}L(q(t'),\dot q(t'),t')\,\mathrm{d}t' along the true path arriving at qq at time tt, with the initial data fixed. Vary the arrival point q→q+δqq\to q+\delta q at fixed tt; the whole path adjusts to a neighboring true path. The standard first-variation formula gives

δS=[∂L∂q˙i δqi]t0t+∫t0t(∂L∂qi−ddt′∂L∂q˙i)δqi dt′\delta S=\left[\frac{\partial L}{\partial\dot q_i}\,\delta q_i\right]_{t_0}^{t}+\int_{t_0}^{t}\left(\frac{\partial L}{\partial q_i}-\frac{\mathrm{d}}{\mathrm{d}t'}\frac{\partial L}{\partial\dot q_i}\right)\delta q_i\,\mathrm{d}t'

Step 2. The bulk integral vanishes because the comparison paths are true paths — they satisfy Euler-Lagrange. The lower boundary term vanishes because the initial data are held fixed. What survives is the upper boundary:

δS=∂L∂q˙i∣t δqi=pi δqi⟹∂S∂qi=pi\delta S=\frac{\partial L}{\partial\dot q_i}\bigg|_{t}\,\delta q_i=p_i\,\delta q_i \qquad\Longrightarrow\qquad \frac{\partial S}{\partial q_i}=p_i

Why this is not circular: we used the equations of motion to kill the integral, not to define SS — the identity is a statement about how the on-shell action responds to relocating its endpoint.

Step 3. Now vary the arrival time at a fixed arrival location. Two things change: the integral gains a slice L δtL\,\delta t at the top, and the comparison path must arrive at the SAME qq at the LATER time t+δtt+\delta t — which means relative to the original path its endpoint is displaced by δqi=−q˙i δt\delta q_i=-\dot q_i\,\delta t (the original path would have moved on by q˙i δt\dot q_i\,\delta t).

δS=L δt+pi δqi=L δt−piq˙i δt\delta S=L\,\delta t+p_i\,\delta q_i=L\,\delta t-p_i\dot q_i\,\delta t

Why the cross term appears: ∂S/∂t\partial S/\partial t means "same place, later time," but the path itself flows — the endpoint correction rides on Step 2's result.

Step 4. Collect, using the Legendre transform H=∑ipiq˙i−LH=\sum_i p_i\dot q_i-L:

∂S∂t=L−∑ipiq˙i=−H\frac{\partial S}{\partial t}=L-\sum_i p_i\dot q_i=-H

Step 5. Put the two identities together: substituting pi=∂S/∂qip_i=\partial S/\partial q_i into ∂S/∂t=−H(q,p,t)\partial S/\partial t=-H(q,p,t) yields

∂S∂t+H ⁣(q,∂S∂q,t)=0\frac{\partial S}{\partial t}+H\!\left(q,\frac{\partial S}{\partial q},t\right)=0

— the on-shell action satisfies the Hamilton-Jacobi equation. The variational and canonical-transformation definitions of SS describe the same function. The sign of −H-H is confirmed by the free particle, S=αq−α22mtS=\alpha q-\frac{\alpha^2}{2m}t, whose time slope is indeed minus the energy α2/2m\alpha^2/2m.

Go deeper · Derivation B · 2 minThe two-point principal function generates time evolution itself
Derivation BThe two-point principal function generates time evolution itself

Here we meet SS in its most striking role. Fix BOTH endpoints and define S(q,t;q0,t0)S(q,t;q_0,t_0) — the action of the true path from (q0,t0)(q_0,t_0) to (q,t)(q,t). We show this function is the generating function of the canonical transformation that IS the dynamics: the flow map from initial state (q0,p0)(q_0,p_0) to evolved state (q,p)(q,p). The strategy is to run the endpoint-variation argument at both ends and read the two boundary terms; the sign difference between them is the whole content. Watch for the caveat at the end — the construction fails at conjugate points, where the two-point problem stops having a unique solution.

Step 1. Vary both endpoints of the on-shell action. The first-variation boundary term now survives at both limits:

δS=pi δqi∣t−pi δqi∣t0=pi δqi−p0i δq0i\delta S=p_i\,\delta q_i\Big|_{t}-p_i\,\delta q_i\Big|_{t_0}=p_i\,\delta q_i-p_{0i}\,\delta q_{0i}

Why the minus sign: the lower limit of the bracket in the variation formula enters with negative orientation — the same reason a potential difference is a difference.

Step 2. Read off the partial derivatives:

pi=∂S∂qi,p0i=−∂S∂q0ip_i=\frac{\partial S}{\partial q_i},\qquad p_{0i}=-\frac{\partial S}{\partial q_{0i}}

Step 3. Recognize the structure. These are exactly the defining relations of a generating function of the old-and-new-coordinates type, with (q0,p0)(q_0,p_0) as the old variables and (q,p)(q,p) as the new: given (q0,p0)(q_0,p_0), the second relation determines which trajectory (hence qq at time tt), and the first evaluates its final momentum. The map (q0,p0)↦(q,p)(q_0,p_0)\mapsto(q,p) so generated is precisely time evolution over the interval — and since it HAS a generating function, the flow is canonical, no separate proof needed. Why this matters conceptually: "motion is a canonical transformation continuously unfolding in time" — Hamilton-Jacobi theory's founding slogan — becomes literal: the generator of the unfolding is the accumulating action itself.

Step 4. Make it concrete with the free particle. The true path from (q0,0)(q_0,0) to (q,t)(q,t) has constant velocity (q−q0)/t(q-q_0)/t, so

S(q,t;q0,0)=∫0t12mq˙2 dt′=m(q−q0)22tS(q,t;q_0,0)=\int_0^t \tfrac12 m\dot q^2\,\mathrm{d}t'=\frac{m(q-q_0)^2}{2t}

Check the relations: p=∂S/∂q=m(q−q0)/tp=\partial S/\partial q=m(q-q_0)/t ✓ (mass times velocity), p0=−∂S/∂q0=m(q−q0)/tp_0=-\partial S/\partial q_0=m(q-q_0)/t ✓ (momentum conserved), and −∂S/∂t=m(q−q0)2/2t2=p2/2m=H-\partial S/\partial t=m(q-q_0)^2/2t^2=p^2/2m=H ✓.

Step 5. Note the domain of validity. The construction presumes a unique true path between the endpoints. At conjugate points — e.g. a harmonic oscillator after exactly half a period, when ALL paths from q0q_0 refocus — the two-point problem degenerates, SS develops singularities (visible as sin⁡ωt→0\sin\omega t\to0 in the oscillator formula of the next derivation), and the generating description must be restarted on the far side. These are the caustics of the mechanical "optics," and in the semiclassical world they are where Maslov phase jumps live.

Go deeper · Derivation C · 1 minComputing the principal function of the harmonic oscillator
Derivation CComputing the principal function of the harmonic oscillator

We compute the two-point principal function S(q,t;q0,0)S(q,t;q_0,0) for H=p22m+12mω2q2H=\frac{p^2}{2m}+\frac12 m\omega^2q^2 explicitly — the formula Feynman later exponentiated into the quantum propagator. The strategy is direct: write the general solution, impose both endpoints, integrate the Lagrangian along it. An integration-by-parts shortcut turns the action integral into pure boundary terms, which is what makes the computation clean; watch it, because it works for any trajectory obeying the equation of motion.

Step 1. The general solution through q(0)=q0q(0)=q_0 is q(t′)=q0cos⁡ωt′+v0ωsin⁡ωt′q(t')=q_0\cos\omega t'+\frac{v_0}{\omega}\sin\omega t'. Imposing q(t)=qq(t)=q fixes the initial velocity:

v0ω=q−q0cos⁡ωtsin⁡ωt\frac{v_0}{\omega}=\frac{q-q_0\cos\omega t}{\sin\omega t}

Why sin⁡ωt\sin\omega t in the denominator matters: at ωt=π\omega t=\pi the two-point problem has either no solution or infinitely many — the conjugate-point caveat of the previous derivation, visible in the algebra.

Step 2. Convert the action integral to boundary terms. Using L=12mq˙2−12mω2q2L=\frac12 m\dot q^2-\frac12 m\omega^2q^2 and integrating the kinetic term by parts,

∫0t12mq˙2 dt′=12m qq˙∣0t−∫0t12m qq¨ dt′\int_0^t \tfrac12 m\dot q^2\,\mathrm{d}t'=\tfrac12 m\,q\dot q\Big|_0^t-\int_0^t\tfrac12 m\,q\ddot q\,\mathrm{d}t'

On the true path q¨=−ω2q\ddot q=-\omega^2q, so the leftover integral equals +∫12mω2q2 dt′+\int\frac12 m\omega^2q^2\,\mathrm{d}t', which exactly cancels the potential term in LL:

S=m2(q q˙(t)−q0 q˙(0))S=\frac{m}{2}\left(q\,\dot q(t)-q_0\,\dot q(0)\right)

Why this shortcut is general: for any Lagrangian quadratic in its variables, the on-shell action collapses to boundary data — the reason quadratic systems have exactly computable propagators.

Step 3. Evaluate the endpoint velocities from Step 1: q˙(0)=v0=ωq−q0cos⁡ωtsin⁡ωt\dot q(0)=v_0=\omega\frac{q-q_0\cos\omega t}{\sin\omega t} and, by the time-reversal symmetry of the two-point problem, q˙(t)=ωqcos⁡ωt−q0sin⁡ωt\dot q(t)=\omega\frac{q\cos\omega t-q_0}{\sin\omega t}.

Step 4. Substitute and simplify:

S(q,t;q0,0)=mω2sin⁡ωt[(q2+q02)cos⁡ωt−2 q q0]S(q,t;q_0,0)=\frac{m\omega}{2\sin\omega t}\Big[(q^2+q_0^2)\cos\omega t-2\,q\,q_0\Big]

Step 5. Run the checks. As ω→0\omega\to0, expand cos⁡ωt≈1\cos\omega t\approx1, sin⁡ωt≈ωt\sin\omega t\approx\omega t: S→m2t[(q2+q02)−2qq0]=m(q−q0)22tS\to\frac{m}{2t}[(q^2+q_0^2)-2qq_0]=\frac{m(q-q_0)^2}{2t} — the free particle ✓. The generating relations give p=∂S/∂q=mωsin⁡ωt(qcos⁡ωt−q0)=mq˙(t)p=\partial S/\partial q=\frac{m\omega}{\sin\omega t}(q\cos\omega t-q_0)=m\dot q(t) ✓ and p0=−∂S/∂q0=mωsin⁡ωt(q−q0cos⁡ωt)=mv0p_0=-\partial S/\partial q_0=\frac{m\omega}{\sin\omega t}(q-q_0\cos\omega t)=m v_0 ✓. Both limiting checks close — the free-particle limit and the generating relations — and the sin⁡ωt\sin\omega t singularities sit exactly at the conjugate times ωt=nπ\omega t=n\pi.

Limiting cases

CaseResultMeaning
conservative systemS(q,α,t)=W(q,α)−EtS(q,\alpha,t)=W(q,\alpha)-Ettime separates; WW is Hamilton's characteristic function, EE one of the α\alpha's
free particle (1D)S=αq−α22mtS=\alpha q-\frac{\alpha^2}{2m}tα=p\alpha=p constant; β=∂S/∂α\beta=\partial S/\partial\alpha gives q=β+(α/m)tq=\beta+(\alpha/m)t — uniform motion by algebra
two-point, ω→0\omega\to0S→m(q−q0)22tS\to\frac{m(q-q_0)^2}{2t}oscillator principal function degrades gracefully to the free particle
conjugate points, ωt→nπ\omega t\to n\piS→∞S\to\infty (via sin⁡ωt→0\sin\omega t\to0)two-point problem degenerates — the caustics of mechanical optics
eikonal limit of QMψ∼eiS/ℏ\psi\sim e^{iS/\hbar}, ℏ→0\hbar\to0SS is the leading quantum phase; the semiclassical propagator is ∝eiS(q,t;q0,t0)/ℏ\propto e^{iS(q,t;q_0,t_0)/\hbar}

Worked examples

1 · Reading momenta and energy off a free-particle action (confidence builder)

A particle of mass m=1.5 kgm=1.5\ \mathrm{kg} travels from q0=0q_0=0 to q=4.0 mq=4.0\ \mathrm{m} in t=2.0 st=2.0\ \mathrm{s} (free motion). Compute the two-point principal function and verify all three derivative identities numerically.

Step 1. The two-point action of free motion is S=m(q−q0)22t=1.5×(4.0)22×2.0=6.0 J sS=\frac{m(q-q_0)^2}{2t}=\frac{1.5\times(4.0)^2}{2\times2.0}=\boxed{6.0\ \mathrm{J\,s}}.

Step 2. Final momentum: p=∂S∂q=m(q−q0)t=1.5×4.02.0=3.0 kg m/sp=\frac{\partial S}{\partial q}=\frac{m(q-q_0)}{t}=\frac{1.5\times4.0}{2.0}=3.0\ \mathrm{kg\,m/s}. Check: velocity is 4.0/2.0=2.0 m/s4.0/2.0=2.0\ \mathrm{m/s}, so p=mv=1.5×2.0=3.0p=mv=1.5\times2.0=3.0 ✓.

Step 3. Initial momentum: p0=−∂S∂q0=m(q−q0)t=3.0 kg m/sp_0=-\frac{\partial S}{\partial q_0}=\frac{m(q-q_0)}{t}=3.0\ \mathrm{kg\,m/s} — equal to pp, as momentum conservation demands ✓.

Step 4. Energy: −∂S∂t=m(q−q0)22t2=1.5×162×4.0=3.0 J-\frac{\partial S}{\partial t}=\frac{m(q-q_0)^2}{2t^2}=\frac{1.5\times16}{2\times4.0}=3.0\ \mathrm{J}. Check: H=p2/2m=9.0/3.0=3.0 JH=p^2/2m=9.0/3.0=3.0\ \mathrm{J} ✓. All three identities close on plain arithmetic — the taxi meter's slopes really are the momentum and minus the energy.

2 · The oscillator's principal function, checked against its own trajectory (exam level)

An oscillator has m=0.20 kgm=0.20\ \mathrm{kg}, ω=3.0 rad/s\omega=3.0\ \mathrm{rad/s}. A true path runs from q0=0.10 mq_0=0.10\ \mathrm{m} at t=0t=0 to q=0.05 mq=0.05\ \mathrm{m} at t=0.40 st=0.40\ \mathrm{s}. (a) Evaluate S(q,t;q0,0)S(q,t;q_0,0). (b) Extract p0p_0 from SS and verify it against the explicit trajectory. (c) Express SS as a quantum phase.

Step 1. Ingredients: ωt=1.2 rad\omega t=1.2\ \mathrm{rad}, cos⁡ωt=0.362\cos\omega t=0.362, sin⁡ωt=0.932\sin\omega t=0.932; prefactor mω2sin⁡ωt=0.20×3.02×0.932=0.322 kg/s\frac{m\omega}{2\sin\omega t}=\frac{0.20\times3.0}{2\times0.932}=0.322\ \mathrm{kg/s}.

Step 2. Bracket: (q2+q02)cos⁡ωt−2qq0=(0.0025+0.0100)×0.362−2×0.05×0.10=0.00453−0.01000=−0.00547 m2(q^2+q_0^2)\cos\omega t-2qq_0=(0.0025+0.0100)\times0.362-2\times0.05\times0.10=0.00453-0.01000=-0.00547\ \mathrm{m^2}. Hence S=0.322×(−0.00547)=−1.76×10−3 J sS=0.322\times(-0.00547)=\boxed{-1.76\times10^{-3}\ \mathrm{J\,s}}. (A negative action is perfectly legal — the potential term outweighed the kinetic one on this leg.)

Step 3. Initial momentum from the generating relation: p0=−∂S∂q0=mωsin⁡ωt(q−q0cos⁡ωt)=0.600.932×(0.05−0.10×0.362)=0.644×0.0138=8.86×10−3 kg m/sp_0=-\frac{\partial S}{\partial q_0}=\frac{m\omega}{\sin\omega t}(q-q_0\cos\omega t)=\frac{0.60}{0.932}\times(0.05-0.10\times0.362)=0.644\times0.0138=\boxed{8.86\times10^{-3}\ \mathrm{kg\,m/s}}.

Step 4. Independent check via the trajectory: q(t)=q0cos⁡ωt+p0mωsin⁡ωtq(t)=q_0\cos\omega t+\frac{p_0}{m\omega}\sin\omega t demands 0.05=0.0362+p00.60×0.9320.05=0.0362+\frac{p_0}{0.60}\times0.932, i.e. p0=0.60×0.0138/0.932=8.86×10−3 kg m/sp_0=0.60\times0.0138/0.932=8.86\times10^{-3}\ \mathrm{kg\,m/s} ✓ — the generating function and the explicit solution agree to three figures.

Step 5. As a quantum phase: S/ℏ=1.76×10−3/1.055×10−34≈1.7×1031 radS/\hbar=1.76\times10^{-3}/1.055\times10^{-34}\approx\boxed{1.7\times10^{31}\ \mathrm{rad}}. A tabletop oscillator accumulates 103110^{31} radians of quantum phase in less than half a second — the numerical face of "the classical limit is the violently oscillating-phase limit," and the reason stationary-phase selection of the classical path is so brutally effective at laboratory scales.

Origins · 1 minWilliam Rowan Hamilton and how this was discovered
WR
William Rowan Hamilton
1805–1865 · Trinity College Dublin and Dunsink Observatory

Hamilton was Astronomer Royal of Ireland at 22, before finishing his degree, and his mechanics grew out of optics. His Theory of Systems of Rays (1828) showed that an optical instrument, however complicated, is encoded in a single "characteristic function" — the optical path length between endpoints — from which every ray follows by differentiation. The two Essays on a General Method in Dynamics (1834–35) transplanted the idea: dynamics, too, flows from one scalar function of endpoints, the principal function, whose gradient is momentum and whose time slope is minus energy. Hamilton demanded his function satisfy two PDEs at once; Jacobi trimmed the requirement to one and made the method practical — the equation now carries both names. Hamilton considered the optical-mechanical analogy his deepest insight, and posterity agreed twice over: once when Schrödinger used it to build wave mechanics, and again when Feynman placed eiS/ℏe^{iS/\hbar}, with Hamilton's function in the exponent, at the foundation of the path integral.

History
1828
— Hamilton's Theory of Systems of Rays compresses all of an optical system into one characteristic function of endpoints.
1834
— First Essay on a General Method in Dynamics: the principal function appears, with momentum as its gradient and minus energy as its time derivative.
1835
— Second Essay simplifies the scheme and exhibits the two-endpoint function generating the motion between arbitrary times.
1837
— Jacobi shows one PDE and any complete integral suffice, turning Hamilton's construction into a working solution method.
1948
— Feynman's path integral makes the two-point principal function the phase of the quantum propagator, completing the arc Hamilton began with optics.

Going further

References. Goldstein, Poole & Safko, Classical Mechanics, 3rd ed., Ch. 10 (Hamilton-Jacobi Theory) · Landau & Lifshitz, Mechanics, 3rd ed., §47 (The Hamilton-Jacobi equation) · Morin, Introduction to Classical Mechanics, Ch. 15 (Hamiltonian and Hamilton-Jacobi) · Taylor, Classical Mechanics, Ch. 13 · Arnold, Mathematical Methods of Classical Mechanics, 2nd ed., §46-47 Key self-consistency checks: the F2F_2 relations together with K=H+∂S/∂t=0K=H+\partial S/\partial t=0 yield the HJ PDE; the harmonic-oscillator solution has amplitude 2E/(mω2)\sqrt{2E/(m\omega^2)} and frequency ω\omega; the free-particle solution S=αq−α2t/2mS=\alpha q-\alpha^2 t/2m solves the PDE and gives q=β+(α/m)tq=\beta+(\alpha/m)t. Worked-example numbers on this page (S=6.0 J sS=6.0\ \mathrm{J\,s}, p=3.0 kg m/sp=3.0\ \mathrm{kg\,m/s}, E=3.0 JE=3.0\ \mathrm{J} free particle; S=−1.76×10−3 J sS=-1.76\times10^{-3}\ \mathrm{J\,s}, p0=8.86×10−3 kg m/sp_0=8.86\times10^{-3}\ \mathrm{kg\,m/s} oscillator) are illustrative arithmetic recomputed from the boxed formulas.

Builds on: Hamilton-Jacobi Equation · Generating Function to a Trivial Hamiltonian · Hamilton's Characteristic Function Leads to: Time-Independent Hamilton-Jacobi Equation · Separation of Variables in Hamilton-Jacobi Theory · Action-Angle Variables · Liouville Integrable Systems

What is the difference between the action functional and Hamilton's principal function?

The action functional assigns a number to every conceivable path — it is the object you vary in Hamilton's principle, defined off-shell. Hamilton's principal function is that functional evaluated only on true paths, then read as an ordinary function of the endpoint (q,t)(q,t) (with initial data or constants α\alpha as parameters). The functional answers "which path is real?" by being stationary; the function answers "what does the real path cost, and how does the cost respond to moving the destination?" — and its responses are pp and −H-H. Confusing them makes statements like dS/dt=L\mathrm{d}S/\mathrm{d}t=L mysterious: that identity holds for the endpoint function along the motion, not for the functional. The action-functional article builds the first object; this one, the second.

Why does S depend on constants alpha instead of the initial conditions themselves?

It can do either — the α\alpha's are a repackaging of half the initial data. A complete integral is an nn-parameter family of solutions, and which nn parameters is your choice: for the free particle you can take α\alpha to be the momentum (S=αq−α2t/2mS=\alpha q-\alpha^2t/2m) or the energy — different complete integrals of the same PDE. The two-point version makes the extreme choice αi=q0i\alpha_i=q_{0i}: the "constants" are literally the initial positions, and then βi=−p0i\beta_i=-p_{0i} come out as the initial momenta. Whatever the packaging, the count is fixed: nn α\alpha's plus nn β\beta's equal the 2n2n initial conditions. The freedom is useful — separation constants are usually much easier to find than explicit initial-condition dependence.

How can the gradient of a scalar encode momentum? Momentum has n components and S is one function

Because SS's value is spread over n+1n{+}1 variables, its gradient has exactly nn components — one per coordinate — and those ARE the momenta: pi=∂S/∂qip_i=\partial S/\partial q_i. What the single-scalar structure does impose is a genuine physical restriction on the momentum field: since ∂pi/∂qj=∂2S/∂qj∂qi\partial p_i/\partial q_j=\partial^2S/\partial q_j\partial q_i is symmetric, the momentum field of a principal function is curl-free — trajectories delivered by one SS form an organized, non-crossing family (a Lagrangian manifold), not an arbitrary spray. Where families DO cross (caustics, conjugate points), no single-valued SS exists, which is exactly why the two-point construction degenerates at ωt=nπ\omega t=n\pi for the oscillator. The restriction is a feature: it is the classical skeleton of quantum single-valuedness of the phase.

Is S unique for a given system?

No, three ways. First, the trivial one: an additive constant never matters. Second, different complete integrals of the same HJ equation exist — different choices of which nn constants label the family — and each solves the dynamics; they are related by canonical transformations among constants. Third, even the two-point function is only piecewise unique: between conjugate points there may be several true paths joining the endpoints (think of an oscillator going the short way or the long way around), each with its own action branch — the semiclassical propagator literally sums eiSk/ℏe^{iS_k/\hbar} over these branches. What IS unique is the information content: any legitimate SS, differentiated per the recipe, reproduces the same trajectories.

Why is the time slope minus H rather than plus H or minus L?

Trace the variation. Delaying arrival at a fixed location by δt\delta t does two things: the integral grows by L δtL\,\delta t (one more slice of Lagrangian), and the endpoint must be pulled back relative to the flowing path by δq=−q˙ δt\delta q=-\dot q\,\delta t, contributing p δq=−pq˙ δtp\,\delta q=-p\dot q\,\delta t through the gradient identity. The sum is (L−pq˙) δt=−H δt(L-p\dot q)\,\delta t=-H\,\delta t. Forgetting the pull-back gives the seductive wrong answer +L+L; forgetting the extra slice gives −pq˙-p\dot q. Physically the result is sensible: a stationary state of definite energy has action phase drifting as −Et-Et — the classical ancestor of the quantum phase e−iEt/ℏe^{-iEt/\hbar}, sign and all.

The oscillator's S came out negative in the worked example. Did something go wrong?

Nothing — action is not an energy and has no positivity obligation. S=∫(T−V) dtS=\int(T-V)\,\mathrm{d}t weighs kinetic against potential energy; a leg of motion that loiters near a turning point (high VV, low TT) accumulates negative action, and the example's path does exactly that. Only action differences and derivatives carry physics: the derivatives gave the correct momenta in the example, and in quantum mechanics only the relative phase ΔS/ℏ\Delta S/\hbar between interfering paths is observable. Related reassurance: SS is also not bounded below along parameter changes — "least action" is a misnomer; true paths are stationary points, and beyond a conjugate point they are saddle points of the functional, not minima.

What happens to S at conjugate points, and why should I care?

At a conjugate point the family of trajectories launched from (q0,t0)(q_0,t_0) refocuses — for the oscillator, ALL paths from q0q_0 reconverge after half a period regardless of initial momentum. The two-point problem then loses uniqueness, det⁡(−∂2S/∂q ∂q0)\det(-\partial^2S/\partial q\,\partial q_0) diverges, and the principal function develops a singularity (sin⁡ωt→0\sin\omega t\to0 in the formula). Classically this is a caustic — an envelope where trajectories pile up, the mechanical analogue of the bright curve in a coffee cup. Semiclassically it is where the propagator's prefactor (the Van Vleck determinant, built from exactly that second-derivative matrix) blows up and the wavefunction picks up a Maslov phase of −π/2-\pi/2 per crossing. Get the Maslov count right and WKB quantization produces the exact oscillator spectrum — the 12\tfrac12 in (n+12)ℏω(n+\tfrac12)\hbar\omega is conjugate points leaving their fingerprint.

Is Hamilton's principal function used anywhere outside pure mechanics?

Ubiquitously, under aliases. In optimal control it is the value function (cost-to-go): Bellman's equation is an HJ equation with a minimization inside, the costate of Pontryagin's principle is ∂S/∂q\partial S/\partial q, and every reinforcement-learning value network is a numerical complete integral. In quantum mechanics it is the phase of the semiclassical propagator eiS/ℏe^{iS/\hbar} — the computational engine of tunneling rates, instanton methods, and attosecond-physics trajectory models. In optics it is the eikonal/optical path length, Hamilton's own starting point. In general relativity, Jacobi-separating the geodesic principal function in the Kerr metric yields Carter's constant, the key to modeling orbits around rotating black holes. One scalar, five fields — few functions in physics have worked so many jobs.

Before this

Where this leads