4
$\begingroup$

When examining the simple undamped harmonic motion of a cart of mass m on a spring with stiffness $k$, we can derive the differential equation of motion using various techniques: Newton's 2nd law, d'Alembert's principle, conservation of energy, Lagrange's equations, etc.

I don't understand the "conservation of energy" technique. It reminds me of the Hamiltonian formalism, but it looks so simple that it doesn't make sense to me.

  1. First, we write out the conservation of energy for our system (of course, no dissipation effects presumed)

$$E_k+E_p=C$$

$$\frac{m\dot x^2}{2}+\frac{kx^2}{2}=C.$$

  1. We take the time derivative of the equation

$$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{m\dot x^2}{2}+\frac{kx^2}{2}\right)=0$$

$$m\dot x \ddot x+kx\dot x=0$$

$$\ddot x+\frac{k}{m} x=0.$$

And that is it. That is the differential equation governing simple harmonic motion. I don't get how are we able to so easily obtain the equation just by taking the derivative of the sum of the kinetic and the potential energy.

That sum is the Hamiltonian, $H=E_k+E_P$, and Hamilton's equations have a slightly more refined look that just

$$\frac{\mathrm{d}H}{\mathrm{d}t}=0 \tag{1}\label{eq:1}$$

they are

$${\displaystyle {\frac {\mathrm {d} {\boldsymbol {q}}}{\mathrm {d} t}}={\frac {\partial {\mathcal {H}}}{\partial {\boldsymbol {p}}}},\quad {\frac {\mathrm {d} {\boldsymbol {p}}}{\mathrm {d} t}}=-{\frac {\partial {\mathcal {H}}}{\partial {\boldsymbol {q}}}}.}\tag{2}\label{eq:2}$$

How is it that we can get the governing differential equation just by using $\eqref{eq:1}$ instead of $\eqref{eq:2}$ (of course, we can obtain it using the full Hamilton equations $\eqref{eq:2}$ also.)?

$\endgroup$

4 Answers 4

4
$\begingroup$

[EDIT: Based on the discussion from the comments under this and Qmechanic's answer, it's worth noting that the following derivation only applies to this example because it is one dimensional. Further clarification and corrections have been added throughout this answer and in a final edit at the bottom.]

One minor technicality before I begin: The energy is a function of $x$ and $\dot x$, while the Hamiltonian is a function of $q=x$ and $p=m\dot x$. So they are different, technically.

Consider the chain rule for the two quantities (i.e. Energy and Hamiltonian): $$ \frac{dH}{dt}=\frac{d q}{d t}\frac{\partial H}{\partial q}+\frac{d p}{d t}\frac{\partial H}{\partial p} \\ \frac{dE}{dt}=\frac{d x}{d t}\frac{\partial E}{\partial x}+\frac{d \dot x}{d t}\frac{\partial E}{\partial \dot x} $$

You know that the second equation must be zero since energy is conserved (i.e. $\frac{dE}{dt}=0$). But have you ever considered why you know that energy is conserved? The answer is (of course) because it was designed that way.

Here are some basic assumptions: (i) Newton's 2nd Law is true (i.e. $F=ma$) and (ii) the force is conservative (i.e. $F=-\frac{\partial E}{\partial x}$). Using these two facts and the chain rule above: $$ \frac{dE}{dt}=\frac{d x}{d t}\frac{\partial E}{\partial x}+\frac{d \dot x}{d t}\frac{\partial E}{\partial \dot x}\\ \frac{dE}{dt}=\frac{d x}{d t}(-F)+(a)\frac{\partial E}{\partial \dot x}\\ \frac{dE}{dt}=\frac{d x}{d t}(-ma)+(a)\frac{\partial E}{\partial \dot x} $$

Now, suppose you want this quantity to be conserved. In that case: $$ 0=\frac{d x}{d t}(-ma)+(a)\frac{\partial E}{\partial \dot x}\\ \frac{\partial E}{\partial \dot x}=m\dot x\\ \therefore E = \frac{1}{2}m\dot{x}^2 + U(x) $$

So if Newton's Second Law is true and energy is conserved, then energy must be defined in the usual way. Or, by reversing the derivation and assuming that the usual energy definition applies and that it is conserved (and that $\dot x \neq 0$), then you can deduce Newton's Second Law. (This is the derivation performed in the question.)

What if you want the Hamiltonian to be conserved? In that case, since we have assumed that $q=x$ and $p=m\dot x$ and since we want the Energy and the Hamiltonian to both represent the same quantity, we know that $F = -\frac{\partial H}{\partial q}$, and since Newton's Second Law tells us that $F=\frac{d p}{d t}$, we conclude that $\frac{d p}{d t}=-\frac{\partial H}{\partial q}$ (i.e. the first of Hamilton's Equations).

