The Physics
Opus in profectus

Simple Harmonic Oscillator

search icon


Trust me. It's simple.

Start with a spring resting on a horizontal, frictionless (for now) surface. Fix one end to an unmovable object and the other to a movable object. Start the system off in an equilibrium state — nothing moving and the spring at its relaxed length.

Now, disturb the equilibrium. Pull or push the mass parallel to the axis of the spring and stand back. You know what happens next. The system will oscillate side to side (or back and forth) under the restoring force of the spring. (A restoring force acts in the direction opposite the displacement from the equilibrium position.) If the spring obeys Hooke's law (force is proportional to extension) then the device is called a simple harmonic oscillator (often abbreviated sho) and the way it moves is called simple harmonic motion (often abbreviated shm).

Begin the analysis with Newton's second law of motion.

F = ma

There is only one force — the restoring force of the spring (which is negative since it acts opposite the displacement of the mass from equilibrium). Replace net force with Hooke's law. Replace acceleration with the second derivative of displacement.

− kx = m  d2x

Rearrange things a bit.

−  k  x =  d2x
m dt2

This is a second order, linear differential equation. On the left side we have a function with a minus sign in front of it (and some coefficients). On the right side we have the second derivative of that function. The solution for this equation is a function whose second derivative is itself with a minus sign. We have two possible functions that satisfy this requirement — sine and cosine — two functions that are essentially the same since each is just a phase shifted version of the other. When a trig function is phase shifted, it's derivative is also phase shifted. Nothing else is affected, so we could pick sine with a phase shift or cosine with a phase shift as well.

Trigonometric functions and derivatives
function 1st derivative 2nd derivative
  f(x) = +sin x  
d f(x) = +cos x
d2 f(x) = −sin x
f(x) = +cos x  
d f(x) = −sin x
d2 f(x) = −cos x

I think I'll go with the sine function and add an arbitrary phase shift or phase angle or phase (φ, "phi") so that our analysis covers sine (φ = 0), cosine (φ = π2), and everything in between (φ = whatever). From a physical standpoint, we need a phase term to accommodate all the possible starting positions — at the equilibrium moving one way (φ = 0), at the equilibrium moving the other way (φ = π), all the way over to one side (φ = π2), all the way over to the other side (φ = 2), and everything in between (φ = whatever).

physical description phase shift
starting at equilibrium,
moving forward
(initial phase)
0 radian
all the way over to one side,
stopped instantaneously
π2 radian
return to equilibrium,
moving backward
π radian
all the way over to the other side,
stopped instantaneously
2 radian
return to equilibrium,
moving forward
2π radian

We also need coefficients to handle the units. The solution to our differential equation is an algebraic equation — position as a function of time (x(t)) — that is also a trigonometric equation. All the trig functions are ratios, which makes them dimensionless (the more precise mathematical term) or unitless (the term I prefer). The only unit you can really put into a trig function is the radian. From the mathematical definition, an angle (φ) is the ratio of arc length (s) to radius (r). Using SI units would give us meters over meters, which dimensional analysis reduces to nothing. In a sense, a radian is a unit of nothing.

φ =  s  ⇒ 

rad =  m  = "unitless"

r m

The way around this is to add a coefficient that changes our input variable (time) into something a trig function can handle (radians). That thing is called angular frequency, which in this case is the rate of change of the phase angle (φ) with time (t). Its symbol is lowercase omega (ω).

ω =  dφ

The SI unit of angular frequency is the radian per second, which reduces to an inverse second since the radian is dimensionless.

rad  =  1  = s−1

s s

I personally hate this quantity. It has no physical meaning — in this context. Angular frequency is great for systems that rotate (spin) or revolve (travel around a circle), but our system is oscillating (moving back and forth). How does one thing relate to another? Since the short answer is "abstractly" the reasonable thing to do is to avoid ω altogether and use a coefficient grounded in physical reality.

A periodic system is one in which the time between repeated events is constant. (A system where the time between repeated events is not constant is said to be aperiodic.) The time between repeating events in a periodic system is called a period. Mathematically, it's the time (t) per number of events (n). The symbol for period is a capital italic T although some professions prefer capital italic P.

T =  t

The SI unit of period is the second, since the number of events is unitless.

s =  s


Frequency is the rate at which a periodic event occurs. Mathematically, it's the number of events (n) per time (t). The symbol for frequency is a long f but a lowercase italic f will also do. (These characters are often identical in some fonts.)

f =  n

The SI unit of frequency is the inverse second, which is called a hertz (Hz) in honor of Heinrich Hertz, the 19th century German physicist who confirmed the existence of radio waves.

Hz =  1  = s−1


