Show that:
\begin{align*} a \cos \theta + b \sin \theta = \sqrt{a^2+b^2} \cos (\theta - \varphi) \end{align*}
fyi, the context is in studying the differential equation:
\begin{align*} y''(t) + c^2 y(t) &= 0 \\ \end{align*}
which has general solution:
\begin{align*} y(t) &= a \cos (ct) + b \sin (ct) \\ \end{align*}
My textbook says that this can easily be transformed into, where $\varphi \in \mathbb{R}$:
\begin{align*} y(t) &= \sqrt{a^2 + b^2} \cos (ct - \varphi) \\ \end{align*}
Use the compound-angle formula $$\cos(\theta-\varphi)=\cos\varphi\cos\theta+\sin\varphi\sin\theta.$$
To solve $$\cos\varphi=\frac{a}{\sqrt{a^2+b^2}},\,\sin\varphi=\frac{b}{\sqrt{a^2+b^2}}$$ take$$\varphi=\operatorname{atan2}\left(b,\,a\right).$$