Now, let's require the Hamiltonian to be conserved: $$ 0=\frac{d q}{d t}\frac{\partial H}{\partial q}+\frac{d p}{d t}\frac{\partial H}{\partial p}\\ 0=\frac{d q}{d t}(-\frac{d p}{d t})+\frac{d p}{d t}\frac{\partial H}{\partial p}\\ \therefore \frac{d q}{d t}=\frac{\partial H}{\partial p} $$

So, by assuming Newton's Second Law and that the Hamiltonian is conserved (and $\frac{dp}{dt}\neq 0$), we deduce Hamilton's Equations. And just as before, the derivation is reversible. If you start by assuming Hamilton's Equations, then it is guaranteed that the Hamiltonian with be conserved.

Conclusion: If Hamilton's Equations are true (under the usual assumptions of conservative forces, no time dependence, etc.), then the Hamiltonian is conserved. And, in one dimension (plus some basic assumptions), the converse is also true: Conservation of the Hamiltonian implies Hamilton's Equations. But in general: $\{\frac{d q_i}{d t}=\frac{\partial H}{\partial p_i},\frac{d p_i}{d t}=-\frac{\partial H}{\partial q_i} \} \implies \frac{dH}{dt}=0$, but not vice versa.

EDIT: When we discuss classical mechanics, we are really talking about trajectories. In the absence of non-conservative forces, if a trajectory obeys Newton's Second Law (resp. Hamilton's Equations), then it will conserve the usual definition of energy (resp. the Hamiltonian). However, the converse is not in general true. A trajectory that conserves energy might be highly unphysical. Take as an example a ball hanging in mid-air: its energy is constant, but that's not how gravity is supposed to work.

The derivation in the original question implicitly assumed that $\dot x \neq 0$ when it was cancelled out from both terms. This additional assumption is all that is required in one dimension to derive Newton's Second Law, but in higher dimensions, more and more perverse trajectories can be invented which will conspire to conserve energy while still violating the basic precepts of classical trajectories.

$\endgroup$
10
  • $\begingroup$ Nice answer, casts a refined look on what energy conservation really is. In the end you conclude that the for a conservative system $\frac{dH}{dt}=0 \iff \frac{d q}{d t}=\frac{\partial H}{\partial p}$ and $\frac{d p}{d t}=-\frac{\partial H}{\partial q}$. Take a look at the @Qmechanics answer. There it is said that there is a discrepancy between what statement is stronger, either Conservation of energy, or Lagrange equation (or Newton's 2nd, or Hamilton's equations, since they are all equivalent) when we look at systems of different degrees of freedom. $\endgroup$
    – User198
    Commented Oct 9 at 17:50
  • $\begingroup$ Or maybe I misinterpreted that answer... I am not so sure now anymore. $\endgroup$
    – User198
    Commented Oct 9 at 17:55
  • $\begingroup$ I think that @Qmechanic is right, but moreover, I think that his objection applies even to 1D! It's true that $\frac{dE}{dt}=0$ does not strictly imply Newton's 2nd Law if you allow yourself to specify a truly perverse trajectory. For example, imagine a ball hanging in mid air without moving; this system has zero kinetic energy and constant potential energy (thus energy is conserved), but it clearly violates Newton's Second Law (even in 1D). Of course, you can fix the issue in 1D by rejecting any trajectory of the form x=const. (However, this doesn't work in higher dimensions). $\endgroup$
    – Geoffrey
    Commented Oct 10 at 4:28
  • $\begingroup$ @User198 Based on this discussion, I'm going to edit my answer. The basic point I am going to add is that when we talk about Mechanics we are really talking about trajectories. If we assume a trajectory obeys Newton's 2nd Law with only conservative forces, then it will conserve the usual definition of energy. But if we assume that a trajectory conserves energy, then it does not necessarily obey Newton's 2nd Law (as above). $\endgroup$
    – Geoffrey
    Commented Oct 10 at 4:31
  • $\begingroup$ Wait, your last sentence of your conclusion confuses me. You said: "in one dimension Conservation of the Hamiltonian implies Hamilton's Equations." and than "But in general: $\frac{dH}{dt}=0 \implies \{\frac{d q_i}{d t}=\frac{\partial H}{\partial p_i},\frac{d p_i}{d t}=-\frac{\partial H}{\partial q_i} \}$, but not vice versa." $\endgroup$
    – User198
    Commented Oct 10 at 18:32
