Proving $a\cos x+b\sin x=\sqrt{a^2+b^2}\cos(x-\alpha)$ 
Show that $a\cos x+b\sin x=\sqrt{a^2+b^2}\cos(x-\alpha)$ and find the correct phase angle $\alpha$.

This is my proof.

Let $x$ and $\alpha$ be the the angles in a right triangle with sides $a$, $b$ and $c$, as shown in the figure. Then, $c=\sqrt{a^2+b^2}$. The left-hand side is $a\cos x+b\sin x=\frac{ab}{c}+\frac{ab}{c}=2\frac{ab}{c}$. The right-hand side is $\sqrt{a^2+b^2}\cos(x-\alpha)=c\left(\cos{x}\cos{\alpha}+\sin{x}\sin{\alpha}\right)=c\left(\frac{ab}{c^2}+\frac{ab}{c^2}\right)=2\frac{ab}{c}$.
Is my proof valid? Is there a more general way to prove it?
For the second part of the question, I think it should be $\alpha=\arccos\frac{a}{\sqrt{a^2+b^2}}=\arcsin\frac{b}{\sqrt{a^2+b^2}}$. Is this correct?

We can prove this by using properties of complex numbers:
$$ \begin{align}a\cos(x) + b\sin(x) &= a \cos(x) + b \cos\left(x-\frac{\pi}{2}\right)\\
  &=a \operatorname{Re}\left\{e^{ix}\right\} + b \operatorname{Re}\left\{e^{i(x-\pi/2)}\right\}\\
  &= \operatorname{Re}\left\{ae^{ix} + be^{i(x-\pi/2)}\right\}\\
  &= \operatorname{Re}\left\{e^{ix}(a-bi) \right\} \\
  &= \operatorname{Re}\left\{e^{ix}\sqrt{a^2+b^2}e^{i\cdot\operatorname{atan2}(-b,a)} \right\}\\
  &= \operatorname{Re}\left\{\sqrt{a^2+b^2}e^{i(x+\operatorname{atan2}(-b,a))}\right\}\\
  &= \sqrt{a^2+b^2} \cos(x+\operatorname{atan2}(-b,a))
\end{align}
$$
where $\operatorname{atan2}(y_0,x_0)$ is the angle of the complex number $x_0+iy_0$.
This formula works for all real numbers $a$ and $b$ except when $a=b=0$.
Generalization
Following the same procedure, we can find a general formula for the sum of two sinusoids with same frequency but (possibly) different phases:
$$ \begin{align}a\cos(x+\alpha) + b \cos(x+\beta) &= \operatorname{Re}\left\{ae^{i(x+\alpha)} + be^{i(x+\beta)}\right\}\\
&= \operatorname{Re}\left\{e^{ix}\left(ae^{i\alpha}+be^{i\beta}\right) \right\}\\
&= \operatorname{Re}\left\{e^{ix}ce^{i\gamma} \right\}\\
&= \operatorname{Re}\left\{ce^{i(x+\gamma)} \right\}\\
&= c \cos(x+\gamma)
\end{align}
$$
Where $ce^{i\gamma} = ae^{i\alpha}+be^{i\beta}$.
We have
$$\begin{align}ce^{i\gamma}&=a (\cos(\alpha)+i\sin(\alpha)) +b (\cos(\beta)+i\sin(\beta))\\
&= (a\cos(\alpha)+b\cos(\beta)) + (a\sin(\alpha)+b\sin(\beta))i.\\
\end{align}
$$
So
$$c=\sqrt{(a\cos(\alpha)+b\cos(\beta))^2+(a\sin(\alpha)+b\sin(\beta))^2}$$
and
$$\gamma=\operatorname{atan2}\big(a\sin(\alpha)+b\sin(\beta),a\cos(\alpha)+b\cos(\beta)\big).$$
Sidenotes:

*

*This result is equivalent to
phasor addition.

*We can get    similar formula involving $\sin$ by taking the imaginary
part.

