Can anyone show me why the following identity is true?
$$A\cos(\omega t) + B\sin(\omega t) = \sqrt{A^2+B^2}\cos\left(\omega t + \arctan\left({ \frac BA}\right)\right) $$
I ask this is relation to simple harmonic oscillation, but as I am purely interested in the mathematical derivation I am asking this question here.
Here is the reason I am asking. As far as I am aware, the position $x$ of a particle undergoing harmonic oscillation can be expressed either as:
$$x = A\cos(\omega t) + B\sin(\omega t)$$
or as
$$x = C\cos(\omega t + \phi) $$
where $C=\sqrt{A^2+B^2}$, $\phi=\arctan( \frac BA)$ and $\omega=\sqrt{\frac km } $ (and where $k$ is the spring constant and $m$ is the mass of the particle).
If any of this is incorrect, please correct me. Also, if this question would be better off on the physics site please let me know.
Set $A\cos(\omega t) = \operatorname{Re} (Ae^{i\omega t})$ and, analogously, $B\sin(\omega t) = \operatorname{Re} (-iBe^{i\omega t})$. Then we can add the two together.
$$\begin{align*} \operatorname{Re}(Ae^{i\omega t})+\operatorname{Re} (-iBe^{i\omega t})&=\operatorname{Re} (Ae^{i\omega t}-iBe^{i\omega t})\\ &=\operatorname{Re} (e^{i\omega t}(A-iB))\\ &=\operatorname{Re} (e^{i\omega t}Ce^{i\phi}),\,\,\,\phi=-\arctan\left(\frac{B}{A}\right),\,\, C=\sqrt{A^2+B^2}\\ &=\operatorname{Re} (Ce^{i(\omega t + \phi)})\\ &=C\cos(\omega t + \phi) \end{align*}$$
So in conclusion, you were essentially right, but off my a minus sign.