3
$\begingroup$
  1. Assume for simplicity everywhere in this answer that the Lagrangian $L(q,\dot{q})$ does not depend explicitly on time, so that we have energy conservation, cf. e.g. this Phys.SE.

  2. With $n$ DOF, we have $n$ Lagrange equations$^1$ $$\frac{d}{dt}\frac{\partial L}{\partial\dot{q}^j}-\frac{\partial L}{\partial q^j}~\approx~0, \qquad j~\in~\{1,\ldots,n\}, $$ which then implies energy conservation $$\begin{align}\frac{dh}{dt}~:=~&\frac{d}{dt}\left(\sum_{j=1}^n\dot{q}^j\frac{\partial L}{\partial\dot{q}^j}-L\right)~=~\ldots\cr ~=~&\sum_{j=1}^n\dot{q}^j\left(\frac{d}{dt}\frac{\partial L}{\partial\dot{q}^j}-\frac{\partial L}{\partial q^j}\right)~\approx~0.\end{align} $$

  3. For $n=1$ (but not for $n\geq 2$), the opposite is true: Energy conservation implies Lagrange equation (via time differentiation). This is essentially OP's observation.

    (Of course OP recasts it in the Hamiltonian language, but that is just a matter of doubling up the number of variables and equations.)

  4. See also this related Phys.SE post.


$^1$ Here the $\approx$ symbol denotes equality modulo EOMs.

$\endgroup$
6
  • $\begingroup$ "Energy conservation implies Lagrange equation (via time differentiation)."(for 1 DOF). This sounds really interesting. 1. Does this statement have a specific name? 2. Is it an if and only if statement? 3. I was looking at some of the other answers to this question and one of them concludes: "Thus, $\frac{dH}{dt}=0$ is true (under a few restrictions) if and only if $\frac{d q}{d t}=\frac{\partial H}{\partial p}$ and $\frac{d p}{d t}=-\frac{\partial H}{\partial q}$ are also true." But you seem to say that the Conservation of energy is an implication of the Lagrange equation. $\endgroup$
    – User198
    Commented Oct 9 at 17:40
  • $\begingroup$ 4. Why does Energy conservation work as an implication of the Lagrange equation for $n=1$ but not for $n\geq 2$? 5. If it makes sense to make that question even? I don't want to question why to much to not fall into a loophole. $\endgroup$
    – User198
    Commented Oct 9 at 17:40
  • $\begingroup$ 2. No. 4. This is a misquote. $\endgroup$
    – Qmechanic
    Commented Oct 9 at 17:50
  • $\begingroup$ Ah sorry. Than I didn't understand you properly. $\endgroup$
    – User198
    Commented Oct 9 at 17:53
  • 1
    $\begingroup$ I updated the answer. $\endgroup$
    – Qmechanic
    Commented Oct 11 at 7:06
2
$\begingroup$

Hamiltonian is the energy of the system, as a function of generalized coordinate $\mathbf{q}$ and momentum $\mathbf{p}$, $H(\mathbf{q}, \mathbf{p}, t)$.

For a simple 1D harmonic oscillator,

$$q = x \qquad , \qquad p = m \dot{x} = m \dot q \qquad, \qquad H(q,p) = \frac{1}{2}\frac{p^2}{m} + \frac{1}{2} k q^2$$

whose time derivative reads,

$$0 = \frac{dH}{dt} = \frac{\partial H}{\partial p} \dot p + \frac{\partial H}{\partial q} \dot q = \frac{p}{m} \dot p + k q \dot q = \dot q ( m \ddot q + k q ) \ , $$

and thus, either the system is at rest $\dot q = 0$, or the system is governed by the 2-nd order harmonic differential equation $m\ddot q + k q = 0$.

Edit: Hamilton equations and energy conservation. $$H(q,p,t) := p \dot{q} - L(\dot{q}(q,p,t),q(t),t)$$

$$\begin{aligned} d H & = \left(\frac{\partial H}{\partial q}\right) d q + \left(\frac{\partial H}{\partial p}\right) d p + \left(\frac{\partial H}{\partial t}\right) dt = \\ & = d p \dot q + \underbrace{ p d \dot{q} - \frac{\partial L}{\partial \dot q} d \dot q}_{=0 \text{ since } p:=\frac{\partial L}{\partial \dot q}} - \frac{\partial L}{\partial q} d q - \frac{\partial L}{\partial t} dt \ , \\ \end{aligned}$$

so that by comparison, and Lagrange equation $0 = \frac{d}{dt}\left( \frac{\partial L}{\partial \dot q}\right) - \left( \frac{\partial L}{\partial q}\right) = \dot{p} -\left( \frac{\partial L}{\partial q}\right) $, you get

