# The damped and forced oscillator

Consider an block of mass $$m$$ over the surface of a table and attached to a wall by a spring. If we let the scalar $$x$$ measure the displacement of this object from equilibrium position, then Newton’s second law establishes that $m\ddot{x}=F,$ where $$F$$ stands for the sum of the forces acting on the block. In this case we have that $$F=F_{s}+F_{f},$$ where $$F_{s}=-kx$$ is the force due to the spring (Hooke’s law) and $$F_{f}=-\gamma\dot{x}$$ is the frictional force on the object due to its contact with the table. We conclude that $m\ddot{x}+\gamma\dot{x}+kx=0.$ We can solve this equation by introducing the complex variable $$z=x+iy$$ and considering the corresponding differential equation on $$z$$, i.e $m\ddot{z}+\gamma\dot{z}+kz=0.$ If for $$a,\omega\in\mathbb{C}$$ we propose the curve $$z=a\exp(\omega t)$$ as a solution, we obtain the characteristic equation $m\omega^{2}+\gamma\omega+k=0,$ which has solutions $$\omega_{1}$$ and $$\omega_{2}$$ given by \begin{aligned} \omega_{1} & =\frac{-\gamma-\sqrt{\gamma^{2}-4mk}}{2m},\\ \omega_{2} & =\frac{-\gamma+\sqrt{\gamma^{2}-4mk}}{2m}.\end{aligned} By the principle of superposition the general solution to our differential equation has the form $z=a_{1}\exp(\omega_{1}t)+a_{2}\exp(\omega_{2}t).$ The coefficients $$a_{0}$$ and $$a_{1}$$ can be computed from the initial conditions $z(0)=z_{0},\dot{z}(0)=w_{0},$ which lead to the formula $\left(\begin{array}{cc} 1 & 1\\ \omega_{1} & \omega_{2} \end{array}\right)\left(\begin{array}{c} a_{1}\\ a_{2} \end{array}\right)=\left(\begin{array}{c} z_{0}\\ w_{0} \end{array}\right).$ We conclude that $a_{1}=\frac{z_{0}\omega_{2}-w_{0}}{\omega_{2}-\omega_{1}},a_{2}=\frac{w_{0}-z_{0}\omega_{1}}{\omega_{2}-\omega_{1}}.$

We can model a periodic force of frequency $$\omega\in\mathbb{R}$$ acting on the block by using a term of the form $$f\exp(i\omega t)$$, where $$f\in\mathbb{C}$$. This leads to the non-homogeneous equation

$m\ddot{z}+\gamma\dot{z}+kz=f\exp(i\omega t).$ If we let $\omega_{0}=\sqrt{\frac{k}{m}}$ we can write the above equation as $\ddot{z}+\gamma/m+\omega_{0}^{2}=(f/m)\exp(i\omega t).$ Letting $$z=a\exp(i\omega t)$$ gives us the algebraic equation $a(-\omega^{2}+i(\gamma/m)\omega+\omega_{0}^{2})=f/m.$ Solving for $$a$$, we obtain $a=\frac{f}{m(\omega_{0}^{2}-\omega^{2})+i\gamma}.$ Observe $|a|^{2}=\frac{|f|^{2}}{m^{2}(\omega_{0}^{2}-\omega){{}^2}+\gamma^{2}}.$ reaches its maximum value when $$\omega=\omega_{0}$$. Furthermore, $\arg(a)=\arg(f)-\arg(m(\omega_{0}^{2}-\omega)+i\gamma).$ The general solution to our equation is then given by $z=a_{1}\exp(\omega_{1}t)+a_{2}\exp(\omega_{2}t)+a\exp(i\omega t).$ The initial conditions $z(0)=z_{0},\dot{z}(0)=w_{0}$ lead to the equation $\left(\begin{array}{cc} 1 & 1\\ \omega_{1} & \omega_{2} \end{array}\right)\left(\begin{array}{c} a_{1}\\ a_{2} \end{array}\right)=\left(\begin{array}{c} z_{0}-a\\ w_{0}-i\omega a \end{array}\right)$ and hence $a_{1}=\frac{(z_{0}-a)\omega_{2}-(w_{0}-i\omega a)}{\omega_{2}-\omega_{1}},a_{2}=\frac{(w_{0}-i\omega a)-(z_{0}-a)\omega_{1}}{\omega_{2}-\omega_{1}}.$ Finally, we can obtain $$x$$ as the real part of $$z$$ and the initial condition $$x(0)=x_{0}$$ and $$\dot{x}(0)=v_{0}$$ can by satisfied by letting $$\text{re}(z_{0})=x_{0}$$ and $$\text{re}(w_{0})=v_{0}$$; we can choose $$\text{im}(z_{0})$$ and $$\text{im}(w_{0})$$ however we like.