Towards an intuition for the simple harmonic oscillator solution

13 minute read

The solution of the differential equation describing simple harmonic motion is often presented as-is, or “handed down from above”. Usually, there is no attempt at justifying where the mathematical solution comes from. To me, this wasn’t good enough. Here, I try to provide some intuition for the solution’s form.

Schematic setup of simple harmonic motion: A mass connected to a spring, connected to a wall.
Simple harmonic motion physical setup: a mass on a spring.

Once a physicist, always a physicist

Some friends of mine and I have been doing some undergraduate-level physics again, just for fun.1 As you do. It’s nice that we’ve now got enough distance from the pressures of studying and learning physics that we can take some time and really try to understand it. This is opposed to undergrad which was a case of trying to cope and not drown in a flood of information. In this vein, we’ve made lots of errors and hence progress has been slow. But who cares? We’ve gained more depth of understanding in what we’ve been looking at than what any of us managed to achieve at university.

Our current topic of focus has been the concept of action. To understand this better, we’ve been using the simple harmonic oscillator as an illustrative example.

Now, one way of writing the general solution of the simple harmonic oscillator is like so:

\begin{equation} x(t) = A \sin (\omega t + \phi) \end{equation}

where \(x\) is the displacement from the origin, \(A\) is the amplitude, \(\omega\) is the angular frequency of the oscillation, \(t\) is time and \(\phi\) a phase shift.

Warning: rant ahead!

This is where I got annoyed. Everyone knows that this is the solution (or at least one form thereof). When I was at university, we were provided this answer as-is without anyone explaining why. It’s like an adult answering a child’s question of “Why?” with “It just is!”. Of course, usually, the solution was presented in a much nicer way at university. I.e. something along the lines of “Let’s assume the answer and then show that it works”. It’s like beginning a journey at the end. I think this is the bit that frustrates me: how do you know that you can assume that solution? How did you get the idea to try out such a solution in the first place (assuming that one starts from only the maths and ignores the physical situation)? What intuition do you have which leads to such a conclusion? If the answer to that question is: “You’ll see with experience”, then that’s silly. After all, that’s one reason to go to university: to get the benefit of the experience of those who have gone before us. That’s how we get to stand on the shoulders of giants.

Also, almost all books on differential equations2 simply state the answer as a given. Sort of like knowledge that has been handed down by an appropriate celestial being that is just known and doesn’t need to be questioned.

As it turns out, this is knowledge handed down by a kind of celestial being. It was Euler’s intuition. But more on that later.

A popular comic on lecturer’s office doors, when I was at university, showed two mathematicians staring at a blackboard, with one pointing at part of the calculation, which reads “Then a miracle occurs” and making the comment “I think you need to be more explicit here in step two”. Here is said cartoon:3

Comic showing two mathematicians, one pointing at a suspicious jump in a calculation

That’s what it felt like when presented with “let’s assume we know the solution” demonstrations. It seemed miraculous and I came away lacking any understanding as to why, and that irked me.

My issue here is not with the physical intuition–that’s obvious to anyone who’s tugged on a spring and seen it bounce back and forth. My issue is rather with the mathematics. Where is the mathematical intuition leading to this solution when only considering the equations of motion? That’s what was unclear to me.

I guess that’s enough of me bemoaning this particular situation. It’s time I move on and find my own perspective. Let’s see what I came up with.

Setting up the scene

I’m stubborn.4 Along with that and the frustration of not having had much of any intuition imparted to me, I set out to find out more myself. What follows is my attempt to form an intuition for why we get a sinusoid for the solution of the differential equation describing a simple harmonic oscillator.

Let’s understand the physical problem we’re trying to solve. Imagine an object of mass \(m\) attached to a spring. One end of the spring is connected to an immovable wall and the mass slides along a frictionless surface. The motion of the mass is confined to the \(x\)-direction and the stiffness of the spring is characterised by its spring constant, \(k\).5

Diagram of mass on a spring model for simple harmonic
oscillation