$$\begin{cases} \dot p = \left( \frac{\partial L}{\partial q} \right) = - \left( \frac{\partial H}{\partial q} \right) \\ \dot q = \left( \frac{\partial H}{\partial p} \right) \\ \frac{\partial H}{\partial t} = - \frac{\partial L}{\partial t} \end{cases}$$

Now, knowing these relations, we can evaluate the time derivative of a function $f(q(t),p(t),t)$ as

$$\begin{aligned} \frac{d f}{dt} & = \frac{\partial f}{\partial q} \dot q + \frac{\partial f}{\partial p} \dot p + \frac{\partial f}{\partial t} = \\ & = \frac{\partial f}{\partial q} \frac{\partial H}{\partial p} - \frac{\partial f}{\partial p} \frac{\partial H}{\partial q} + \frac{\partial f}{\partial t} = \left\{ f, H \right\} + \frac{\partial f}{\partial t} \ , \end{aligned}$$

having introduced the Poisson brackets for completeness.

Now, if $f = H$, the first term is zero and we get

$$\dfrac{d H}{d t} = \frac{\partial H}{\partial t} \ ,$$

and if the Hamiltonian doesn't explicitly depend on time $t$, $\dfrac{\partial H}{\partial t} = 0$ and energy conservation follows

$$\frac{d H}{dt} = 0 \ .$$

$\endgroup$
6
  • $\begingroup$ That is all correct. But my question is I used the equation $0 = \frac{dH}{dt}$ and just did the chain rule differentiation and ended up with $( m \ddot q + k q ) =0 $. I did not use the middle portion of your equation $\frac{\partial H}{\partial p} \dot p + \frac{\partial H}{\partial q} \dot q$ i.e. the Hamilton's equations but I rather only did a chain rule for derivative with respect to time. So it seems strange to me that I was able to obtain the same result you did, but without using the Hamilton equations, only by using the chain rule for time derivative. How is that so? $\endgroup$
    – User198
    Commented Oct 9 at 16:42
  • $\begingroup$ Sometimes you can get EOMs from conservation principles, when they hold. Usually for 1-dof systems, energy conservation is enough. $\endgroup$
    – basics
    Commented Oct 9 at 16:48
  • $\begingroup$ So it seems that for some simple systems (1dof, no dissipation) the equation $\frac{dH}{dt}=0$ is equal to the equation governing the dynamics of that system? Is there a name for that fact or can we just call it a consequence of the Hamilton's formalism? $\endgroup$
    – User198
    Commented Oct 9 at 16:49
  • $\begingroup$ It's a consequence of the Lagrangian and Hamiltonian formalism. I'm adding an edit to my answer $\endgroup$
    – basics
    Commented Oct 9 at 16:55
  • $\begingroup$ Try to have a look at the edit at the end of the answer, with the relation between Hamilton equations and energy conservation. Let me know if it's clear enough. $\endgroup$
    – basics
    Commented Oct 9 at 17:11
0
$\begingroup$

So your equation is a balance of power (energy per unit time):

The power applied by the spring is the rate of change of it's energy:

$$ \frac{dV}{dt} = \frac d{dt} \frac 1 2 kx^2 = kxv $$

While the kinetic energy absorbs/loses power:

$$ \frac{dT}{dt} = \frac d{dt} \frac 1 2 mv^2 = mva $$

Since there is no dissipation, they sum to zero:

$$ mva + kxv = 0 $$

or

$$ (ma + kx)v = 0 $$

which has a trivial solution:

$$ v(t) = 0 $$

i.e., nothing happens.

And the other equation is the force-balance equation.

Now had we started there, from force:

$$ ma + kx = 0 $$

and wanted to derive the rate of change of work from each term, since:

$$ W = \int Fdx $$

$$\frac{dW}{dt} = Fv $$

so you just multiply the forces by $v$:

$$ (ma + kx)v = 0 $$

and meet in the middle.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks, but this is not actually what I was interested in. I have no trouble in doing the steps of deriving the equation, but I was just wondering in how was I able to skip using the Lagrange or Hamilton's equations and get the answer only by using the $\frac{dH}{dt}=0$. $\endgroup$
    – User198
    Commented Oct 9 at 16:46
  • $\begingroup$ @User198 I know, that's why we didn't solve forces, nor did we find a stationary action or it's transform to a hamiltonian; rather, we balanced the power flowing between kinetic and potential energies. And we didn't use $H$, which is formally a Legendre transform of $L$. We used energy: $E=T+V$ and $dE/dt=0$ to get $dT/dt = - dV/dt$. Is that not different? $\endgroup$
    – JEB
    Commented Oct 9 at 19:29

Your Answer

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