# Harmonic oscillator

A harmonic oscillator is either

${\displaystyle F=-kx\,}$
where k is positive and constant
or
• any physical system that is analogous to this mechanical system, in which some other quantity behaves in the same way mathematically.

Examples of harmonic oscillators include pendulums (in small angles), masses on springs, RLC circuits and acoustical systems.

## Examples

### Simple harmonic oscillator

This satisfies the homogeneous second order linear differential equation

${\displaystyle {\frac {d^{2}x}{dt^{2}}}+{\omega _{0}}^{2}x=0.}$

Example: a mass on an ideal spring.

### Driven harmonic oscillator

This satisfies the nonhomogeneous second order linear differential equation

${\displaystyle {\frac {d^{2}x}{dt^{2}}}+{\omega _{0}}^{2}x=A_{0}\cos(\omega t).}$

Example: AC LC (inductor-capacitor) circuit.

Note that this is true if the driving force applied is itself sinusoidal. The term on the right side of the equal sign corresponds to this applied driving force.

### Damped harmonic oscillator

This satisfies the equation

${\displaystyle {\frac {d^{2}x}{dt^{2}}}+b/m{\frac {dx}{dt}}+{\omega _{0}}^{2}x=0.}$

Example: weighted spring underwater (where the damping force exerted by the water is proportional to b).

### Damped, driven harmonic oscillator

This satisfies the equation

${\displaystyle m{\frac {d^{2}x}{dt^{2}}}+r{\frac {dx}{dt}}+kx=F_{0}\cos(\omega t).}$

The general solution is a sum of a transient (the solution for damped undriven harmonic oscillator, homogeneous ODE) that depends on initial conditions, and a steady state (particular solution of the unhomogenous ODE) that is independent of initial conditions and depends only on driving frequency, driving force, restoring force, damping force, and inertial moment of the oscillator (see also kernel and image).

${\displaystyle x(t)={\frac {F_{0}}{Z_{m}\omega }}\sin(\omega t-\phi )}$

where

${\displaystyle Z_{m}={\sqrt {r^{2}+\left(\omega m-{\frac {k}{\omega }}\right)^{2}}}}$

is the absolute value of the impedance

${\displaystyle Z=r+i\left(\omega m-{\frac {k}{\omega }}\right)}$

and

${\displaystyle \phi =\arctan \left({\frac {\omega m-{\frac {k}{\omega }}}{r}}\right)}$

is the phase of the oscillation relative to the driving force.

One might see that for a certain driving frequency, ${\displaystyle \omega }$, the amplitude (relative to a given ${\displaystyle F_{0}}$) is maximal. This occurs for the frequency

${\displaystyle {\omega }_{r}={\sqrt {{\frac {k}{m}}-{\frac {r^{2}}{2m^{2}}}}}}$

and is called resonance of displacement.

In summary: at steady state the frequency of oscillation is the same as the that of the driving force, but the oscillation is phase-offset and scaled by amounts that depend on the frequency of the driving force in relation to the preferred (resonant) frequency of the oscillating system.

Good example: RLC circuit.

### Relationship to RLC circuit

Comparing a mechanical harmonic oscillator with an RLC circuit, the following correspond:

• ${\displaystyle F\Leftrightarrow V\,}$ Force - Electric potential
• ${\displaystyle x\Leftrightarrow Q\,}$ Position - Charge
• ${\displaystyle k\Leftrightarrow {\frac {1}{C}}\,}$ spring constant - electrical elastance (reciprocal of capacitance)
• ${\displaystyle v\Leftrightarrow I\,}$ Velocity - Electric current
• ${\displaystyle b\Leftrightarrow R\,}$ damping factor - electrical resistance
• ${\displaystyle a\Leftrightarrow {\frac {dI}{dt}}\,}$ acceleration - rate of change of current
• ${\displaystyle m\Leftrightarrow L\,}$ mass - inductance

If F is the only force acting on the mechanical system, the system is called a simple harmonic oscillator. The motion of a simple harmonic oscillator, called simple harmonic motion, is essentially a sine function oscillating about the equilibrium displacement, x = 0, at which the returning force is zero.

• The potential energy V associated with such a returning force is called a harmonic potential. It has the form
${\displaystyle V(x)={\frac {1}{2}}kx^{2}.}$

The simple harmonic oscillator can also be formulated in terms of the Lagrangian

${\displaystyle {\mathcal {L}}={\frac {1}{2}}m{\dot {x}}^{2}-{\frac {1}{2}}kx^{2}}$

