\subsection{Derivation of the Hamilton-Jacobi Equation}

This subsection derives the Hamilton--Jacobi partial differential equation from the Lagrangian formulation through successive Legendre transforms and a special canonical transformation, and states Jacobi's theorem that reduces the solution of the mechanics problem to finding a complete integral of the resulting PDE.

\dfn{Hamilton's principal function and the Hamilton--Jacobi action}{
Let $q_1,\dots,q_n$ be generalized coordinates and let $p_1,\dots,p_n$ be the corresponding canonical momenta. Hamilton's principal function $\mcS(q_1,\dots,q_n,t)$ is a generating function whose spatial partial derivatives equal the canonical momenta:
\[
p_i = \pdv{\mcS}{q_i}
\]
for each $i=1,\dots,n$. When $\mcS$ satisfies the Hamilton--Jacobi equation, it encodes the complete solution to the equations of motion.}

\nt{The Hamilton--Jacobi approach replaces the $2n$ coupled first-order Hamiltonian equations of motion with a single first-order nonlinear PDE for $\mcS$. The trade-off is between solving a system of coupled ODEs and solving a nonlinear PDE. In practice, the PDE is often separable, reducing to a set of ordinary equations that integrate more easily.}

\thm{The Hamilton--Jacobi partial differential equation}{
Let $\mcH(q_1,\dots,q_n,p_1,\dots,p_n,t)$ be the Hamiltonian of a system with $n$ degrees of freedom. Then Hamilton's principal function $\mcS(q_1,\dots,q_n,t)$ satisfies
\[
\mcH\!\left(q_1,\dots,q_n,\pdv{\mcS}{q_1},\dots,\pdv{\mcS}{q_n},t\right) + \pdv{\mcS}{t} = 0.
\]}

\pf{Derivation from Lagrangian through canonical transformation to HJ}{
Begin with the Lagrangian $\mcL(q,\dot{q},t)$ for a system with generalized coordinates $q_1,\dots,q_n$. Define the canonical momenta through the Legendre transform:
\[
p_i = \pdv{\mcL}{\dot{q}_i}
\]
for each $i$. The Hamiltonian is the Legendre transform of the Lagrangian:
\[
\mcH = \sum_{i=1}^{n} p_i \dot{q}_i - \mcL,
\]
expressed as a function of $(q,p,t)$ after eliminating $\dot{q}$ in favor of $p$ using the inverse of the Legendre map.

Hamilton's canonical equations follow directly from this construction:
\[
\dot{q}_i = \pdv{\mcH}{p_i},
\qquad
\dot{p}_i = -\pdv{\mcH}{q_i}.
\]
These $2n$ first-order coupled equations fully determine the dynamics of the system once initial conditions are specified.

Now seek a type-2 canonical transformation from $(q,p)$ to new variables $(Q,P)$ that simplifies the dynamics. The generating function $F_2(q,P,t)$ defines the transformation through the relations
\[
p_i = \pdv{F_2}{q_i},
\qquad
Q_i = \pdv{F_2}{P_i}.
\]
The new Hamiltonian $\mcK(Q,P,t)$ is related to the original Hamiltonian $\mcH$ by the standard transformation rule
\[
\mcK = \mcH + \pdv{F_2}{t}.
\]

Choose the generating function so that the new Hamiltonian vanishes identically: $\mcK = 0$. With this choice, all new coordinates and momenta are constant in time by Hamilton's equations in the new variables:
\[
\dot{Q}_i = \pdv{\mcK}{P_i} = 0,
\qquad
\dot{P}_i = -\pdv{\mcK}{Q_i} = 0.
\]
This makes every $Q_i$ and $P_i$ a constant of motion, which trivializes the dynamics in the transformed variables. Setting $\mcK = 0$ in the transformation rule gives the key relation
\[
\mcH = -\pdv{F_2}{t}.
\]

Rename the generating function $F_2$ as $\mcS(q_1,\dots,q_n,P_1,\dots,P_n,t)$ and use $p_i = \pdv{\mcS}{q_i}$ to substitute the momenta inside the Hamiltonian. The previous equation reads
\[
\mcH\!\left(q_1,\dots,q_n,\pdv{\mcS}{q_1},\dots,\pdv{\mcS}{q_n},t\right) = -\pdv{\mcS}{t}.
\]
Rearranging gives the Hamilton--Jacobi partial differential equation:
\[
\mcH\!\left(q_1,\dots,q_n,\pdv{\mcS}{q_1},\dots,\pdv{\mcS}{q_n},t\right) + \pdv{\mcS}{t} = 0.
\]
Every solution $\mcS$ of this PDE generates a canonical transformation to action-angle-like variables in which the motion is completely trivial.}

