Skip to main content
Library homepage
Physics LibreTexts

8.2: Legendre Transformation between Lagrangian and Hamiltonian mechanics

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Hamiltonian mechanics can be derived directly from Lagrange mechanics by considering the Legendre transformation between the conjugate variables \(\left( \mathbf{q},\mathbf{ \dot{q}},t\right)\) and \(\left( \mathbf{q},\mathbf{p},t\right)\). Such a derivation is of considerable importance in that it shows that Hamiltonian mechanics is based on the same variational principles as those used to derive Lagrangian mechanics; that is d’Alembert’s Principle and Hamilton’s Principle. The general problem of converting Lagrange’s equations into the Hamiltonian form hinges on the inversion of Equation \((8.1.1)\) that defines the generalized momentum \(\mathbf{ p.}\) This inversion is simplified by the fact that \((8.1.1)\) is the first partial derivative of the Lagrangian scalar function \(L(\mathbf{q, \dot{q},t})\).

    As described in appendix \(19.6.4\), consider transformations between two functions \(F(\mathbf{u,w})\) and \(G(\mathbf{v,w),}\) where \(\mathbf{u}\) and \(\mathbf{v}\) are the active variables related by the functional form

    \[\mathbf{v=\nabla }_{\mathbf{u}}F(\mathbf{u,w}) \label{8.5}\]

    and where \(\mathbf{w}\) designates passive variables. The function \(\mathbf{ \nabla }_{\mathbf{u}}F(\mathbf{u,w})\) is the first-order derivative, (gradient) of \(F(\mathbf{u,w})\) with respect to the components of the vector \(\mathbf{u}\). The Legendre transform states that the inverse formula can always be written as a first-order derivative

    \[\mathbf{u=\nabla }_{\mathbf{v}}G(\mathbf{v,w})\label{8.6}\]

    The function \(G(\mathbf{v,w})\) is related to \(F(\mathbf{u,w})\) by the symmetric relation

    \[G(\mathbf{v,w)+}F\mathbf{(\mathbf{u,w})=u\cdot v}\label{8.7}\]

    where the scalar product \(\mathbf{u\cdot v}=\sum_{i=1}^{N}u_{i}v_{i}\).

    Furthermore the first-order derivatives with respect to all the passive variables \(w_{i}\) are related by

    \[\mathbf{\nabla }_{\mathbf{w}}F(\mathbf{u,w)=-\nabla }_{\mathbf{w}}G(\mathbf{ v,w)}\label{8.8}\]

    The relationship between the functions \(F(\mathbf{u,w})\) and \(G(\mathbf{v,w})\) is symmetrical and each is said to be the Legendre transform of the other.

    The general Legendre transform can be used to relate the Lagrangian and Hamiltonian by identifying the active variables \(\mathbf{v}\) with \(\mathbf{p,}\) and \(\mathbf{u}\) with \(\mathbf{\dot{q},}\) the passive variable \(\mathbf{w}\) with \(\mathbf{q,}t\), and the corresponding functions \(F(\mathbf{ u,w)=}L(\mathbf{q,\dot{q},}t)\) and \(G(\mathbf{v,w)=}H(\mathbf{q,p,}t )\). Thus the generalized momentum \((8.1.1)\) corresponds to

    \[\mathbf{p=\nabla }_{\mathbf{\dot{q}}}L(\mathbf{q,\dot{q},}t)\label{8.9}\]

    where \((\mathbf{q,}t)\) are the passive variables. Then the Legendre transform states that the transformed variable \(\mathbf{\dot{q}}\) is given by the relation \[\mathbf{\dot{q}=\nabla }_{\mathbf{p}}H(\mathbf{q,p,}t)\label{8.10}\]

    Since the functions \(L(\mathbf{q,\dot{q},}t)\) and \(H(\mathbf{q,p,}t )\) are the Legendre transforms of each other, they satisfy the relation

    \[H\left( \mathbf{q},\mathbf{p},t\right) \mathbf{+}L(\mathbf{q},\mathbf{\dot{q} },t)=\mathbf{p\cdot \dot{q}}\label{8.11}\]

    The function \(H\left( \mathbf{q},\mathbf{p},t\right)\), which is the Legendre transform of the Lagrangian \(L(\mathbf{q},\mathbf{\dot{q}},t),\) is called the Hamiltonian function and Equation \ref{8.11} is identical to our original definition of the Hamiltonian given by equation \((8.1.3)\). The variables \(\mathbf{q}\) and \(t\) are passive variables thus Equation \ref{8.8} gives that

    \[\mathbf{\nabla }_{\mathbf{q}}L(\mathbf{\dot{q},q,}t\mathbf{)=-\nabla }_{ \mathbf{q}}H(\mathbf{p,q},t)\label{8.12}\]

    Written in component form Equation \ref{8.12} gives the partial derivative relations \[\begin{align} \label{8.13}\frac{\partial L(\mathbf{\dot{q},q,}t)}{\partial q_{i}} &=&-\frac{ \partial H(\mathbf{p,q},t)}{\partial q_{i}} \\ \frac{\partial L(\mathbf{\dot{q},q,}t)}{\partial t} &=&-\frac{ \partial H(\mathbf{p,q},t)}{\partial t}\label{8.14}\end{align}\]

    Note that equations \ref{8.13} and \ref{8.14} are strictly a result of the Legendre transformation. To complete the transformation from Lagrangian to Hamiltonian mechanics it is necessary to invoke the calculus of variations via the Lagrange-Euler equations. The symmetry of the Legendre transform is illustrated by Equation \ref{8.11}.

    Equation \(7.6.16\) gives that the scalar product \(\mathbf{p\cdot \dot{q}=} 2T_{2}.\) For scleronomic systems, with velocity independent potentials \(U,\) the standard Lagrangian \(\,L=T-U\) and \(H=2T-T+U=T+U\). Thus, for this simple case, Equation \ref{8.11} reduces to an identity \(H+L=2T\).

    This page titled 8.2: Legendre Transformation between Lagrangian and Hamiltonian mechanics is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Douglas Cline via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.