If we move the mass away from the equilibrium position, the restoring force due to the spring is given by Hooke’s law:

\begin{equation} F_H = -k x. \end{equation}

This force accelerates the mass towards its equilibrium position, which we are defining to be the position of zero amplitude. Thus, this force is equal to the force described by Newton’s second law, i.e.:

\begin{equation} F_N = m a. \end{equation}

Setting these two quantities equal to one another, we have

\[\begin{align} F_N &= F_H\\ \Rightarrow ma &= -kx\\ \Rightarrow m \ddot{x} &= -k x \label{eq:sho-diff-eqn} \end{align}\]

where we only consider motion in the \(x\)-direction.

Ensuring the perfect conditions

We require a solution which satisfies this equation as well as the boundary conditions:

\[\begin{align} x(t_1) &= 0\\ x(t_2) &= A. \end{align}\]

Considering (\ref{eq:sho-diff-eqn}), we can see that the second derivative of the solution with respect to time needs to be equal to the negative of the solution itself (up to a factor). We know that a sine function has this property:6

\[\begin{align} x(t) &= \sin(t)\\ \ddot{x}(t) &= -\sin(t). \end{align}\]

This is our first hint at an intuition for why the solution is a sinusoid: we need the solution and its second derivative to balance each other out. It’s also why the second derivative must be the negative (up to a factor) of the proposed solution. It just so happens that a sine function has this desired property.

With this idea in mind, we pull the following solution out of the hat propose the following solution:7

\begin{equation} x(t) = A \sin(\omega t + \phi) \end{equation}

where the parameters are as described earlier.

We can see that this equation satisfies the boundary conditions if we set \(\phi = 0\):

\[\begin{align} x(t_1 = 0) &= A \sin(\omega \cdot 0) = 0\\ x \biggl( t_2 = \frac{\pi}{2 \omega} \biggr) &= A \sin \biggl( \omega \cdot \frac{\pi}{2 \omega} \biggr) = \sin \biggl( \frac{\pi}{2} \biggr) = A \end{align}\]

where we’ve defined \(t_2\) in terms of \(\omega\) to be the end of a quarter oscillation of the sine function.

With this solution, we have the following equations for the position, velocity, and acceleration:

\[\begin{align} x(t) &= A \sin (\omega t)\\ \label{eq:sho-position} \dot{x}(t) &= \omega A \cos (\omega t)\\ \ddot{x}(t) &= -\omega^2 A \sin (\omega t) \label{eq:sho-acceleration} \end{align}\]

Inserting (\ref{eq:sho-position}) and (\ref{eq:sho-acceleration}) into the force relation (\ref{eq:sho-diff-eqn}), we have:

\[\begin{align} -m \omega^2 A \sin (\omega t) &= -k A \sin (\omega t)\\ \Rightarrow m \omega^2 &= k\\ \Rightarrow \omega^2 &= \frac{k}{m}\\ \Rightarrow \omega &= \sqrt{\frac{k}{m}} \end{align}\]

which is the familiar result for the angular velocity of a simple harmonic oscillator in terms of the spring constant, \(k\), and the object’s mass, \(m\).

That’s all well and good. We’ve trodden a very well-worn path: we showed that the answer we assumed to be true worked. But where did we get that from? What led us to choosing that answer?

Digging deeper

As mentioned above, I wasn’t satisfied with the usual “let’s assume we know the answer and then show that it works” method of solving the differential equation in (\ref{eq:sho-diff-eqn}). Thus, I went on a bit of a hunt for intuitive ways of understanding how this becomes a solution. I found that almost no-one provides an intuition for why

\begin{equation} x(t) = A \sin (\omega t + \phi) \end{equation}

is a general solution to (\ref{eq:sho-diff-eqn}): it is simply stated. Perhaps this has something to do with there being no general process for finding solutions to differential equations. There are some known ways to tackle particular forms but, in general, solving things seems to be a mix of experience and squinting at the problem from the right angle.