\cor{Time-independent HJ equation (Hamilton--Charpit--Jacobi)}{
When the Hamiltonian does not depend explicitly on time, $\pdv{\mcH}{t} = 0$ and the Hamiltonian is a conserved quantity, $\mcH = E$. In this case the time dependence of $\mcS$ separates as $\mcS = W(q_1,\dots,q_n) - Et$, and the Hamilton--Jacobi equation reduces to
\[
\mcH\!\left(q_1,\dots,q_n,\pdv{W}{q_1},\dots,\pdv{W}{q_n}\right) = E.
\]
This is the time-independent Hamilton--Jacobi equation, sometimes called the Hamilton--Charpit--Jacobi equation. Solving for $W$ and appending $-Et$ gives the complete principal function.}

\mprop{Jacobi's theorem on complete integrals}{
Let $\mcS(q_1,\dots,q_n,\alpha_1,\dots,\alpha_n,t)$ denote a complete integral of the Hamilton--Jacobi equation, meaning it contains $n$ independent non-additive separation constants $\alpha_1,\dots,\alpha_n$ plus one true additive constant. Jacobi's theorem provides the equations of motion:

\begin{enumerate}[label=\bfseries\tiny\protect\circled{\small\arabic*}]
\item For each $i=1,\dots,n$, the equation
\[
\pdv{\mcS}{\alpha_i} = \beta_i
\]
determines a relation among the coordinates, time, and the two constants $\alpha_i$ and $\beta_i$. The constants $\beta_1,\dots,\beta_n$ are fixed by the initial conditions.

\item The $n$ equations from the previous point determine $q_1(t),\dots,q_n(t)$, thereby solving the mechanics problem entirely. The canonical momenta follow from
\[
p_i = \pdv{\mcS}{q_i}.
\]

\item In the language of canonical transformations, the separation constants $\alpha_i$ play the role of the new momenta $P_i$ and the constants $\beta_i$ play the role of the new coordinates $Q_i$. All are constant in time because the new Hamiltonian has been chosen to vanish.
\end{enumerate}
}

\nt{Connection to Hamilton's principle of least action}{The Hamilton--Jacobi formalism is deeply connected to Hamilton's principle of least action. Hamilton's principal function $\mcS(q,t)$ evaluated along the actual physical path coincides with the action integral $\int_{t_0}^{t} \mcL\,dt'$ computed along that trajectory. The Hamilton--Jacobi equation itself can be viewed as the condition that the action integral be stationary under variations of the endpoint, generalizing the Euler--Lagrange equations to a differential equation for the action. This unifies the variational and canonical formulations of classical mechanics into a single framework based on the propagating wavefront of constant action.}

\nt{Connection to Maupertuis' principle}{The time-independent Hamilton--Jacobi equation also connects to Maupertuis' principle of least action, which characterizes true trajectories as geodesics in configuration space with a metric scaled by kinetic energy. The reduced action $W(q)$ satisfies $dW = p_i\,dq_i$, so that integrating $dW$ along a trajectory is equivalent to integrating the momentum one-form. When $H=E$ is held fixed, the paths that extremize $\int p_i\,dq_i$ are the same paths found by solving the time-independent equation for $W$.}

\ex{Complete integral for a free particle}{For a free particle in one dimension, $\mcH = p^2/2m$. The Hamilton--Jacobi equation is
\[
\tfrac{1}{2m}\left(\pdv{\mcS}{x}\right)^2 + \pdv{\mcS}{t} = 0.
\]
We try the additive separation ansatz $\mcS(x,t) = W(x) + T(t)$. Substituting into the PDE gives
\[
\frac{1}{2m}\left(\der{W}{x}\right)^2 + \der{T}{t} = 0.
\]
Since the first term depends only on $x$ and the second only on $t$, each must equal a constant. We choose the separation constant as $\alpha^2/(2m)$, where $\alpha$ will turn out to be the constant momentum:
\[
\frac{1}{2m}\left(\der{W}{x}\right)^2 = \frac{\alpha^2}{2m},
\qquad
\der{T}{t} = -\frac{\alpha^2}{2m}.
\]
The spatial equation gives $\der{W}{x} = \pm\alpha$. Choosing the positive sign (the negative case is covered by allowing $\alpha$ to be either positive or negative) and integrating with respect to $x$ gives $W(x) = \alpha x + c_W$. Similarly, integrating the temporal equation gives $T(t) = -\alpha^2 t/(2m) + c_T$. Absorbing the two additive constants into a single overall additive constant (which does not affect the physics) yields the complete integral
\[
\mcS(x,t;\alpha) = \alpha x - \frac{\alpha^2}{2m}\,t.
\]
We can verify this solution directly by substitution. Computing $\pdv{\mcS}{x} = \alpha$ and $\pdv{\mcS}{t} = -\alpha^2/(2m)$, the left-hand side of the PDE becomes $\tfrac{1}{2m}\alpha^2 - \alpha^2/(2m) = 0$, confirming the result. Here $\alpha$ is the constant momentum and serves as the single separation constant for this one-degree-of-freedom system. Because the Hamiltonian does not depend explicitly on time, energy conservation $\mcH = E = \alpha^2/(2m)$ determines the relationship between the separation constant and the total mechanical energy of the particle.}

