Under the gauge transformation,
because the curl of a gradient vanishes, and
The transformed Lagrangian is
A total time derivative changes the action only by endpoint terms, whose variation vanishes for fixed endpoints, so the Euler-Lagrange equations are unchanged.
The new momentum is
Use the type-two generating function for a canonical transformation
It gives , , and
This equals , so the gauge change is a time-dependent canonical transformation.
The defining relations for a type-2 generating function give
Hence
The exact differential changes the action only by an endpoint term. Thus the transformed variational principle has canonical one-form and yields Hamilton's equations in with
A transformation of phase space is canonical when it preserves the symplectic form, or equivalently all Poisson brackets. For one degree of freedom this is
equivalently .
Suppose a type-two generating function for a canonical transformation defines
Then
Equality of the mixed partial derivatives gives , so the transformation is canonical wherever it is locally invertible.
For
the fundamental theorem of calculus and differentiation under the integral sign give
Thus
and in particular .
For the unit-frequency simple harmonic motion, the transformed Hamiltonian is simply . Hamilton's equations become
Therefore
and transformation back gives the familiar solution
Now consider the weak quartic oscillator
Choose the modified generating function
It gives
so the transformed Hamiltonian is again . Hence and . Expanding the square root with the Taylor series gives
Differentiation with respect to therefore yields
where
Set and
Writing and expanding the inverse sine relation at gives
Expanding similarly gives
Consequently
Since , this is the required expression. The formula is understood away from turning points where and the ratio itself is singular.
For and ,
The one-dimensional criterion for a canonical transformation therefore gives
For either value, the type-two generating function for a canonical transformation
works, because and ; when , the first equation is equivalent to . For every other , the Poisson bracket is not one and the map is not canonical.