Hamiltonian Dynamics in Bijected Vector Space

Starting with a regular Lagrangian of the form

L(q,q˙)=12imiq˙2+U(q)

bijecting it into another vector space so Q=f(q) and q=f1(q)

Using the chain rule we can see that

q˙i=dqidt=jfi1(Q)QjdQjdt=jfi1(Q)QjQ˙j

Then substituting back into the Lagrangian

L(Q,Q˙)=12imi(jfi1(Q)QjQ˙j)2+U(f1(Q))
=12imijkfi1(Q)Qjfi1(Q)QkQ˙jQ˙k+U(f1(Q))
=12jk(imifi1(Q)Qjfi1(Q)Qk)Q˙jQ˙k+U(f1(Q))

Then define a matrix

Gjk(Q)=imifi1(Q)Qjfi1(Q)Qk

Making

L(Q,Q˙)=Q˙𝐆(Q)Q˙+U(f1(Q))

Then do the Legendre transform to make it a Hamiltonian

Pi=LQ˙i=12j𝐆ijQ˙j+12j𝐆jiQ˙j

And 𝐆 is symmetric so

=j𝐆ijQ˙j

So

P=𝐆(Q)Q˙

The Legendre transform requires that it's invertable so if the matrix is invertable then

Q˙=𝐆1(Q)P

Then with the Legrendre transform

H(Q,P)=PQ˙L(Q,Q˙)
=P𝐆1(Q)PL(Q,𝐆1(Q)P)
=P𝐆1(Q)P12((𝐆1(Q)P)𝐆(Q)(𝐆1(Q)P))+U(Q)
=P𝐆1(Q)P12(P𝐆1(Q)𝐆(Q)𝐆1(Q)P)+U(Q)
=P𝐆1(Q)P12(P𝐆1(Q)P)+U(Q)
=12P𝐆1(Q)P+U(Q)