Of sines, cosines, and phase shifts
An alternative form for the solution of a simple harmonic oscillator caused some short-lived confusion and consternation. Resolving the conflict turned out to be fairly straightforward.

While looking at some calculations recently, I stumbled across this as the general solution of a simple harmonic oscillator:
\begin{equation} x(t) = A \sin (\omega t) + B \cos (\omega t). \label{eq:sum-form} \end{equation}
I was a bit confused because I’d only ever seen the solution presented as1
\begin{equation} x(t) = A \sin (\omega t + \phi), \label{eq:phase-form} \end{equation}
where \(x\) is the displacement from the origin, \(A\) is the amplitude, \(\omega\) is the angular velocity, \(t\) is time, and \(\phi\) a phase shift.
I remember thinking “Hä?2 Is that right?” It turns out it is, and that the two forms are equivalent, but it wasn’t directly apparent. I certainly wasn’t familiar with the first form.
I’m guessing some people will probably look at those equations and my comment and think “duuhhhh!”, or “no shit, Sherlock!”. Well, it wasn’t obvious to me, nor was it obvious to the two other physicists with PhDs who were in the room at the time. Anyway, I thought I’d write this up so that it might help someone else. I’m hoping it will also help solidify my own knowledge.
Let’s see how the two forms are equivalent.
Fix up the notation
Usually, we’re used to seeing the parameter \(A\) as “amplitude”. This certainly makes sense in the form containing the explicit phase shift (Equation (\ref{eq:phase-form})). However, that’s not the case in the first form (Equation (\ref{eq:sum-form})), which doesn’t include an explicit phase shift.
To be able to equate these two forms, we need to change the notation, so that we’re not using one symbol for two concepts. Hence, let’s replace \(A\) in Equation (\ref{eq:phase-form}) with \(C\) to get
\begin{equation} x(t) = C \sin (\omega t + \phi). \label{eq:phase-form-c} \end{equation}
We’re now in a position to see if we can write \(C\) and \(\phi\) in terms of \(A\) and \(B\) from Equation (\ref{eq:sum-form}).
Trig identities to the rescue
The first thing to identify is that one can write the sine of a sum of angles (as we have in Equation (\ref{eq:phase-form-c})) as the sum of products of sine and cosine of the angles. In other words, we use the identity
\begin{equation} \sin (\theta + \psi) = \sin \theta \cos \psi + \cos \theta \sin \psi \end{equation}
to reformulate Equation (\ref{eq:phase-form-c}) as
\begin{equation} x(t) = C \sin (\omega t) \cos \phi + C \cos (\omega t) \sin \phi. \end{equation}
Collecting terms in \(\omega t\) to the right, we have
\begin{equation} x(t) = C \cos \phi \sin (\omega t) + C \sin \phi \cos (\omega t). \label{eq:collected-terms} \end{equation}
Since \(C\) and \(\phi\) are not dependent on \(t\), the factors
\begin{equation} C \cos \phi \quad \text{and} \quad C \sin \phi \end{equation}
are constants, hence we can see that Equation (\ref{eq:collected-terms}) has the same form as Equation (\ref{eq:sum-form}), where
\begin{equation} A = C \cos \phi \quad \text{and} \quad B = C \sin \phi. \end{equation}
In other words, the two forms of the simple harmonic oscillator solution are equivalent.
Writing one in terms of the other
The question now becomes: how can we write \(C\) and \(\phi\) in terms of \(A\) and \(B\)? If we sum the squares of \(A\) and \(B\), we have
\[\begin{align} A^2 + B^2 &= C^2 \cos^2 \phi + C^2 \sin^2 \phi\\ &= C^2 (\cos^2 \phi + \sin^2 \phi)\\ &= C^2\\ \Rightarrow C &= \sqrt{A^2 + B^2}. \end{align}\]How, then, is \(\phi\) related to \(A\) and \(B\)? Again, we use the relations
\begin{equation} A = C \cos \phi \quad \text{and} \quad B = C \sin \phi \end{equation}
but this time we divide \(B\) by \(A\):
\[\begin{align} \frac{B}{A} &= \frac{C \sin \phi}{C \cos \phi}\\ &= \frac{\sin \phi}{\cos \phi}\\ &= \tan \phi\\ \Rightarrow \phi &= \tan^{-1} \biggl(\frac{B}{A}\biggr). \end{align}\]Rewriting Equation (\ref{eq:phase-form-c}) in terms of \(A\) and \(B\), we have the equivalence of the two forms of the general solution of the simple harmonic oscillator:
\begin{equation} A \sin(\omega t) + B \cos(\omega t) = \sqrt{A^2 + B^2} \sin \Biggl( \omega t + \tan^{-1} \biggl(\frac{B}{A}\biggr) \Biggr). \end{equation}
Summing up
Thus, in terms of the \(A\) and \(B\) parameters from Equation (\ref{eq:sum-form}), we find that the amplitude in Equation (\ref{eq:phase-form-c}) is
\begin{equation} C = \sqrt{A^2 + B^2} \end{equation}
and the phase shift is given by
\begin{equation} \phi = \tan^{-1} \biggl(\frac{B}{A}\biggr). \end{equation}
So that’s it! The two forms are equivalent. Hopefully, the next time I see the solution written as a sum of sines and cosines, I won’t be as surprised.3
-
Note that the \(A\) appearing in each of the above equations are not the same. ↩
-
“Hä” is a very compact expression in German evoking a sense of deep bewilderment. It can be roughly translated into English as “I am exceedingly confused by that which you have just told me”. So much for German always using really long words… ↩
-
I later found a similar formulation on the Wikipedia page for simple harmonic motion. ↩
Support
If you liked this post and want to see more, please buy me a coffee!
