# Simple Harmonic Motion

I came across an interesting approach to a problem involving a spring the other day, and it made me wonder if I could derive the equations for simple harmonic motion. The basic principle of a spring is Hooke’s law, that the spring exerts a restoring force proportional to its displacement from equilibrium position: F = –kx, where k is the spring constant representing the stiffness of the spring. I wondered if I could derive the formulas for its motion, and where the sinusoidal components would appear from, since clearly there are no trigonometric functions in this basic equation. To begin with, from Newton’s second law, F = ma:

$\displaystyle ma = -kx$

$\displaystyle a = -\frac{kx}{m}$

We know that acceleration is the derivative of velocity and velocity is the derivative of position:

$\displaystyle a = \frac{dv}{dt}$

and

$\displaystyle v = \frac{dx}{dt} .$

We can rewrite these as a dt = dv and v dt = dx, and integrate. However, our acceleration equation has a in terms of position x, not time t, so I would prefer to integrate with respect to x (as at this point I don’t know how x depends on t — that’s what we’re trying to derive!).

$\displaystyle a \, dt = dv$

$\displaystyle a \left( \frac{dx}{v} \right) = dv$

$\displaystyle a \, dx = v \, dv$

This equation is well-known and could have been used as a starting point, but it’s nice to derive it from the most basic principles. We can now substitute our expression in for a and integrate both sides.

$\displaystyle -\frac{kx}{m} \, dx = v \, dv$

$\displaystyle \int \! \left( -\frac{kx}{m} \right) \, dx = \int \! v \, dv$

$\displaystyle -\frac{k}{m} \int \! x \, dx = \int \! v \, dv$

$\displaystyle -\frac{k}{m} \left( \frac{x^2}{2} + C_1 \right) = \frac{v^2}{2} + C_2$

Let’s solve this for v:

$\displaystyle \frac{v^2}{2} + C_2 = -\frac{k}{m} \left( \frac{x^2}{2} + C_1 \right)$

$\displaystyle \frac{v^2}{2} + C_2 = -\frac{kx^2}{2m} + C_3$

$\displaystyle \frac{v^2}{2} = -\frac{kx^2}{2m} + C_4$

$\displaystyle v^2 = -\frac{kx^2}{m} + C_5$

$\displaystyle v = \pm \sqrt { -\frac{kx^2}{m} + C_5 }$

There’s still no sign of sine appearing anywhere (I know; I couldn’t resist). I’m also a bit uncomfortable with the plus/minus sign, but velocity can be both positive and negative, so I don’t think that discarding the negative solution is justified. I want to integrate again to remove the velocity, but we face a similar problem as before: we have velocity in terms of position x, not time t. We can rearrange the differential again:

$\displaystyle v = \frac{dx}{dt}$

to get v on the dx side:

$\displaystyle dt = \frac{dx}{v} .$

Let’s substitute in our expression for v, and integrate:

$\displaystyle dt = \frac{dx}{\pm \sqrt { -\frac{kx^2}{m} + C_5 } }$

$\displaystyle \int dt = \int \! \frac{dx}{\pm \sqrt { -\frac{kx^2}{m} + C_5 } }$

This is not pretty, and I’m not sure how to integrate the right side. I believe I can pull out the plus/minus as a constant.

$\displaystyle t + C_6 = \pm \int \! \frac{dx}{\sqrt { -\frac{k}{m} x^2 + C_5 } }$

I had to consult a table of integrals for assistance with this integration. Of course, it can be solved with trignometric substitution! All of a sudden, we have a hint of where a sine function will appear. We need to get the radical in the form $\sqrt{a^2 - b^2 x^2 }$:

$\displaystyle \sqrt{C_5 - \frac{k}{m} x^2 }$

$\displaystyle a = \sqrt{C_5} = C_7$

$\displaystyle b= \sqrt{\frac{k}{m}}$

Now, we set

$\displaystyle x = \frac{a}{b} \sin \theta :$

$\displaystyle x = C_7\sqrt{\frac{m}{k}}\sin \theta$

Let’s now take our original integral back, and start substituting.

$\displaystyle t + C_6 = \pm \int \! \frac{dx}{\sqrt { C_5 -\frac{k}{m} x^2 } }$

$\displaystyle t + C_6 = \pm \int \! \frac{dx}{\sqrt { {C_7}^2 -\frac{k}{m} x^2 } }$

$\displaystyle t + C_6 = \pm \int \! \frac{dx}{\sqrt { {C_7}^2 -\frac{k}{m} \left( C_7\sqrt{\frac{m}{k}}\sin \theta \right) ^2 } }$