\qs{Hamilton--Jacobi for a one-dimensional Hamiltonian}{A one-dimensional system has Hamiltonian
\[
\mcH(x,p) = \frac{p^2}{2m} + V(x).
\]

\begin{enumerate}[label=(\alph*)]
\item Write the Hamilton--Jacobi PDE explicitly for this system.
\item For the free-particle case $V(x) = 0$, find the complete integral $\mcS(x,t;\alpha)$ by separation of variables, identifying $\alpha$ as the constant momentum.
\item Show from Jacobi's theorem that $\pdv{\mcS}{\alpha} = \beta$ yields the trajectory $x(t) = (\alpha/m)t + \beta$, and verify that this satisfies the free-particle equation of motion $m\ddot{x} = 0$.
\end{enumerate}}

\sol \textbf{Part (a).} The Hamilton--Jacobi equation is obtained by replacing the canonical momentum $p$ with the partial derivative $\pdv{\mcS}{x}$. Substituting this into the given Hamiltonian gives
\[
\frac{1}{2m}\left(\pdv{\mcS}{x}\right)^2 + V(x) + \pdv{\mcS}{t} = 0.
\]
This is the explicit Hamilton--Jacobi PDE for a one-dimensional particle in potential $V(x)$.

\textbf{Part (b).} For $V(x) = 0$, the Hamilton--Jacobi equation reduces to
\[
\frac{1}{2m}\left(\pdv{\mcS}{x}\right)^2 + \pdv{\mcS}{t} = 0.
\]
Use the separation ansatz $\mcS(x,t) = W(x) + T(t)$. Substituting and using ordinary derivatives gives
\[
\frac{1}{2m}\left(\der{W}{x}\right)^2 + \der{T}{t} = 0.
\]
The first term depends only on $x$ and the second only on $t$, so each must equal a constant. Choose the separation constant so that the spatial derivative equals the momentum $\alpha$:
\[
\frac{1}{2m}\left(\der{W}{x}\right)^2 = \frac{\alpha^2}{2m},
\qquad
\der{T}{t} = -\frac{\alpha^2}{2m}.
\]
Solving the spatial part, take the square root of both sides:
\[
\der{W}{x} = \pm\alpha.
\]
Choosing the positive sign (the negative case is covered by allowing $\alpha$ to be negative) and integrating with respect to $x$ gives $W(x) = \alpha x$. Integrating the temporal equation gives $T(t) = -\alpha^2 t/(2m)$. Therefore,
\[
\mcS(x,t;\alpha) = \alpha x - \frac{\alpha^2}{2m}\,t.
\]
This is the complete integral: it solves the HJ PDE and contains one independent non-additive constant $\alpha$.

\textbf{Part (c).} Jacobi's theorem states that $\pdv{\mcS}{\alpha} = \beta$, where $\beta$ is a constant determined by initial conditions. Differentiate the complete integral with respect to $\alpha$:
\[
\pdv{\mcS}{\alpha} = x - \frac{\alpha}{m}\,t.
\]
Set this equal to $\beta$ and solve for $x$:
\[
x - \frac{\alpha}{m}\,t = \beta,
\qquad\text{so}\qquad
x(t) = \frac{\alpha}{m}\,t + \beta.
\]
This is the trajectory. Differentiate once with respect to time to find the velocity:
\[
\dot{x} = \frac{\alpha}{m}.
\]
The velocity is constant, as expected for a free particle. Differentiate a second time:
\[
\ddot{x} = 0.
\]
Multiplying by the mass gives
\[
m\ddot{x} = 0,
\]
which is Newton's second law for a free particle. The trajectory is therefore verified. The constant $\alpha$ has the physical meaning $m\dot{x}$, confirming it is the conserved linear momentum. The constant $\beta$ represents the initial position of the particle at $t=0$, since $x(0) = \beta$. Together, $\alpha$ and $\beta$ form a complete set of independent constants for this one-degree-of-freedom system, providing the full two parameters needed to describe the general solution of the second-order equation of motion.

Therefore,
\[
\text{HJ PDE:}\quad \frac{1}{2m}\left(\pdv{\mcS}{x}\right)^2 + V(x) + \pdv{\mcS}{t} = 0,
\]
\[
\mcS(x,t;\alpha) = \alpha x - \frac{\alpha^2}{2m}\,t,
\qquad
x(t) = \frac{\alpha}{m}\,t + \beta.
\]