--- title: "Harmonic oscillator" firstLetter: "H" publishDate: 2021-06-02 categories: - Physics - Mathematics date: 2021-03-09T20:35:14+01:00 draft: false markup: pandoc --- # Harmonic oscillator A **harmonic oscillator** obeys the simple 1D version of [Hooke's law](/know/concept/hookes-law/): to displace the system away from its equilibrium, the needed force $F_d(x)$ scales linearly with the displacement $x(t)$: $$\begin{aligned} F_d(x) = k x \end{aligned}$$ Where $k$ is a system-specific proportionality constant, called the **spring constant**, since a spring is a good example of a harmonic oscillator, at least for small displacements. Hooke's law is also often stated for the restoring force $F_r(x)$ instead: $$\begin{aligned} F_r(x) = - k x \end{aligned}$$ Let a mass $m$ be attached to the end of the spring. After displacing it, we let it go $F_d = 0$, so Newton's second law for the restoring force $F_r$ demands that: $$\begin{aligned} F_r = m x'' \end{aligned}$$ But $F_r = - k x$, meaning $m x'' = - k x$, leading to the following equation for $x(t)$: $$\begin{aligned} \boxed{ x'' + \omega_0^2 x = 0 } \end{aligned}$$ Where $\omega_0 \equiv \sqrt{k / m}$ is the **natural frequency** of the system. This differential equation has the following general solution: $$\begin{aligned} \boxed{ x(t) = C_1 \sin\!(\omega_0 t) + C_2 \cos\!(\omega_0 t) } \end{aligned}$$ Where $C_1$ and $C_2$ are constants determined by the initial conditions. For example, for $x(0) = 1$ and $x'(0) = 0$, the solution becomes: $$\begin{aligned} x(t) = \cos\!(\omega_0 t) \end{aligned}$$ When using [Lagrangian](/know/concept/lagrangian-mechanics/) or Hamiltonian mechanics, we need to know the potential energy $V(x)$ added to the system by a displacement to $x$. This equals the work done by the displacement, and is therefore given by: $$\begin{aligned} V(x) = \int_0^x F_d(x) \:dx = \frac{1}{2} k x^2 = \frac{1}{2} m \omega_0^2 x^2 \end{aligned}$$ ## Damped oscillation If there is a **friction force** $F_f$ affecting the system, then the oscillation amplitude will decrease, or it might not oscillate at all. We define $F_f$ using a **viscous damping coefficient** $c$: $$\begin{aligned} F_f = - c x' \end{aligned}$$ Both $F_r$ and $F_f$ are acting on the system, so Newton's second law states that: $$\begin{aligned} m x'' = - c x' - k x \end{aligned}$$ This can be rewritten in the following conventional form by defining the **damping coefficient** $\zeta \equiv c / (2 \sqrt{m k})$, which determines the expected behaviour of the system: $$\begin{aligned} \boxed{ x'' + 2 \zeta \omega_0 x' + \omega_0^2 x = 0 } \end{aligned}$$ The general solution is found from the roots $u$ of the auxiliary quadratic equation: $$\begin{aligned} u^2 + 2 \zeta \omega_0 u + \omega_0^2 = 0 \end{aligned}$$ The discriminant $D = 4 \zeta^2 \omega_0^2 - 4 \omega_0^2$ tells us that the behaviour changes substantially depending on the damping coefficient $\zeta$, with three possibilities: $\zeta < 1$ or $\zeta = 1$ or $\zeta > 1$. If $\zeta < 1$, there is **underdamping**: the system oscillates with exponentially decaying amplitude and reduced frequency $\omega_1 \equiv \omega_0 \sqrt{1 - \zeta^2}$. The general solution is: $$\begin{aligned} \boxed{ x(t) = \big( C_1 \sin\!(\omega_1 t) + C_2 \cos\!(\omega_1 t) \big) \exp\!(- \zeta \omega_0 t) } \end{aligned}$$ If $\zeta = 1$, there is **critical damping**: the system returns to its equilibrium point in minimum time. The general solution is given by: $$\begin{aligned} \boxed{ x(t) = \big( C_1 + C_2 t \big) \exp\!(- \omega_0 t) } \end{aligned}$$ If $\zeta > 1$, there is **overdamping**: the system returns to equilibrium slowly. The general solution is as follows, where $\omega_1 \equiv \omega_0 \sqrt{\zeta^2 - 1}$: $$\begin{aligned} \boxed{ x(t) = \big( C_1 \exp\!(\omega_1 t) + C_2 \exp\!(- \omega_1 t) \big) \exp\!(- \zeta \omega_0 t) } \end{aligned}$$ ## Forced oscillation In the differential equations given above, the right-hand side has always been zero, meaning that the oscillator is not affected by any external forces. What if we put a function there? $$\begin{aligned} x'' + 2 \zeta \omega_0 x' + \omega_0^2 x = f(t) \end{aligned}$$ Obviously, there exist infinitely many $f(t)$ to choose from, and each needs a separate analysis. However, there is one type of $f(t)$ that deserves special mention, namely sinusoids: $$\begin{aligned} \boxed{ x'' + 2 \zeta \omega_0 x' + \omega_0^2 x = \frac{F}{m} \cos\!(\omega t + \chi) } \end{aligned}$$ Where $F$ is a constant force, $\chi$ is an arbitrary phase, and the frequency $\omega$ is not necessarily $\omega_0$. We solve this case for $x(t)$ in detail. Consider the complex version of the equation: $$\begin{aligned} X'' + 2 \zeta \omega_0 X' + \omega_0^2 X = \frac{F}{m} \exp\!\big(i (\omega t + \chi)\big) \end{aligned}$$ Then $x(t) = \Re\{X(t)\}$. Inserting the ansatz $X(t) = C \exp\!(i \omega t)$, for some constant $C$: $$\begin{aligned} - C \omega^2 + C 2 i \zeta \omega_0 \omega + C \omega_0^2 = \frac{F}{m} \exp\!(i \chi) \end{aligned}$$ Where $\exp\!(i \omega t)$ has already been divided out. We isolate this equation for $C$: $$\begin{aligned} C = \frac{F}{m \big((\omega_0^2 - \omega^2) + 2 i \zeta \omega_0 \omega\big)} \exp\!(i \chi) = \frac{F \big((\omega_0^2 - \omega^2) - 2 i \zeta \omega_0 \omega\big)} {m \big((\omega_0^2 - \omega^2)^2 + 4 \zeta^2 \omega_0^2 \omega^2\big)} \exp\!(i \chi) \end{aligned}$$ We would like to rewrite this in polar form $C = r \exp\!(i \theta)$, which turns out to be as follows: $$\begin{aligned} C &= \frac{F}{m \sqrt{(\omega_0^2 - \omega^2)^2 + 4 \zeta^2 \omega_0^2 \omega^2}} \exp\!\bigg(i \chi - i \arctan\!\Big(\frac{2 \zeta \omega_0 \omega}{\omega_0^2 - \omega^2}\Big)\bigg) \end{aligned}$$ For brevity, let us define the **impedance** $Z$ and the **phase shift** $\phi$ in the following way: $$\begin{aligned} Z \equiv \sqrt{(\omega_0^2 - \omega^2)^2 / \omega^2 + 4 \zeta^2 \omega_0^2} \qquad \quad \phi \equiv \arctan\!\Big(\frac{2 \zeta \omega_0 \omega}{\omega_0^2 - \omega^2}\Big) \end{aligned}$$ Returning to the original ansatz $X(t) = C \exp\!(i \omega t)$, we take its real part to find $x(t)$: $$\begin{aligned} \boxed{ x(t) = \frac{F}{m \omega Z} \sin\!(\omega t + \chi - \phi) } \end{aligned}$$ Two things are noteworthy here. Firstly, $f(t)$ and $x(t)$ are out of phase by $\phi$; there is some lag. This is caused by damping, because if $\zeta = 0$, it disappears $\phi = 0$. Secondly, the amplitude of $x(t)$ depends on $\omega$ and $\omega_0$. This brings us to **resonance**, where the amplitude can become extremely large. Actually, resonance has two subtly different definitions, depending on which one of $\omega$ and $\omega_0$ is a free parameter, and which one is fixed. If the natural $\omega_0$ is fixed and the driving $\omega$ is variable, we find for which $\omega$ resonance occurs by minimizing the amplitude denominator $\omega Z$. We thus find: $$\begin{aligned} 0 = \dv{(\omega Z)}{\omega} = \frac{- 4 \omega_0^2 \omega + 4 \omega^3 + 8 \zeta^2 \omega_0^2 \omega}{2 \sqrt{(\omega_0^2 - \omega^2)^2 + 4 \zeta^2 \omega_0^2 \omega^2}} \quad \implies \quad \boxed{ \omega = \omega_0 \sqrt{1 - 2 \zeta^2} } \end{aligned}$$ Meaning the resonant $\omega$ is lower than $\omega_0$, and resonance can only occur if $\zeta < 1 / \sqrt{2}$. However, if the driving $\omega$ is fixed and the natural is $\omega_0$ is variable, the problem is bit more subtle: the damping coefficient $\zeta = c / (2 m \omega_0)$ depends on $\omega_0$. This leads us to: $$\begin{aligned} 0 = \dv{(\omega Z)}{\omega_0} = \frac{4 \omega_0^3 - 4 \omega^2 \omega_0}{2 \sqrt{(\omega_0^2 - \omega^2)^2 + c^2 \omega^2 / m^2}} \quad \implies \quad \boxed{ \omega_0 = \omega } \end{aligned}$$ Surprisingly, the damping does not affect $\omega_0$, if $\omega$ is given. However, in both cases, the damping *does* matter for the eventual amplitude: $c \to 0$ leads to $x \to \infty$, and resonance disappears or becomes negligible for $c \to \infty$. ## References 1. M.L. Boas, *Mathematical methods in the physical sciences*, 2nd edition, Wiley.