First of all, happy Thanksgiving everyone! I hope you spend the day happily with the people you care about, and remember to spend a moment or two reflecting on the things for which you're thankful this year. Now on with the show:

Back when I first started writing this blog, I focused mostly on problem solving. The goal was to bridge the gap between popularization and textbook. I was always doubtful there was much of a market for this, but of course there are at least some interested people and especially since writing is so fun I was and am I'm more than happy to fill that gap. Over the last few months though, general grad student busyness has greatly reduced the time available for those kinds of posts. And so there's been more soft-physics kind of posts around here. Still interesting, I hope, but there's really no shortage of that sort of thing elsewhere. As such I'm going to try to improve the ratio of more in-depth fare a bit. I can't promise I'll be super consistent about it, but here's hoping y'all will bear with me!

Let's kick it off with perhaps the most important model in physics: the simple harmonic oscillator. It's ubiquitous in everything from solid state physics to quantum field theory, but when it comes right down to it, the harmonic oscillator is a spring. Its defining property is that the force acting on the spring is proportional to the displacement of the mass from equilibrium. Move the mass farther from its resting point, and the restoring force is proportionally stronger. Wikipedia has a nice image:

We can write "the force is proportional to the stretch" mathematically in the following way:

The variable x is the position of the mass on the spring, and it's a function of time. Dots denote differentiation with respect to time, so x-dot-dot is the rate of change in the rate of change of position. Sounds bad, but that's just another name for the acceleration. The spring constant (the force produced by the spring per unit of stretch beyong equilibrium) is k, the mass of the object is m. Now if you know about solving differential equations, we can actually find the particular function x(t) that satisfies that equation. Physicists usually solve this kind of equation by the method of recognition - we've seen it so much we just know what the solution is. For those who haven't seen it so much, it's the pretty much the first thing you'll learn in differential equations class, and if you don't want to take the class it's ok because the problem is not difficult and either way I'm just going to tell you the solution. ;)

The solution is thus:

Actually the solution contains k and m, but to make the equation *look* simpler, I've just substituted in omega, where it's an abbreviation for a slightly clumsier expression:

And that's the general solution, for arbitrary constants A and B. Now really that's not good enough. We might have started this oscillator off close or far from equilibrium, or we might have just let it go or given it a good shove. These initial conditions - the initial position and initial velocity - determine what A and B are for our specific physical situation. Let's go ahead and nail the situation down. Call the initial position x0. That's the value of the position at t = 0 when the clock started and the system started oscillating. At t = 0, the value being plugged into sin and cos is 0. But sin(0) = 0 and cos(0) = 1, so we see that x0 = A. Nice, that pegs one of our constants. Now do the other. To find the velocity from the position equation, we differentiate with respect to time. Doing this with the knowledge of A, we see that:

Now we're working with initial conditions, so set t = 0 again. The sin term goes to zero, the cos term goes to 1, and therefore the initial velocity v0 = B*omega. Solve for B, substitute into the general solution:

Ok, that's great but what does it mean? For starters, it means that the simple harminic oscillator *oscillates*. It repeats its motion over and over with an angular frequency of omega. We might have guessed that it would oscillate, but thanks to the math we know it does so in an exactly sinusoidal way. Further, we now know the timing of this oscillation in terms of other physical constants, and we can relate amplitudes and velocities to the initial conditions. It's quite a bit of an improvement over the qualitative "back and forth" description we might have managed without math.

Why is this post given a #1 in the title, by the way? It's because there's about a zillion different and important ways to so physics with the harmonic oscillator. Even from a purely classical perspective, there's this, the Lagrangian formulation, the Hamiltonian formulation, the Poisson bracket formulation, action-angle variables, you name it. Plenty of these are graduate level, but I think I can make the interesting in a guided-tour way for those who aren't fluent in math-speak. I plan to tackle many of these methods over the next weeks.

- Log in to post comments

omega = sqrt (k/m)

if k is negative, this becomes imaginary. Which makes total sense. You'd expect the system to zip away exponentially, and at a guess you wind up with the hyperbolic sine.

Depending on your initial conditions, yes, hyperbolic sine would be one of the possibilities. In general your solution would be A exp(γt) + B exp(-γt) where γ = iω. This gives you a hyperbolic sine if A = -B and a hyperbolic cosine if A = B.

For that matter, you can also write the solution of the original problem as C exp(iωt) + D exp(-iωt), and there are situations where this form is more convenient. Here C and D are complex numbers, and if you want the solution to be purely real they will be complex conjugates of one another. You get the cosine term out of the real part and the sine term out of the imaginary part.

Would this be something for John Wilkins's "Basic Concepts in Science" collection? I haven't checked whether he has one on the harmonic oscillator. His site, after some time at scienceblogs, is at evolvingthoughts.net.

IANAMOAP (I am not a mathematician or a physicist :-) but I thought that sin(0) was 0?

I love the "guided math" posts, incidentally. They won't garner as much comment traffic, because it's harder to come up with something cogent to write about them, but I probably speak for many when I say that we appreciate a little more signal in the blogosphere noise.

Yep, sin(0) = 0. I generally make one or two egregious typos when I do this kind of post, but among the things I'm thankful for this year are readers who catch them!

Thanks for the kind words, Winawer. Though my main focus is curious readers, it's also nice to know that the "signal" might also help out lost students using Google for some guidance.

One interesting aspect of this result is that it takes functions (sin and cos) which are usually introduced in trigonometry and shows that they are fundamental in dynamics. Experienced mathematicians and physicists are so used to this that we forget how remarkable it is that concepts introduced in the study of the static geometry of triangles are directly applicable to objects bouncing on springs or waves travelling through the air.

csrster:

