Hamiltonian is related to Lagrangian with the equation: $$H= p\dot{q}- L(q,\dot{q},t) $$
Now, $H$ is function of $p,q,t$ so the Hamiltonian to be unique, $\dot{q}$ must be expressed uniquely using $p,q,t$.
But is there always a one to one mapping between $p$ and $\dot{q}$ ? How to prove that?

  • $\begingroup$ I think $p \equiv d\mathcal{L}/d\dot{q}$. $\endgroup$
    – DanielSank
    Apr 25, 2020 at 2:11
  • $\begingroup$ What if this is not a one to one function? $\endgroup$ Apr 25, 2020 at 4:23
  • $\begingroup$ So it seems that are you asking for existence rather than uniqueness. $\endgroup$
    – Qmechanic
    Apr 25, 2020 at 9:27

5 Answers 5


In general, the mapping defined by $$ p_i(q,\dot{q}) = \frac{\partial L}{\partial \dot{q}^i}$$ is neither injective nor surjective. Theories in which it is not are constrained Hamiltonian theories and equivalently Lagrangian gauge theories in which the solutions to the equations of motion contain arbitrary functions of time. "Constrained" means that the $q$ and $p$ are not independent after the transformation and that there are primary constraints $\phi_i(q,p) = 0$ among them that hold off-shell.

The map is (locally) invertible if and only if $$ \mathrm{det}\left(\frac{\partial L}{\partial \dot{q}^i \partial \dot{q}^j}\right) \neq 0$$ for all $(q,\dot{q})$.

In the Lagrangian world this can be seen because the accelerations $\ddot{q}^i$ are determined uniquely by pairs $(q,\dot{q})$ if and only if this is true, otherwise we have gauge degrees of freedom because $$ \ddot{q}^j\frac{\partial L}{\partial \dot{q}^i \partial \dot{q}^j} = \frac{\partial L}{\partial q^i} - \dot{q}^j\frac{\partial L}{\partial \dot{q}^i \partial q^j},$$ which follows from the Euler-Lagrange equations, can be solved for $\ddot{q}$ uniquely only if $\frac{\partial L}{\partial \dot{q}^i \partial \dot{q}^j}$ is invertible.

When there are constraints, the Hamiltonian $$ H = \dot{q}^i p_i - L$$ is not unique in the sense that it is uniquely determined only on the physically relevant constraint surface in phase space defined by the $\phi_i(q,p) = 0$. The transformation $$ H \mapsto H + \phi_i(q,p)f^i(q,p)$$ for arbitrary functions $f^i$ leaves the physics unchanged since the additional term vanishes off-shell on the constraint surface. Hence the Hamiltonian associated with a Lagrangian with gauge freedom is not unique.


In general, if you have a nonstandard kinetic term, it may be impossible to transform the equations of motion from Lagrangian to Hamilton form. Probably the simplest situation of this type (following an example from Nambu) is if the kinetic energy $K$ is a quartic function of the velocity. The fourth power makes $K$ bounded below (as it should be), and it is possible to have quasiparticles in condensed matter systems with this kind of kinetic energy.

The key point is that the definition of the canonical momentum, $$p=\frac{\partial L}{\partial\dot{q}}$$ is a cubic polynomial to solve for $\dot{q}(p)$. Unlike the linear equation that results when $K=\frac{1}{2}m\dot{q}^2$, the cubic equation does not have a unique solution, so it is not possible to have a unique Hamilton.

You might think that you could get around this difficulty by selecting one root if the cubic equation and sticking with that. However, that too fails. If you solve the Lagrangian equations of motion, you will find that the velocity $\dot{q}$ will generally not stay on the same branch of solutions of the cubic.

  • $\begingroup$ I think, the last point is not a generalized solution. We have to show that $L$ can only contain $\dot{q}^2$ $\endgroup$ Apr 25, 2020 at 4:31
  • $\begingroup$ @user456350 I'm sorry, but I don't know what you mean. $\endgroup$
    – Buzz
    Apr 25, 2020 at 5:11

The key equation to get the Hamiltonian is this one:

$$\vec{p}-\underbrace{\frac{\partial L(\vec{q}\,,\vec{\dot{q}})}{\partial \vec{\dot{q}}}}_{\vec{f}(\vec{q},\vec{\dot{q}})}=0\tag 1$$

