4

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.)?

M. A.
  • 2,039
  • 5
  • 11
  • 28
User198
  • 1,456

4 Answers4

4

[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.

Geoffrey
  • 5,556
3
  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.

Qmechanic
  • 220,844
2

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 \ .$$

basics
  • 13,368
0

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.

JEB
  • 42,131