The closest I’ve gotten to a good explanation is from A Modern Introduction to Differential Equations (3rd. edition) by Henry J. Richard. In Chapter 4, he discusses second- and higher-order equations. Page 144 contains the comment that

If we consider a homogeneous first-order linear equation with constant coefficients, \(a y' + b y = 0\), where \(a \neq 0\), we know that the general solution is \(y = C e^{-\frac{b}{a} t}\). In 1739, aware of this solution, Euler proposed solving an \(n\)th-order homogeneous linear equation with constant coefficients by looking for solutions of the form \(y = e^{\lambda t}\), where \(\lambda\) is a constant to be determined.

In other words, Euler had some insight back in the 18th century and we’ve taken that for granted ever since. Given that the insight comes from Euler, it’s not a bad idea to use it.8 Still, it’d be nice if this way of looking at things were better known.

Searching for understanding

As far as I can tell, the main insight is that the exponential function differentiates to itself multiplied by a constant. This reflects the observation we made earlier that the second derivative of a sine is a negative sine. In other words, if we begin with the exponential function as a guess for the solution:

\begin{equation} x = e^{\lambda t}, \end{equation}

then we get the first and second derivatives like so:

\[\begin{align} \dot{x} &= \lambda e^{\lambda t}\\ \ddot{x} &= \lambda^2 e^{\lambda t}. \end{align}\]

I think this is what we’re after. The search for a solution involves looking for particular properties of functions and seeing if they fit the problem. It’s like doing a jigsaw puzzle where you’re looking for that single piece out of thousands that fits the current situation just so.

With this trial solution and its derivatives, we can write the homogeneous linear second-order differential equation

\begin{equation} a \ddot{x} + b \dot{x} + c x = 0 \end{equation}

in terms of these derivatives:

\begin{equation} \Rightarrow a \lambda^2 e^{\lambda t} + b \lambda e^{\lambda t} + c e^{\lambda t} = 0. \end{equation}

Given that \(e^{\lambda t}\) doesn’t equal zero, we can cancel out the terms in the exponential to give

\begin{equation} a \lambda^2 + b \lambda + c = 0. \end{equation}

This is known as the characteristic equation of the differential equation. Since this is a quadratic equation, we know that it has two solutions, namely

\begin{equation} \lambda = \frac{-b \pm \sqrt{b^2 - 4 a c}}{2a}. \end{equation}

There are three possibilities for what these roots could be:

  • Either they are both different real numbers,
  • Or they are equal real numbers (i.e. the roots are degenerate; there’s also a tricky way to work out the general solution in this case, which (again) Euler worked out yonks ago),
  • Or they are complex numbers.

It turns out that for the simple harmonic oscillator case, they’re complex numbers. Let’s see that now.

A complex situation

Inserting the trial solution \(x = e^{\lambda t}\) and its second derivative into (\ref{eq:sho-diff-eqn}) we get

\[\begin{align} &m \lambda^2 e^{\lambda t} + k e^{\lambda t} = 0\\ \Rightarrow \quad &\lambda^2 e^{\lambda t} + \frac{k}{m} e^{\lambda t} = 0\\ \Rightarrow \quad &\lambda^2 + \frac{k}{m} = 0\\ \Rightarrow \quad &\lambda = \sqrt{-\frac{k}{m}}\\ \Rightarrow \quad &\lambda = i \sqrt{\frac{k}{m}}. \end{align}\]

This might look a bit dodgy because of the \(i\), but if we plug \(\lambda\) into our trial solution, we get

\begin{equation} x = e^{i \sqrt{\frac{k}{m}} t} \end{equation}

Now, if we define the angular frequency, \(\omega\), like so:

\begin{equation} \omega = \sqrt{\frac{k}{m}} \end{equation}

then we get

\begin{equation} x = e^{i \omega t} \end{equation}

which (again, thanks to Euler, crikey was he a busy boy!) one can write as

\begin{equation} x = \cos (\omega t) + i \sin (\omega t). \end{equation}

This, because of the cosine and sine, describes sinusoidal behaviour. And I guess that’s it. Sinusoidal motion has sort of popped out of the insight that the exponential function keeps differentiating to effectively itself and that was a handy property to have when looking for a solution. It’s almost an anti-climax.

Alternatively, we could assume that the proposed solution uses \(i \lambda\) in the exponent instead of only \(\lambda\), then the result is a bit clearer.9 The solution and its derivatives are:

\[\begin{align} x &= e^{i \lambda t}\\ \dot{x} &= i \lambda e^{i \lambda t}\\ \ddot{x} &= - \lambda^2 e^{i \lambda t}. \end{align}\]

Where we see more clearly this nice property that the second derivative is the negative (up to a factor) of the solution itself.

Using the solution and its second derivative, we get

\[\begin{align} &- m \lambda^2 e^{i \lambda t} + k e^{i \lambda t} = 0\\ \Rightarrow \quad &-\lambda^2 e^{i \lambda t} + \frac{k}{m} e^{i \lambda t} = 0\\ \Rightarrow \quad &-\lambda^2 + \frac{k}{m} = 0\\ \Rightarrow \quad &\lambda = \sqrt{\frac{k}{m}}. \end{align}\]

This seems a bit more direct, but yeah, I’m using knowledge of the solution to make it seem more direct, and this was my criticism from earlier. Oh well.

Chasing my tail?

So what can I conclude? Well, it looks like the oscillatory nature simply comes out in the wash. This seems to be a consequence of the insight that differentiating an exponential function gives you back the exponential function (modulo some constant), which makes your life easier when looking for a solution. Also, because we have this form for the differential equation

\begin{equation} \ddot{x} + K x = 0 \end{equation}

where \(K \geq 0\),10 then the solution of the characteristic equation has complex roots which in turn gives a differential equation solution with sinusoidal oscillations. Quod erat demonstrandum. Erm, hopefully.

I feel like I’m going around in circles, but maybe that’s just because everything is internally consistent, so if you start at one point you naturally end up at the other.

I think I’m at the end of my journey. Perhaps the answer is so banal that no-one can be bothered explaining it. Maybe Euler’s insight got lost in the hundredth or thousandth retelling? Dunno. Either way, I’m more satisfied with my understanding of where the solution comes from now, even if I do feel like I’m chasing my tail!

  1. As one of my high-school teachers would have put it: “phun”. Ironically, it wasn’t one of my high-school physics teachers who said that. 

  2. And there are lots of books about differential equations! Wow! I mean, how many perspectives on that topic do you need? So yeah, I searched through quite a few while looking into this issue. 

  3. The comic was by cartoonist Sidney Harris

  4. In a good way, honest! Once I get my teeth into a problem, I tend not to give up until I’ve worked out the root cause and have a solution. Maybe you’ve got some bug you can’t crack? If so, give me a yell! I’m available for Perl and Python development and maintenance work. Send an email to paul@peateasea.de

  5. Given the number of simplifying assumptions we’re making here (frictionless surface, immovable wall, the spring stiffness described by a constant) it’s amazing that this setup approximates so many physical situations so well. 

  6. This property we have to know from experience, unfortunately. Such experience comes from having done many exercises at high school involving derivatives of sines and cosines. 

  7. I had a funny maths lecturer at university who would often use the phrase “And it is easy to show that…” followed by the comment (said in a conspiratorial fashion) “We know it’s not easy to show, but we’ll continue anyway”. Whereupon he’d do a little chuckle to himself. Given how dry the material was, this was amusing. He was a nice bloke, too; one of my favourite lecturers. 

  8. Yes, that was an understatement. 

  9. Although I realise I’m myself running into the problem of “given I know the solution, let’s just use it and show that it works”. I guess it’s an easy trap to fall into. 

  10. Note that if \(K < 0\) then the solution is no longer obviously sinusoidal: it turns out to be a linear combination of hyperbolic functions. TIL. 

Support

If you liked this post and want to see more, please buy me a coffee!

buy me a coffee logo

Categories:

Updated: