Fix an initial event . For each reachable final event , evaluate the action on a classical path satisfying those endpoints. On a chosen local branch this produces Hamilton's principal function , rather than a functional of every possible path. Multiple classical paths may make this function multivalued, so the derivation is local to a branch.
Allow the final event to vary. The integrated interior variation vanishes by the Euler-Lagrange equations. The endpoint variation must distinguish the total coordinate change from the change at fixed time: . Consequently
Hence and . Eliminating the momenta yields the Hamilton-Jacobi equation
A complete integral of the Hamilton-Jacobi equation depends on suitable independent constants for coordinates; differentiating it with respect to those constants supplies the conjugate integration constants needed to reconstruct trajectories.
The general action identity is
Treating as independent and comparing coefficients gives
Choose a complete integral of the Hamilton-Jacobi equation,
Then , and Hamilton's equations become . Completeness and local invertibility are needed: a solution with too few independent parameters cannot generate an arbitrary trajectory.