# Energy conservation in SHM

I am struggling to get my head around a seemingly very simple problem, energy conservation in SHM.

Let's say my solution is $$x(t) = A\sin \omega_0 t,$$ the Kinetic Energy is given by $$KE = \frac{1}{2}mv^2 = \frac{1}{2}m\omega_0^2A^2\cos^2\omega_0 t,$$ and the elastic potential energy is $$ePE = \frac{1}{2}kx^2 = \frac{1}{2}kA^2\sin^2\omega_0 ,$$ such that $$KE + ePE = const$$.

What about gravitational potential energy gPE?

$$gPE = mgx = mgA\sin\omega_0 t,$$ which now gives that the total energy is not conserved: $$KE + ePE + gPE = const + mgA\sin\omega_0 t$$

Could it be that energy is not conserved? Where does the gravitational potential energy go?

• Is the harmonic oscillator a spring perpendicular to the floor? If so, your solution is not correct. You have a driven harmonic oscillator by a constant force. The differential equation is $$\ddot{x} = -\omega_0x \pm \frac{g}{m}$$ with the sign chosen depending on choice of coordinates – JonTrav1 Nov 12 '16 at 16:42

So you have your equation of motion about the static equilibrium position $\ddot x = - \omega_o^2 x$ with a simple solution $x=A \sin (\omega_o t)$ and $\dot x=A \omega_o \cos (\omega_o t)$ where $x$ is the displacement of the mass $m$ from the static equilibrium position and $\omega_o^2 = \frac k m$ where $k$ is the spring constant.

The static equilibrium condition is $mg-ky_o = 0$ where the extension of the spring is $y_o$.
Also if the extension of the spring is $y$ then $y=x+y_o$.

To consider energy one needs to define the system.
The system could be the mass alone, the spring and the mass, or the spring, the mass and the Earth.
The last of these in the only system which allows you to use gravitational potential energy $”= mg \Delta h”$ assuming that the Earth’s mass is much greater than the mass at the end of the spring and this is the system that is going to be considered.

Assume that the zero of elastic and gravitational potential energy is when the spring is unextended.
When the mass is at a displacement $x$ from the static equilibrium position then, using $mg-ky_o = 0$, the sum of the elastic and potential energies is

$\frac 1 2 k (x+y_o)^2 -mg(x+y_o) = -\frac 1 2 ky_o^2 + \frac 12 k x^2$.

So at any instant the total energy of the system (mass, spring and Earth) is

$-\frac 1 2 ky_o^2 + \frac 12 k x^2 + \frac 12 m\dot x^2$.

$\frac 12 k x^2 + \frac 12 m\dot x^2 = \frac 12 m \omega^2 A^2$ and this is the energy associated with the simple harmonic motion, which is constant.

Then one has to add a constant term $-\frac 1 2 k y_o^2$ to get the total energy of the system to show that the energy of the system is constant.

I am assuming that you are considering the situation of a object hung on the end of a spring and vibrating vertically.

When you say $$x(t) = A\sin \omega_0 t$$ you mean $x=0$ when the object is at the equilibrium position i.e. where the upwards spring force balances the weight of the vibrating object. But, when you say $$ePE = \frac{1}{2}kx^2$$ you are using x as the amount of stretch in the spring from its natural unstretched length. The thing is, these two uses of $x$ are inconsistent. When the object is at the equilibrium position the spring is stretched. You would have to use $$ePE = \frac{1}{2}k(x+\frac{mg}{k})^2.$$

Now, the interesting thing is, if you do what you did you as you found the sum of the kinetic and elastic potential energies (not including gravitational potential energy) will be constant.

The problem is that a pendulum is only approximately SHM, not exactly. Take the limit of small x in your expressions (so cosine is 1 - 0.5 theta^2 and sine is just theta), and you'll get energy conservation. It's not that energy isn't exactly conserved, it's that you can't treat the general SHM solution as exact.

• How exactly, I would get $gPE \propto \theta$, $KE \propto 1 - \theta^2$ and $ePE \propto \theta^2$ so I get a net term $\propto \theta$... – SuperCiocia Nov 12 '16 at 17:04
• Your x coordinate is height, but that's an unusual coordinate to use. theta is the angle that the pendulum has swung away from vertical, that's a better coordinate. Then mgx turns into mgL/2 times theta squared. – Ken G Nov 12 '16 at 22:37
• @SuperCiocia There is nothing in the OP which says the question is about a pendulum, or an approximation to SHM that is only valid for small displacements. – alephzero Nov 12 '16 at 23:10
• Oh, you're right, I assumed that because otherwise gravity isn't doing anything interesting. For a spring hanging vertically, gravity only shifts the equilibrium, it has no other effect at all. The other answer nails it. – Ken G Nov 13 '16 at 0:18