The general action identity isTreating as independent and comparing coefficients givesChoose 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.