Period and frequency are inverses of one another. Of course they are also inversely proportional, but this misses the point. They are inversely proportional with a coefficient of proportionality of one (with no unit). Therefore, no coefficient is needed to make their inverses equal. They are absolutely and perfectly reciprocal.

f =  1 T =  1
T f

Back to the differential equation. It's solution is sine with a phase shift. Time is the input variable into a trig function. Trig functions can't accept numbers with units. The fix is to use angular frequency (ω). Angular frequency has no physical reality. Frequency (f) does, however. Angular frequency counts the number of radians per second. Frequency counts the number of events per second. A sequence of events that repeats itself is called a cycle. The sine function repeats itself after it has "moved" through 2π radians of mathematical abstractness. The motion of a simple harmonic oscillator repeats itself after it has moved through one complete cycle of simple harmonic motion.

ω =  φ  =  2π radian
t 1 period
f =  n  =  1 cycle
t 1 period

Divide one equation by the other…

   =  2π radian  =  2π radian
ω 1 period
f 1 cycle 1 cycle
  1 period

Recall that both radians and cycles are unitless quantities, which means…

ω  =  2π radian  = 
f 1 cycle 1

and thus…

ω = 2πf

Multiplying either side of this equation by time eliminates the unit from the input side of the equation. But what about the output side? The output of the sine function is a unitless number that varies from +1 to −1. Our differential equation needs to generate an algebraic equation that spits out a position between two extreme values, say +A and A. I like the symbol A since the extreme value of an oscillating system is called its amplitude and amplitude begins withe the letter a. Amplitude uses the same units as displacement for this system — meters [m], centimeters [cm], etc. Multiply the sine function by A and we're done. Here's the general form solution to the simple harmonic oscillator (and many other second order differential equations).

x = A sin(2πft + φ)


x =  position [m, cm, etc.]
A =  amplitude [m, cm, etc.]
f =  frequency [Hz]
t =  time [s]
φ =  phase [rad]

I said that this algebraic equation was a solution to our differential equation, but I never proved it. I should probably do that. Doing so will show us something interesting. Begin with the equation…

x = A sin(2πft + φ)

Find its first derivative…

dx  = 2πfA cos(2πft + φ)

so we can find its second derivative…

d2x  = −4π2f2A sin(2πft + φ)

Feed the equation and its second derivative back into the differential equation…

−  k  x =  d2x
m dt2

like this…

−  k  A sin(2πft + φ) = −4π2f2A sin(2πft + φ)

then simplify. Both variables cancel out (along with a lot of other stuff) which implies that we have found a good solution. We are left with this…

k  =  2f2

Now the interesting part. Solve for frequency…

f =  1  √ k

And while we're at it, invert frequency to get period…

T = 2π√ m

Simple harmonic motion evolves over time like a sine function with a frequency that depends only upon the stiffness of the restoring force and the mass of the mass in motion. A stiffer spring oscillates more frequently and a larger mass oscillates less frequently. You could also describe these conclusions in terms of the period of simple harmonic motion. A heavier mass oscillates with a longer period and a stiffer spring oscillates with a shorter period. Frequency and period are not affected by the amplitude. An sho oscillating with a large amplitude will have the same frequency and period as an identical sho oscillating with a smaller amplitude.

phase angle

Position and time are some variables that describe motion (in this case, shm). Frequency and period are properties of periodic systems (in this case, an sho). Amplitude and phase are coefficients that are found in equations of periodic motion that are determined by the initial conditions (in this case, the initial position and initial velocity of an sho).

Begin with the equation for position. Substitute in any arbitrary initial position x0 (ex nought), but for convenience call the initial time zero.

x = A sin(2πft + φ)
x0 = A sin φ

Next, do something similar with the first derivative of position — better known as velocity. Substitute in any arbitrary initial velocity v0 (vee nought)

v = 2πfA cos(2πft + φ)
v0 = 2πfA cos φ

Divide initial position by initial velocity.

x0  =  A sin φ  =  tan φ
v0 fA cos φ f

Phase angle is related to the ratio of initial position to initial velocity like so…

tan φ = 2πf  x0

Recall that frequency is determined by the spring constant and the mass.

f =  1  √ k

Phase angle can also be written like this…

tan φ =  x0  √ k
v0 m

and even like this…

tan φ = √ kx02

Look familiar? How about if I do this?

tan φ = √ ½kx02

The phase angle is related to the ratio of the initial elastic potential energy to the initial kinetic energy.

tan φ = √ U0

Almost, but not quite. When I moved the initial position and initial velocity under the radical sign I squared them. This is not quite correct. When I did that I destroyed the sign information in the two initial conditions. (Kinetic and elastic potential energies are always positive.) Those signs are used to determine which quadrant the phase angle lies in.

Phase angle location
v0 +v0
+x0 2nd quadrant
1st quadrant
x0 3rd quadrant
4th quadrant