As a high school Physics teacher I regularly make the connections between the lab work we do where we generate a variety of graphs that are the functions they see in their math classes. The first time they graph the x vs t data for an object accelerated by gravity and they get a parabola it is eye opening. Having also taught math I have an appreciation for the math and the fact that they often learn the functions and processes devoid of any physical context. Those who are taking a first year calculus course very quickly make the connection between the first derivative of the displacement equation and the velocity equation. Since we only deal with situations of constant velocity in the algebra based course they see that the second derivative yields a constant and it all falls into place.

I continually emphasize that they learn the math concepts in their courses because those functions describe how nature operates. When we analyze the simple harmonic oscillator in the form of a spring and they see the d, v and a functions in real time they can make the connection between a sine curve and its first and second derivatives.

Matt:

Thank you for this blog. I regularly direct my advanced students to your posts for explanations that are more cogent than what they get in their text and from me. Keep it up and thanks. For my calc based students this will be a link I send them!

One reason why the SHO is so ubiquitous in physics is because it has a quadratic potential. A Taylor expansion of

anypotential around a stable equilibrium will look like a quadratic potential to lowest order. Thus, a small perturbation of any system from a stable equilibrium will oscillate harmonically.In statistical and quantum mechanics, the SHO is also important because its kinetic and potential energy are both quadratic (in momentum and position, respectively), and this leads to simple Gaussian statistics (p(x) ~ exp(-x^2)).

Great plan.

I like the idea of doing the simple problem multiple ways, but don't overlook the interesting variations on the simple problem. One, when you add damping without a driving term, is most amenable to solution with the method mentioned by Eric in the second paragraph @2. Another, where you keep the cubic term in the small angle expansion for the pendulum version of this problem, leads to an anharmonic solution.

(related to : CCPhysicist's comment) Another fascinating thing about SHM is how it becomes like an "onion" when you make the model a bit more realistic (nonlinear spring). of course then it's not "simple" anymore.

Peeling the onion more and more layers is fascinating - you can use this to understand the true nature of "natural" sound (ever heard a perfect middle-C sine-wave? It's unnerving and very annoying. Hearing a musical instrument playing that same principal frequency is a whole different experience). It's all in

a) the shape of the waves (a violin doesn't make sine-waves), and

b) the subtle variations in frequency about the mean frequency.

c) the "strange attractor" nature of naturally-produced sound

Yes - SHM is critically important as the starting point, and can lead to many (re)discoveries for the scientifically-minded.

Discovering this stuff for students can be as simple as

- downloading Audacity (open-source)

recording a musical instrument playing (all it takes is a microphone which most laptops have built in nowdays)

- zooming into the wave-form to amaze all who may never have done this before

- generating a regular sine-wave of same frequency (trial and error, or just use the principal frequency you can get a frequency-spectrum plot of the natural sound-wave)

Play these sounds one after the other and see who likes the sine-wave.

I have found that this kind of "show me" science can light fires inside of students who begin asking questions and searching for answers.

Solving the nonlinear oscillator equations has a somewhat higher entry-barrier, but there are ways of doing this with things like Matlab and so on.

If anyone would like I'd be happy to help with some instructions, screenshots etc. on how to do the sound-wave investigation, and provide some references and sample-solutions data for the the nonlinear equation-solution.

The email address above is real but if you want to get my attention put the word SHM (no spaces or periods) in the subject-line.

I got overzealously excited about SHM and I skimmed way past the end of Matt's article, and only on re-reading do I realize that Matt is already promising to delve into the Aladdin's cave of SHM and where it leads.

Matt - sorry - I didn't mean to hijack your post and planned curriculum.

90% of physics is the harmonic oscillator. the other half is a particle in a box.

@Paul Murray

The negative sign in mx = -kx indicates that the spring force is a restoring force (one which acts in a direction opposite of displacement) rather than a constant with a value less than zero. I could be mistaken, but I believe the negative is ommitted in the equation omega = sqrt(k/x)

Matt

Thanks for your blog! It seems like every time I check it you directly address something I recently learned in mechanics. Keep being awesome and informative :)

As a frustrated university physics student, I am wondering about how to solve the differential equation analytically.

All the physics textbooks that I have looked in simply "assume" that an equation of that form will be a solution, and then check to make sure that it is.

Assuming "test" solutions and then using them seems completely unscientific and arbitrary to me. this takes away the foundation of what I thought math and physics were all about!

I will keep searching on the internet, but could you explain how to solve the differential equation without simply assuming a solution?

@John

This differential equation is in the form: d2x/dt2 +kx = 0, where k is a constant.

Using your knowledge of differential equations, solve the characteristic equation ar^2 + br + c = 0, which in this instance is r^2 = -k. r = +/- ki, where i is sqrt(-1). Let r1 = 0 + ki, r2 = 0 - ki

The general solution for a 2nd order, linear, homogeneous, differential equation is X(t) = C*e^(r1*t) + D*e^(r2*t)

In this case, r1 and r2 are complex. Use Euler's Formula now.

e^ix = cosx + isinx

e^(ki)t = coskt + i sint, e^(-ki)t = coskt - sinkt

Now really, e^r1t is e^real part * e^imaginary part, but in this case, the real part = 0, (r1 = 0 + ki). So e^r1t = (e^0)*(e^ki) = 1*e^ki.

Ok so read back up to the general solution, it was e^r1t etc., except multiplied by constants C and D. So X(t) = C(coskt + isinkt) + D(cos-kt + isin-kt) = C(coskt + isinkt) + D(coskt - isinkt) (as cos-A = cosA, sin-A = -sinA).

Rearrange to get (C+D)coskt + ((C-D)i)sinkt

So X(t) = Acoskt + Bsinkt, for new constants A and B.

Note that k here is not the same k as the spring constant, I just picked it randomly, but obviously couldn't have picked a worse letter!