## Harmonic oscillator – classical physics

Required math: calculus

Required physics: Newton’s law

The most common example of a system exhibiting harmonic oscillation is that of a mass on a spring. If you want to keep an image in your mind as we discuss things, imagine that the spring is horizontal, with the left end firmly fixed to a wall, and a mass fixed to the right end. The mass is free to slide horizontally while attached to the spring, so the spring alternately compresses and expands as the mass moves back and forth. As always in these simplified situations, we’re imagining the mass sliding along some horizontal track as it moves back and forth, and we stipulate that there is no friction between the sliding mass and the track. Even though the reader is probably aware of the approximations being made, it is worth stating explicitly that such a system does not exist in reality, since there will always be some friction in a system like this.

Having accepted the idealized situation, however, we can observe that the mass on the spring experiences a force that is directly proportional to its distance from the equilibrium point, and that is always directed towards the equilibrium point. That is, if the spring’s right end (the end attached to the oscillating mass) lies at position ${x=0}$ at equilibrium (the point at which, if the spring is released, nothing would move), then the force experienced by the mass is

 $\displaystyle F$ $\displaystyle =$ $\displaystyle -kx$

where ${k}$ is a positive constant, and the minus sign indicates that the force resists any extension or compression of the spring. That is, if ${x>0}$ then then force tends to pull the mass back to the left towards the equilibrium point, while if ${x<0}$, the force is in the positive direction and tends to push the mass back to the right.

Since we have the force law, we can invoke Newton’s law in the form

 $\displaystyle F$ $\displaystyle =$ $\displaystyle ma=m\frac{d^{2}x}{dt^{2}}$ $\displaystyle$ $\displaystyle =$ $\displaystyle -kx$ $\displaystyle \frac{d^{2}x}{dt^{2}}$ $\displaystyle =$ $\displaystyle -\frac{k}{m}x$

to get an expression for the mass’s motion as a function of time. First, we can notice that the units of ${k}$ must be those of ${(Force)/(Distance)=(mass)/(time)^{2}}$, (since the units of force are ${(mass)(distance)/(time)^{2}}$) so the quantity ${k/m}$ has the units of ${(time)^{-2}}$. To make the calculations easier, we can introduce a quantity ${\omega\equiv\sqrt{k/m}}$ which has the dimensions of ${(time)^{-1}}$ and can thus be regarded as a frequency. We’ll see how it fits into the solution in a minute, but we can first rewrite the equation to be solved as

 $\displaystyle \frac{d^{2}x}{dt^{2}}$ $\displaystyle =$ $\displaystyle -\frac{k}{m}x$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\omega^{2}x$

The general solution of this equation is

$\displaystyle x(t)=A\sin(\omega t)+B\cos(\omega t)$ In order to determine ${A}$ and ${B}$ we need to impose some initial conditions, so let’s suppose we are doing an experiment in which we pull the mass out to a position ${x=x_{0}}$ at time ${t=0}$ and let it go. In that case, we have ${B=x_{0}}$. Since the mass starts off with zero velocity ${v(t)}$, then we can find ${A}$ by calculating the derivative of the general solution:

 $\displaystyle \frac{dx}{dt}$ $\displaystyle =$ $\displaystyle \omega A\cos(\omega t)-x_{0}\omega\sin(\omega t)$ $\displaystyle$ $\displaystyle =$ $\displaystyle 0\mathrm{\; when\;}t=0$

from which we get ${A=0}$. Thus the particular solution for our little experiment is

 $\displaystyle x(t)$ $\displaystyle =$ $\displaystyle x_{0}\cos(\omega t)$ $\displaystyle v(t)$ $\displaystyle =$ $\displaystyle \frac{dx(t)}{dt}$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\omega x_{0}\sin(\omega t)$

We can now see the significance of the frequency

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

It is the frequency (in radians per second) of the oscillation of the mass on the spring, since it is the frequency inside the cosine function. If we make the spring stiffer so that it exerts more force per unit distance, this increases ${k}$ and in turn increases the frequency of oscillation. If we increase the mass attached to the spring, this decreases the frequency.