or the Hamiltonian

${\displaystyle {\mathcal {H}}={\frac {p^{2}}{2m}}+{\frac {1}{2}}m\omega ^{2}x^{2}.}$

This article discusses the harmonic oscillator in terms of classical mechanics. See the article quantum harmonic oscillator for a discussion of the harmonic oscillator in quantum mechanics.

## Full mathematical definition

Most harmonic oscillators, at least approximately, solve the differential equation:

${\displaystyle {\frac {d^{2}x}{dt^{2}}}+b/m{\frac {dx}{dt}}+{\omega _{0}}^{2}x=A_{0}\cos(\omega t)}$

where t is time, b is the damping constant, ωo is the characteristic angular frequency, and Aocos(ωt) represents something driving the system with amplitude Ao and angular frequency ω. x is the measurement that is oscillating; it can be position, current, or nearly anything else. The angular frequency is related to the frequency, f, by

${\displaystyle f={\frac {\omega }{2\pi }}.}$

### Important terms

• Amplitude: maximal displacement from the equilibrium.
• Period: the time it takes the system to complete an oscillation cycle. Opposite of frequency.
• Frequency: the number of cycles the system performs per unit time (usually measured in hertz = 1/s).
• Angular frequency: ${\displaystyle \omega =2\pi f}$
• Phase: how much of a cycle the system completed (system that begins is in phase zero, system which completed half a cycle is in phase ${\displaystyle \pi }$).
• Initial conditions: the state of the system at t = 0, the beginning of oscillations.

## Simple harmonic oscillator

A simple harmonic oscillator is simply an oscillator that is neither damped nor driven. So the equation to describe one is:

${\displaystyle {\frac {d^{2}x}{dt^{2}}}+{\omega _{0}}^{2}x=0.}$

Physically, the above never actually exists, since there will always be friction or some other resistance, but two approximate examples are a mass on a spring and an LC circuit.

In the case of a mass attached to a spring, Newton's Laws, combined with Hooke's law for the behavior of a spring, states that:

${\displaystyle -kx=ma\,}$
where k is the spring constant
m is the mass
x is the position of the mass
a is its acceleration.

Because acceleration a is the second derivative of position x, we can rewrite the equation as follows:

${\displaystyle -kx=m{\frac {d^{2}x}{dt^{2}}}.}$

The most simple solution to the above differential equation is

${\displaystyle x=A\cos(\omega t+\delta )\,}$

and the second derivative of that is

${\displaystyle {\frac {d^{2}x}{dt^{2}}}=-A\omega ^{2}\cos(\omega t+\delta )}$
where A is the amplitude, δ is the phase shift, and ω is the angular frequency.

Plugging these back into the original differential equation, we have:

${\displaystyle -Ak\cos(\omega t+\delta )=-Am\omega ^{2}\cos(\omega t+\delta ).\,}$

Then, after dividing both sides by ${\displaystyle -A\cos(\omega t+\delta )\,}$ we get:

${\displaystyle k=m\omega ^{2}\,}$

or, as it is more commonly written:

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

The above formula reveals that the angular frequency ω of the solution is only dependent upon the physical characteristics of the system, and not the initial conditions (those are represented by A and δ). We will label this ω as ωo from now on. This will become important later.

## Universal oscillator equation

The equation

${\displaystyle {\frac {d^{2}q}{d\tau ^{2}}}+2\zeta {\frac {dq}{d\tau }}+q=0}$

is known as the universal oscillator equation since all second order linear oscillatory systems can be reduced to this form. This is done through nondimensionalization.

If the forcing function is f(t) = cos(ωt) = cos(ωtcτ) = cos(Ωτ), where Ω = ωtc, the equation becomes

${\displaystyle {\frac {d^{2}q}{d\tau ^{2}}}+2\zeta {\frac {dq}{d\tau }}+q=\cos(\Omega \tau ).}$

The solution to this differential equation contains two parts, the "transient" and the "steady state".

### Transient solution

The solution based on solving the ordinary differential equation is for arbitrary constants c1 and c2 is

${\displaystyle q_{t}(\tau )={\begin{cases}e^{-\zeta \tau }\left(c_{1}e^{\tau {\sqrt {\zeta ^{2}-1}}}+c_{2}e^{-\tau {\sqrt {\zeta ^{2}-1}}}\right)&\zeta >1\ {\mbox{(overdamping)}}\\e^{-\zeta \tau }(c_{1}+c_{2}\tau )=e^{-\tau }(c_{1}+c_{2}\tau )&\zeta =1\ {\mbox{(critical damping)}}\\e^{-\zeta \tau }\left[c_{1}\cos \left({\sqrt {1-\zeta ^{2}}}\tau \right)+c_{2}\sin \left({\sqrt {1-\zeta ^{2}}}\tau \right)\right]&\zeta <1\ {\mbox{(underdamping)}}\end{cases}}}$