we have to solve equation (1) for $\vec{\dot{q}}=\ldots$

to solve equation (1) we take the Taylor series an get:

$$\Delta{\vec{p}}-\vec{f}(\vec{q}_0,\vec{\dot{q}}_0)-\frac{\partial \vec{f}}{\partial \vec{\dot{q}}}\bigg|_{\left(\vec{q}_0,\vec{\dot{q}}_0\right)}\Delta{\vec{\dot{q}}}=0\tag 2$$

thus :we get unique solution for $\Delta{\vec{\dot{q}}}$ only if die determinate of the $(n_q\times n_q)$ matrix $\quad \frac{\partial \vec{f}}{\partial \vec{\dot{q}}}\quad $ is not equal zero

this is the condition to have unique Hamiltonian

for all conservative system you get unique Hamiltonian, because the Hamiltonian is equal the energy of the system


$$L=\frac{1}{2}\,m{r}^{2} \left( {{\it\dot{q}}_{{1}}}^{2}+{{\it\dot{q}}_{{2}}}^{2} \right) -{\it mg} \left( r\sin \left( q_{{1}} \right) +r\sin \left( q _{{2}} \right) \right)$$


$$\vec{f}=\left[ \begin {array}{c} m{r}^{2}{\it\dot{q}}_{{1}}\\ m {r}^{2}{\it\dot{q}}_{{2}}\end {array} \right]$$


$$\frac{\partial \vec{f}}{\partial \vec{\dot{q}}}=\left[ \begin {array}{cc} m{r}^{2}&0\\ 0&m{r}^{2} \end {array} \right] $$ where :

$$\vec{\dot{q}}= \left[ \begin {array}{c} \dot{q}_{{1}}\\ \dot{q}_{{2}} \end {array} \right] $$ thus:

$$\det\left(\frac{\partial \vec{f}}{\partial \vec{\dot{q}}}\right)\ne 0$$ the Hamiltonian exist!


The current version of the Wikipedia article about Legendre transformation has in the opening the following statement:

The Legendre transform [...] can be specified by the condition that the functions' first derivatives are inverse functions of each other.

$$ g' = (f')^{-1} $$

A necessary condition is that f(x) is convex; the second derivative must be positive everywhere.

When necessary conditions are met the Legendre transformation is its own inverse. Performing Legendre tranformation a second time recovers the original function. This implies that the transform must be unique.

The above definition is the most general, and it only fixes Legendre transformation up to an additive constant. Since all of the dynamical laws are constructed from derivatives of the Lagrangian/Hamiltonian this does not present a problem.

It would appear that in most (if not all) physics textbooks the Legrendre transformation is presented in a less general form, obscuring the property that gives rise to uniqueness.

Presumably the decision to use Legendre transformation to construct the Hamiltonian from the Lagrangian was made by William Rowan Hamilton himself. (It would be interesting to verify that in Hamilton's original papers.)

Helpful article:
Article (2009) by R. K. P. Zia, Edward F. Redish, Susan R. McKay, Making sense of the Legendre transform

Addition, 1 hour later:
Zia, Redish and McKay also point out:
In mathematical physics, when you multiply the siblings of the conjugate pair with each other the constraint is that the product must be dimensionally the same as the overall functional. In classical mechanics the Lagrangian has dimensionality of mass and velocity squared: ($mv^2$). Hence the conjugate sibling of velocity ($v$) must have dimensions of mass and velocity ($mv$)

  1. When one cannot locally invert the relation $p=\frac{\partial L(q,v,t)}{\partial v}$ wrt. velocities $v$, the Legendre transformation is singular$^1$. It is in principle still possible to construct a Hamiltonian formalism via the Dirac-Bergmann recipe/cookbook, see e.g. Refs. 1-2.

    For an explicit example, see e.g. this Phys.SE post. Concerning the existence of the Hamiltonian, see also this related Phys.SE post.

  2. Lagrangian & Hamiltonian formulations are not unique. For starters, one can add total derivative terms.


  1. P.A.M. Dirac, Lectures on QM, (1964).

  2. M. Henneaux and C. Teitelboim, Quantization of Gauge Systems, 1994.


$^1$ The regular Legendre transformation is discussed in e.g. this Phys.SE post.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.