How to get $a \cos\left( \omega t \right)+b\sin\left( \omega t \right)=A \cos\left( \omega t+\phi \right)$? So this sprung up in a lecture note on quantum harmonic oscillation.
The equation is 
$a \cos\left( \omega t \right)+b\sin\left( \omega t \right)=A \cos\left( \omega t+\phi \right)$
I must have forgotten how the right hand side follows from the left hand side.
Some hints would be helpful

Let $A = \sqrt{a^2+b^2}$ and $\phi$ be an angle such that $\cos\phi = \dfrac{a}{\sqrt{a^2+b^2}}$ and $\sin\phi = \dfrac{-b}{\sqrt{a^2+b^2}}$. Then, by using the identity $\cos(x+y) = \cos x\cos y-\sin x\sin y$, we have: 
\begin{align}a\cos(\omega t)+b\sin(\omega t) &= \sqrt{a^2+b^2}\left[\dfrac{a}{\sqrt{a^2+b^2}}\cos(\omega t)-\dfrac{-b}{\sqrt{a^2+b^2}}\sin(\omega t)\right] \\ &=A\left[\cos\phi\cos(\omega t)-\sin\phi\sin(\omega t)\right] \\ &= A\cos(\omega t + \phi).\end{align}
