# Independence of generalised coordinates and momenta in Hamiltonian mechanics [duplicate]

This question already has an answer here:

I am told that in Hamiltonian mechanics, we put the generalised coordinates $q_i$ and generalised momenta $p_i$ on equal footing, and treat them as being independent from one another. But I'm struggling to see how this makes sense given that we define generalised momenta by:

\begin{equation*} p_i=\frac{\partial{L}}{\partial{\dot{q_i}}} \end{equation*}

where $L=L(q_i,\dot{q_i},t)$ is the Lagrangian as usual. Surely this means that $p_i=p_i(q_i,\dot{q_i},t)$? There is clearly dependence upon the generalised coordinates here, so how does this dependence disappear when we move from the Lagrangian formalism to the Hamiltonian formalism?

## marked as duplicate by ACuriousMind♦, Community♦Sep 7 '15 at 14:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

As noted in the comments, the transformation from the $(q_{i},\dot{q}_{i})$ coordinates to the $(q_{i},p_{i})$ coordinates is an example of a Legendre transform. Informally speaking, this allows you to use different coordinates to describe the system, while maintaining all information about the system.

In accordance with the general formulation of a Legendre transform, we use the equation

$p_{i} = \dfrac{\partial L}{\partial \dot{q}_{i}} \hspace{1em} (1)$

to implicitly define $\dot{q}_{i}$ in terms of $p_{i}$ and $q_{i}$. To see how this works in a simpler setting, we can define a variable $y$ as

$y = 2x +1$.

In this sense, we can view $y$ as a function of $x$. However, we can also invert this relation to solve for $x$ in terms of $y$, which gives

$x = \dfrac{1}{2}(y-1)$,

so here we view $x$ as a function of $y$. The point is that we have one independent variable and one dependent variable, but we are free to choose which is which. In classical mechanics the picture is slightly complicated by the fact that we now have 2 independent variables, but the principle remains the same: equation (1) can be viewed as either expressing $p_{i}$ in terms of $q_{i}$ and $\dot{q}_{i}$, or as expressing $\dot{q}_{i}$ in terms of $p_{i}$ and $q_{i}$, and we are free to choose the interpretation that suits our purposes.