# 8.2: Legendre Transformation between Lagrangian and Hamiltonian mechanics

$$\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}}$$

$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$

$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$

$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vectorC}[1]{\textbf{#1}}$$

$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$

$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$

$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$

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.