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
 A: 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}
A: Try breaking down $A\cos(\omega t+\phi)$
$$\begin{array}{lll}A\cos(\omega t+\phi) &=&
 A(\cos \omega t\cos\phi-\sin\omega t\sin\phi)\\
 &=&(A\cos\phi)\cos \omega t-(A\sin\phi)\sin\omega t\\
\end{array}$$
Try to show that for arbitrary constants $a$ and $b$ that there exists constants $A$ and $\phi$ such that
$$a = A\cos\phi$$
and
$$b=A\sin\phi$$
What is $a^2+b^2$?
A: A good general way to prove trigonometric identities is to switch to complex representation using Euler's formula.  It sometimes involves a little bit of algebra, but it's more algorithmic and requires less magical insight.  We can express
$$ \cos\omega t = \frac{e^{i\omega t}+e^{-i\omega t}}{2} $$
and
$$ \sin\omega t = \frac{e^{i\omega t}-e^{-i\omega t}}{2i} $$
Then we desire to prove that
$$ \frac{a}{2}\left( e^{i\omega t}+e^{-i\omega t} \right) + \frac{b}{2i}\left( e^{i\omega t}-e^{-i\omega t} \right) = \frac{A}{2}\left( e^{i(\omega t + \phi)}+e^{-i(\omega t + \phi)} \right) $$
Rearranging, we have
$$ \left( \frac{a}{2} + \frac{b}{2i} \right)e^{i\omega t} + \left( \frac{a}{2} - \frac{b}{2i} \right)e^{-i\omega t} = \frac{A}{2}e^{i\phi}e^{i\omega t} + \frac{A}{2}e^{-i\phi}e^{-i\omega t} $$
Now, comparing terms on the left and right hand sides, we see that we will have equality if the following relations are satisfied:
$$ Ae^{i\phi} = a - bi $$
$$ Ae^{-i\phi} = a + bi $$
or, written out,
$$ A\cos\phi + iA\sin\phi = a - bi $$
$$ A\cos\phi - iA\sin\phi = a + bi $$
We may equate the real and imaginary parts of the foregoing expressions.  Both furnish the following:
$$ A\cos\phi = a $$
$$ A\sin\phi = -b $$
Squaring both sides of these equations and adding yields:
$$ A^2(\cos^2\phi + \sin^2\phi) = a^2 + b^2 $$
$$ A = \sqrt{a^2 + b^2} $$
Then, dividing them we have
$$ \frac{\sin\phi}{\cos\phi} = \tan\phi = -\frac{b}{a} $$
which are the desired relations.