This expression is complicated, but I can already see how it will simplify out.

$\displaystyle t + C_5 = \pm \int \! \frac{dx}{\sqrt{ {C_7}^2 - \frac{k}{m} \cdot {C_7}^2 \cdot \frac{m}{k} \cdot \sin^2 \theta} }$

$\displaystyle t + C_5 = \pm \int \! \frac{dx}{\sqrt{ {C_7}^2 - {C_7}^2 \sin^2 \theta } }$

$\displaystyle t + C_5 = \pm \int \! \frac{dx}{\sqrt{{C_7}^2 (1 - \sin^2 \theta)} }$

$\displaystyle t + C_5 = \pm \frac{1}{C_7} \int \! \frac{dx}{\sqrt{1 - \sin^2 \theta} }$

Let’s convert the dx to a dθ:

$\displaystyle x = C_7\sqrt{\frac{m}{k}}\sin \theta$

$\displaystyle \frac{dx}{d\theta} = C_7\sqrt{\frac{m}{k}}\cos \theta$

$\displaystyle dx = C_7\sqrt{\frac{m}{k}}\cos \theta \, d\theta$

Substituting this back in yields:

$\displaystyle t + C_5 = \pm \frac{1}{C_7} \int \! \frac{C_7\sqrt{\frac{m}{k}}\cos \theta \, d\theta }{\sqrt{1 - \sin^2 \theta} }$

$\displaystyle t + C_5 = \pm \frac{C_7}{C_7}\sqrt{\frac{m}{k}}\int \! \frac {\cos \theta}{\sqrt{1 - \sin^2 \theta}} d\theta$

$\displaystyle t + C_5 = \pm \sqrt{\frac{m}{k}}\int \! \frac{\cos \theta}{\sqrt{\cos^2 \theta}} d\theta$

$\displaystyle t + C_5 = \pm \sqrt{\frac{m}{k}}\int \! \frac{\cos \theta}{\cos \theta} d\theta$

$\displaystyle t + C_5 = \pm \sqrt{\frac{m}{k}}\int d\theta$

$\displaystyle t + C_5 = \pm \theta \sqrt{\frac{m}{k}} + C_8$

$\displaystyle t + C_9 = \pm \theta \sqrt{\frac{m}{k}}$

Remembering our equation for x in terms of θ:

$\displaystyle C_7\sqrt{\frac{m}{k}}\sin \theta = x$

$\displaystyle \sqrt{\frac{m}{k}}\sin \theta = C_{10}x$

$\displaystyle \sin \theta = C_{10}x\sqrt{\frac{k}{m}}$

$\displaystyle \theta = \arcsin \left(C_{10}x\sqrt{\frac{k}{m}} \right)$

Finally, we can substitute this back in for θ and solve for x:

$\displaystyle t + C_9 = \pm \left[ \arcsin \left(C_{10}x\sqrt{\frac{k}{m}} \right) \right] \sqrt{\frac{m}{k}}$

$\displaystyle \pm t\sqrt{\frac{k}{m}} + C_{11} = \arcsin \left(C_{10}x\sqrt{\frac{k}{m}} \right)$

The plus-minus is driving me crazy, but I can’t justify dropping it — even though I want to.

$\displaystyle \sin \left( \pm t\sqrt{\frac{k}{m}}+ C_{11} \right) = C_{10}x\sqrt{\frac{k}{m}}$

Actually, I think I can get rid of it now! Since sin(-x) = -sin(x) = sin(x+π), I can incorporate the +π into the constant!

$\displaystyle C_{10}x\sqrt{\frac{k}{m}} = \sin \left( t\sqrt{\frac{k}{m}} + C_{12} \right)$

$\displaystyle x = C_{13} \sin \left( t\sqrt{\frac{k}{m}} + C_{12} \right)$

Let’s rewrite this equation using the conventional symbols for the constants.

$\displaystyle x = A \sin \left( t\sqrt{\frac{k}{m}} - \varphi \right)$

There it is. The basic sine wave equation is readily apparent, with the constants representing the amplitude and the phase shift, and the radical representing the angular frequency. The fourth possible constant (a “+ D”) is absent, and I wondered if I had accidentally dropped a constant somewhere — since that entire family of curves should be solutions. That is, x should be able to oscillate around 1, -5, whatever. But the reason for its absence is our starting point of Hooke’s law, F=-kx, which assumes that the equilibrium point is x=0. We would have had to start with F=-k(xxeq) to have had that last constant.

It’s pretty neat to see the equation emerge from just four basic equations: Hooke’s law F = –kx, Newton’s second law F=ma, and the definitions of velocity and acceleration v=x′ and a=v′!