The time evolution of a system in classical mechanics is given by the solution of Hamilton's equations of motion, which tell us that $$\frac{\mathrm{d}p}{\mathrm{d}t}=-\frac{\partial H}{\partial q},\qquad \frac{\mathrm{d}q}{\mathrm{d}t}=\frac{\partial H}{\partial p}.$$

Now, divide the first equation by the second, to obtain $$\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\frac{\partial H}{\partial q}}{\frac{\partial H}{\partial p}},$$

and now after a manipulation we arrive at $$\frac{\partial H}{\partial p}\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\partial H}{\partial q}, $$

and multiplying both sides by $\mathrm{d}q$ and doing an addition we arrive at

$$\frac{\partial H}{\partial q}\mathrm{d}q+\frac{\partial H}{\partial p}\mathrm{d}p=0, $$

which is an exact differential, because of the symmetry of partial derivatives, and we thus must have $\mathrm{d}H=0$. This implies that $H$ is time independent, since it is well known that the total time derivative of the Hamiltonian is equal to its partial time derivative.

This argument obviously is wrong, time-dependent Hamiltonians are obviously allowed. Where's the mistake?

  • 9
    $\begingroup$ The total differential should include a time dependent term $dH(q,p,t)=\frac{\partial H}{\partial q}dq + \frac{\partial H}{\partial p}dp+\frac{\partial H}{\partial t}dt$. So I don't think that your conclusion $dH=0$ is correct, assuming an explicit time dependent Hamiltonian. $\endgroup$
    – Hans Wurst
    Commented Dec 20, 2021 at 22:25
  • 2
    $\begingroup$ You got p as a function of q ?? $\endgroup$ Commented Dec 20, 2021 at 22:35
  • $\begingroup$ @HansWurst My conclusion comes from the observation that $H$ is the function being differentiated. $\endgroup$
    – Don Al
    Commented Dec 20, 2021 at 22:52
  • $\begingroup$ You can't conclude the $\delta H$ is zero. It is just trivially true that $\frac{\partial H}{\partial q}\dot q + \frac{\partial H}{\partial p}\dot p = 0$ from the definitions of those in terms of partial derivatives of the Hamiltonian. See my answer. $\endgroup$
    – hft
    Commented Dec 20, 2021 at 23:07
  • $\begingroup$ You've evaluated $\frac{dH}{dt}-\frac{\partial H}{\partial t}$, aka the Liouvillian of the Hamiltonian. $\endgroup$
    – J.G.
    Commented Dec 20, 2021 at 23:08

3 Answers 3


This was too long for a comment so I'll add it as answer.

You have reformulated that the following holds along a trajectory,

$ dH(p,q,t) = \frac{\partial H}{\partial p}dp +\frac{\partial H}{\partial q}dq + \frac{\partial H}{\partial t}dt \\ dH(p(t), q(t), t)=\frac{\partial H}{\partial p}\frac{dp}{dt}dt +\frac{\partial H}{\partial q}\frac{dq}{dt}dt + \frac{\partial H}{\partial t}dt \\ dH(p(t), q(t), t)=\dot q \dot pdt - \dot p \dot qdt + \frac{\partial H}{\partial t}dt \\ dH(t)=\frac{\partial H}{\partial t}dt \neq 0 $

You can see that differentials in p and q cancel each other along a trajectory that satisfies Hamilton's equations of motion, but the time dependent term remains. You made no statement about that term and thus you cannot conclude that the total differential is zero.

Just showing that some differentials cancel means not that the whole function, does not change.


When you divide $dp/dt$ by $dq/dt$ and apply the chain rule to get $\dfrac{dp}{dq}$, you're implicitly assuming that $p$ is a function of $q$ only, thereby assuming time independence of $\mathcal H$.

  • $\begingroup$ I think this not the right answer, since $q$ and $p$ are functions only of time, being the solution of the motion (that what the OP assumes by starting from the two ODEs), and so there is in a neighborhood of $t$ some inverse of $q$ and therewith $p$ becomes a function only of $q$ on that neighborhood. the first comment is the correct answer in my opinion, or did I get something wrong ? $\endgroup$
    – Physor
    Commented Dec 21, 2021 at 0:01
  • $\begingroup$ @Physor The first comment is correct, but what OP did is also correct for $p$ being a function of $q$ only. The important step is when OP divides the equations and sets $\dfrac{dp}{dq}$ equal to $\dfrac{\dfrac{dp}{dt}}{\dfrac{dq}{dt}}$ which is an application of the chain rule. Yes, $p$ and $q$ depend only on time, but, if the Hamiltonian is not time-dependent, $p$ can be expressed as a function of $q$ (and the time dependence of $p$ on $t$ is implicit). $\endgroup$
    – user256872
    Commented Dec 21, 2021 at 0:10
  • 1
    $\begingroup$ In order to write $\dfrac{dp/dt}{dq/dt}$ as $dp/dq$, one must assume $p=p\left(q(t)\right)$ such that $\dfrac{dp}{dt} = \dfrac{dp}{dq} \dfrac{dq}{dt}$, and such an assumption guarantees the Hamiltonian is constant with time. $\endgroup$
    – user256872
    Commented Dec 21, 2021 at 0:12

If you call $$ H(p,q;t) = pq - L(q,\dot q; t)\;, $$ where $L$ is the Lagrangian, the $p$ is the momentum, and the $q$ is the coordinate, (and the $\dot q$ is a function of the $p$), then you have:

$$ \delta H = \dot q \delta p - \dot p \delta q + \frac{\partial H}{\partial t}\delta t\;. $$

The above is usually derived starting from the Lagrangian equations of motion and changing variables to eliminate $\dot q$ in favor of $p$.

The above equation for the differential $\delta H$ can also be used to write, by the definition of partial derivative: $$ \frac{\partial H}{\partial p} = \dot q \qquad (1) $$ and $$ \frac{\partial H}{\partial q} = -\dot p \qquad (2) $$

If I multiply Equation (1) by $\dot p$ and I multiply Equation (2) by $\dot q$, and I add the equations I get: $$ \frac{\partial H}{\partial p}\dot p + \frac{\partial H}{\partial q}\dot q = \dot q \dot p - \dot p \dot q = 0\;. $$

The above equation is similar to what you wrote:

we arrive at $$\frac{\partial H}{\partial q}\mathrm{d}q+\frac{\partial H}{\partial p}\mathrm{d}p=0,$$ which is...

But, there is clearly no implication that $\delta H$ is zero.

So, I think your main error is in stating:

...which is an exact differential, because of the symmetry of partial derivatives, and we thus must have dH=0.

Consider, again, the true expression for $\delta H$: $$ \delta H = -\dot p \delta q + \dot q \delta p + \frac{\partial H}{\partial t} \delta t\;. $$

Now suppose you want to "divide both sides by $\delta t$" to see what happens. You find: $$ \frac{dH}{dt} = -\dot p \dot q + \dot q \dot p + \frac{\partial H}{\partial t} $$ $$ = \frac{\partial H}{\partial t}\;, $$ which is what we expect.

  • $\begingroup$ OK, but isn't $H$ the function being differentiated? It seems to me that your last equation implies vanishing exact differential, of $H$. $\endgroup$
    – Don Al
    Commented Dec 20, 2021 at 23:09
  • $\begingroup$ We clearly do not have $\delta H = 0$. H, in general, changes when the momentum or the position or the time are changed. $\endgroup$
    – hft
    Commented Dec 20, 2021 at 23:10
  • $\begingroup$ I'll add a bit to the answer to clarify $\endgroup$
    – hft
    Commented Dec 20, 2021 at 23:19

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.