Complex numbers and harmonic motion
In the present chapter we shall continue our discussion of the harmonic oscillator and, in particular, the forced harmonic oscillator, using a new technique in the analysis. In the preceding chapter we introduced the idea of complex numbers, which have real and imaginary parts and which can be represented on a diagram in which the ordinate represents the imaginary part and the abscissa represents the real part. If $a$ is a complex number, we may write it as $a = a_r + ia_i$, where the subscript $r$ means the real part of $a$, and the subscript $i$ means the imaginary part of $a$. Referring to Fig. 23–1, we see that we may also write a complex number $a = x + iy$ in the form $x + iy = re^{i\theta}$, where $r^2 = x^2 + y^2 = (x + iy)(x - iy) = aa\cconj$. (The complex conjugate of $a$, written $a\cconj$, is obtained by reversing the sign of $i$ in $a$.) So we shall represent a complex number in either of two forms, a real plus an imaginary part, or a magnitude $r$ and a phase angle $\theta$, so-called. Given $r$ and $\theta$, $x$ and $y$ are clearly $r\cos\theta$ and $r\sin\theta$ and, in reverse, given a complex number $x + iy$, $r = \sqrt{x^2 + y^2}$ and $\tan\theta= y/x$, the ratio of the imaginary to the real part. We are going to apply complex numbers to our analysis of physical phenomena by the following trick. We have examples of things that oscillate; the oscillation may have a driving force which is a certain constant times $\cos\omega t$. Now such a force, $F = F_0\cos\omega t$,  can be written as the real part of a complex number $F = F_0e^{i\omega t}$ because $e^{i\omega t} = \cos\omega t + i\sin\omega t$.  The reason we do this is that it is easier to work with an exponential function than with a cosine. So the whole trick is to represent our oscillatory functions as the real parts of certain complex functions. The complex number $F$ that we have so defined is not a real physical force, because no force in physics is really complex; actual forces have no imaginary part, only a real part. We shall, however, speak of the “force” $F_0e^{i\omega t}$, but of course the actual force is the real part of that expression. Let us take another example. Suppose we want to represent a force which is a cosine wave that is out of phase with a delayed phase $\Delta $. This, of course, would be the real part of $F_0e^{i(\omega t-\Delta)}$, but exponentials being what they are, we may write $e^{i(\omega t-\Delta)}= e^{i\omega t}e^{-i\Delta}$. Thus we see that the algebra of exponentials is much easier than that of sines and cosines; this is the reason we choose to use complex numbers. We shall often write \begin{equation} \label{Eq:I:23:1} F=F_0e^{-i\Delta}e^{i\omega t}=\hat{F}e^{i\omega t}. \end{equation} We write a little caret ($\hat{\enspace}$) over the $F$ to remind ourselves that this quantity is a complex number: here the number is \begin{equation*} \hat{F}=F_0e^{-i\Delta}. \end{equation*} Now let us solve an equation, using complex numbers, to see whether we can work out a problem for some real case. For example, let us try to solve \begin{equation} \label{Eq:I:23:2} \frac{d^2x}{dt^2}+\frac{kx}{m}=\frac{F}{m}=\frac{F_0}{m}\cos\omega t, \end{equation} where $F$ is the force which drives the oscillator and $x$ is the displacement. Now, absurd though it may seem, let us suppose that $x$ and $F$ are actually complex numbers, for a mathematical purpose only. That is to say, $x$ has a real part and an imaginary part times $i$, and $F$ has a real part and an imaginary part times $i$.  Now if we had a solution of (23.2) with complex numbers, and substituted the complex numbers in the equation, we would get \begin{equation*} \frac{d^2(x_r+ix_i)}{dt^2}+\frac{k(x_r+ix_i)}{m}= \frac{F_r+iF_i}{m} \end{equation*} or \begin{equation*} \frac{d^2x_r}{dt^2}+\frac{kx_r}{m}+i\biggl( \frac{d^2x_i}{dt^2}+\frac{kx_i}{m}\biggr)= \frac{F_r}{m}+\frac{iF_i}{m}. \end{equation*} Now, since if two complex numbers are equal, their real parts must be equal and their imaginary parts must be equal, we deduce that the real part of $x$ satisfies the equation with the real part of the force. We must emphasize, however, that this separation into a real part and an imaginary part is not valid in general, but is valid only for equations which are linear, that is, for equations in which $x$ appears in every term only in the first power or the zeroth power. For instance, if there were in the equation a term $\lambda x^2$, then when we substitute $x_r + ix_i$, we would get $\lambda(x_r + ix_i)^2$, but when separated into real and imaginary parts this would yield $\lambda(x_r^2 - x_i^2)$ as the real part and $2i\lambda x_rx_i$ as the imaginary part. So we see that the real part of the equation would not involve just $\lambda x_r^2$, but also $-\lambda x_i^2$. In this case we get a different equation than the one we wanted to solve, with $x_i$, the completely artificial thing we introduced in our analysis, mixed in. Let us now try our new method for the problem of the forced oscillator, that we already know how to solve. We want to solve Eq. (23.2) as before, but we say that we are going to try to solve \begin{equation} \label{Eq:I:23:3} \frac{d^2x}{dt^2}+\frac{kx}{m}=\frac{\hat{F}e^{i\omega t}}{m}, \end{equation} where $\hat{F}e^{i\omega t}$ is a complex number. Of course $x$ will also be complex, but remember the rule: take the real part to find out what is really going on. So we try to solve (23.3) for the forced solution; we shall discuss other solutions later. The forced solution has the same frequency as the applied force, and has some amplitude of oscillation and some phase, and so it can be represented also by some complex number $\hat{x}$ whose magnitude represents the swing of $x$ and whose phase represents the time delay in the same way as for the force. Now a wonderful feature of an exponential function $x=\hat{x}e^{i\omega t}$ is that $dx/dt = i\omega x$. When we differentiate an exponential function, we bring down the exponent as a simple multiplier. The second derivative does the same thing, it brings down another $i\omega$, and so it is very simple to write immediately, by inspection, what the equation is for $x$: every time we see a differentiation, we simply multiply by $i\omega$. (Differentiation is now as easy as multiplication!  This idea of using exponentials in linear differential equations is almost as great as the invention of logarithms, in which multiplication is replaced by addition. Here differentiation is replaced by multiplication.) Thus our equation becomes \begin{equation} \label{Eq:I:23:4} (i\omega)^2\hat{x}+(k\hat{x}/m)=\hat{F}/m. \end{equation} (We have cancelled the common factor $e^{i\omega t}$.) See how simple it is!  Differential equations are immediately converted, by sight, into mere algebraic equations; we virtually have the solution by sight, that \begin{equation*} \hat{x}=\frac{\hat{F}/m}{(k/m)-\omega^2}, \end{equation*} since $(i\omega)^2 =-\omega^2$. This may be slightly simplified by substituting $k/m = \omega_0^2$, which gives \begin{equation} \label{Eq:I:23:5} \hat{x}=\hat{F}/m(\omega_0^2-\omega^2). \end{equation} This, of course, is the solution we had before; for since $m(\omega_0^2 - \omega^2)$ is a real number, the phase angles of $\hat{F}$ and of $\hat{x}$ are the same (or perhaps $180^\circ$ apart, if $\omega^2 > \omega_0^2$), as advertised previously. The magnitude of $\hat{x}$, which measures how far it oscillates, is related to the size of the $\hat{F}$ by the factor $1/m(\omega_0^2-\omega^2)$, and this factor becomes enormous when $\omega$ is nearly equal to $\omega_0$. So we get a very strong response when we apply the right frequency $\omega$ (if we hold a pendulum on the end of a string and shake it at just the right frequency, we can make it swing very high).