The transient solution is independent of the forcing function. If the system is critically damped, the response is independent of the damping.

Apply the "complex variables method" by solving the auxillary equation below and then finding the real part of its solution:

${\displaystyle {\frac {d^{2}q}{d\tau ^{2}}}+2\zeta {\frac {dq}{d\tau }}+q=\cos(\Omega \tau )+i\sin(\Omega \tau )=e^{i\Omega \tau }.}$

Supposing the solution is of the form

${\displaystyle \,\!q_{s}(\tau )=Ae^{i(\Omega \tau +\phi )}.}$

Its derivatives from zero to 2nd order are

${\displaystyle q_{s}=Ae^{i(\Omega \tau +\phi )},\ {\frac {dq_{s}}{d\tau }}=i\Omega Ae^{i(\Omega \tau +\phi )},\ {\frac {d^{2}q_{s}}{d\tau ^{2}}}=-\Omega ^{2}Ae^{i(\Omega \tau +\phi )}.}$

Substituting these quantities into the differential equation gives

${\displaystyle \,\!-\Omega ^{2}Ae^{i(\Omega \tau +\phi )}+2\zeta i\Omega Ae^{i(\Omega \tau +\phi )}+Ae^{i(\Omega \tau +\phi )}=(-\Omega ^{2}A\,+\,2\zeta i\Omega A\,+\,A)e^{i(\Omega \tau +\phi )}=e^{i\Omega \tau }.}$

Dividing by the exponential term on the left results in

${\displaystyle \,\!-\Omega ^{2}A+2\zeta i\Omega A+A=e^{-i\phi }=\cos \phi -i\sin \phi .}$

Equating the real and imaginary parts results in two independent equations

${\displaystyle A(1-\Omega ^{2})=\cos \phi \qquad 2\zeta \Omega A=-\sin \phi .}$

#### Amplitude part

Squaring both equations and adding them together gives

${\displaystyle \left.{\begin{matrix}A^{2}(1-\Omega ^{2})^{2}=\cos ^{2}\phi \\(2\zeta \Omega )^{2}=\sin ^{2}\phi \end{matrix}}\right\}\Rightarrow A^{2}[(1-\Omega ^{2})^{2}+(2\zeta \Omega A)^{2}]=1.}$

By convention the positive root is taken since amplitude is usually considered a positive quantity. Therefore,

${\displaystyle A=A(\zeta ,\Omega )={\frac {1}{\sqrt {(1-\Omega ^{2})^{2}+(2\zeta \Omega )^{2}}}}.}$

Compare this result with the theory section on resonance, as well as the "magnitude part" of the RLC circuit. This amplitude function is particularly important in the analysis and understanding of the frequency response of second-order systems.

#### Phase part

To solve for φ, divide both equations to get

${\displaystyle \tan \phi =-{\frac {2\zeta \Omega }{1-\Omega ^{2}}}={\frac {2\zeta \Omega }{\Omega ^{2}-1}}\Rightarrow \phi \equiv \phi (\zeta ,\Omega )=\arctan \left({\frac {2\zeta \Omega }{\Omega ^{2}-1}}\right).}$

This phase function is particularly important in the analysis and understanding of the frequency response of second-order systems.

### Full solution

Combining the amplitude and phase portions results in the steady-state solution

${\displaystyle \,\!q_{s}(\tau )=A(\zeta ,\Omega )\cos(\Omega \tau +\phi (\zeta ,\Omega ))=A\cos(\Omega \tau +\phi ).}$

The solution of original universal oscillator equation is a superposition (sum) of the transient and steady-state solutions

${\displaystyle \,\!q(\tau )=q_{t}(\tau )+q_{s}(\tau ).}$

For a more complete description of how to solve the above equation, see linear ODEs with constant coefficients.

## References

• Serway, Raymond A.; Jewett, John W. (2003). Physics for Scientists and Engineers, Brooks/Cole. ISBN 0534408427.
• Tipler, Paul (1998). Physics for Scientists and Engineers: Vol. 1 (4th ed.), W. H. Freeman. ISBN 1572594926.