Apparent paradox between Lagrangian and Hamiltonian formulations of classical mechanics

The problem is that the Lagrangian and the Hamiltonian are functions of different variables, so you must be exceedingly careful when comparing their partial derivatives.

Consider the differential changes in $L$ and $H$ as you shift their arguments:

$$dL = \left(\frac{\partial L}{\partial q}\right) dq + \left(\frac{\partial L}{\partial \dot q}\right) d\dot q$$

$$dH = \left(\frac{\partial H}{\partial q}\right) dq + \left( \frac{\partial H}{\partial p}\right) dp$$

Finding $\frac{\partial L}{\partial q}$ corresponds to wiggling $q$ while holding $\dot q$ fixed. On the other hand, finding $\frac{\partial H}{\partial q}$ corresponds to wiggling $q$ while holding $p$ fixed. If $p$ can be expressed a function of $\dot q$ only, then these two situations coincide - however, if it also depends on $q$, then they do not, and the two partial derivatives are referring to two different things.

Explicitly, write $p = p(q,\dot q)$. Then using the chain rule, we find that

$$dH = \left(\frac{\partial H}{\partial q}\right) dq + \left(\frac{\partial H}{\partial p}\right)\left[\frac{\partial p}{\partial q} dq + \frac{\partial p}{\partial \dot q} d\dot q\right]$$

So, if we shift $q$ but hold $\dot q$ fixed, we find that

$$ dL = \left(\frac{\partial L}{\partial q} \right)dq$$ while $$ dH = \left[\left(\frac{\partial H}{\partial q} \right) + \left(\frac{\partial H}{\partial p}\right)\left(\frac{\partial p}{\partial q} \right)\right]dq$$

If $L(q,\dot q) = H(q,p(q,\dot q))$ as in the case of a free particle, then we would find that

$$dL = dH$$ so $$\left(\frac{\partial L}{\partial q}\right)= \left(\frac{\partial H}{\partial q} \right) + \left(\frac{\partial H}{\partial p}\right)\left(\frac{\partial p}{\partial q} \right)$$


We can check this for the free particle in polar coordinates, where $$L = \frac{1}{2}m(\dot r^2 + r^2 \dot \theta^2)$$ $$ H = \frac{p_r^2}{2m} + \frac{p_\theta^2}{2mr^2}$$ $$ p_r = m\dot r \hspace{1 cm} p_\theta = mr^2 \dot \theta$$

for the left hand side,

$$ \frac{\partial L}{\partial r} = mr \dot \theta^2$$

For the right hand side, $$ \frac{\partial H}{\partial r} = -\frac{p_\theta^2}{mr^3} = -mr\dot\theta^2$$ $$ \frac{\partial H}{\partial p_\theta} = \frac{p_\theta}{mr^2} = \dot \theta$$ $$ \frac{\partial p_\theta}{\partial r} = 2mr\dot \theta$$ so $$ \frac{\partial H}{\partial r} + \frac{\partial H}{\partial p_\theta} \frac{\partial p_\theta}{\partial r} = -mr\dot \theta^2 + (\dot \theta)(2mr\dot \theta) = mr\dot \theta^2$$

as expected.


Your mistake was subtle but common. In thermodynamics, you will often find quantities written like this:

$$ p = -\left(\frac{\partial U}{\partial V}\right)_{S,N}$$

which means

The pressure $p$ is equal to minus the partial derivative of the internal energy $U$ with respect to the volume $V$, holding the entropy $S$ and particle number $N$ constant

This reminds us precisely what variables are being held constant when we perform our differentiation, so we don't make mistakes.


If you look at the values of the functions: $$ H(q,p) = T(q,p) + V(q,p)\\ L(q, \dot{q}) = T(q, \dot{q}) - V(q,\dot{q}) $$ with $$ T(q, \dot{q}) = T(q, p) $$ The kinetic Energy as a function of $q$ and $\dot{q}$ and the kinetic Energy as a function of $q$ and $p$ are supposed to have the same value. BUT that doesn't mean they are the same function. If you write it down correctly, you should write it: $$ T(q, \dot{q}) = \tilde{T}(q, p) $$ If you keep this in your mind, then the paradox should vannish.