We can also work out the kinetic and potential energies of the mass as functions of time. The kinetic energy is

 $\displaystyle E_{k}$ $\displaystyle =$ $\displaystyle \frac{1}{2}mv^{2}$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\omega^{2}x_{0}^{2}\sin^{2}(\omega t)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx_{0}^{2}\sin^{2}(\omega t)$

On the first oscillation, the kinetic energy will be maximum when ${\omega t=\pi/2}$, and from the equation for the position ${x(t)}$ above we see this occurs when ${x=0}$, so the kinetic energy is maximum just as the mass passes through the spring’s equilibrium point. Since the total energy (kinetic + potential) must be a constant in the absence of any outside forces, the total energy therefore must be this maximum kinetic energy, from which we can also calculate the potential energy as a function of time:

 $\displaystyle E_{tot}$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx_{0}^{2}$ $\displaystyle E_{p}$ $\displaystyle =$ $\displaystyle E_{tot}-E_{k}$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx_{0}^{2}(1-\sin^{2}(\omega t))$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx_{0}^{2}\cos^{2}(\omega t)$

The potential energy can obtained another way if we consider the work done by the force. The usual convention is that if a mass is moving against the action of a force, the potential energy being stored in the mass is the negative of the work done on the mass. As the mass oscillates on the spring, it is moving against the force on those parts of each oscillation where it is moving away from the equilibrium point at ${x=0}$ and moving with the force whenever it is moving towards the equilibrium point. If we consider part of a cycle where the mass is moving the positive ${x}$ direction starting at ${x=0}$, then the mass is moving against the force and is slowing down, so its potential energy is increasing, and the work done by the spring is negative. So we can get a measure of the potential energy by calculating how much work is done as the mass moves from ${x=0}$ to some other point ${x=x_{1}>0}$. This motion happens in every oscillation, of course, so we can take any oscillation we like and calculate the work. The first time at which the mass passes ${x=0}$ moving to the right is when ${\omega t=3\pi/2}$. Let the time when the mass reaches position ${x_{1}}$ be ${t_{1}}$. The work done is the integral of the force times the distance, so we get

 $\displaystyle W$ $\displaystyle =$ $\displaystyle \int_{0}^{x_{1}}F\; dx$ $\displaystyle$ $\displaystyle =$ $\displaystyle m\int_{3\pi/2\omega}^{t_{1}}\frac{d^{2}x}{dt{}^{2}}\frac{dx}{dt}dt$ $\displaystyle$ $\displaystyle =$ $\displaystyle m\int_{3\pi/2\omega}^{t_{1}}(-\omega^{2}x_{0}\cos(\omega t))(-\omega x_{0}\sin(\omega t))dt$ $\displaystyle$ $\displaystyle =$ $\displaystyle m\omega^{3}x_{0}^{2}\int_{3\pi/2\omega}^{t_{1}}\cos(\omega t)\sin(\omega t)dt$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{1}{2}m\omega^{2}x_{0}^{2}\cos^{2}(\omega t_{1})$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{1}{2}kx_{0}^{2}\cos^{2}(\omega t_{1})$

In the second line, we changed the integral from one over ${x}$ to one over ${t}$, since all our formulas are expressed in terms of time. We used the chain rule formula to write ${dx=(dx/dt)dt}$. Since ${t_{1}}$ was chosen to represent any time, we can drop the suffix to get a general formula for the potential energy, which is

 $\displaystyle E_{p}$ $\displaystyle =$ $\displaystyle -W$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx_{0}^{2}\cos^{2}(\omega t)$

which agrees with the previous formula.

Note that the harmonic oscillator force is conservative, since it can be expressed as the derivative of a potential function:

 $\displaystyle F$ $\displaystyle =$ $\displaystyle -kx$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{d}{dx}\left(\frac{1}{2}kx^{2}\right)$

So the potential for the harmonic oscillator is

 $\displaystyle V(x)$ $\displaystyle =$ $\displaystyle \frac{1}{2}kx^{2}$