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?
 A: You are largely correct. However you could prove the first part in a very simple way:
We can write $$P= a\cos x+b\sin x =\sqrt {a^2+b^2} \left[\frac {a}{\sqrt {a^2+b^2}}\cos x+\frac{b}{\sqrt {a^2+b^2}}\sin x \right] $$ Now we can take $\frac{a}{\sqrt {a^2+b^2}} $ as $\cos \alpha $ giving us $$P=\sqrt {a^2+b^2}[\cos \alpha \cos x+\sin \alpha \sin x]=\sqrt{a^2+b^2}\cos (x-\alpha) $$ And also $$\alpha =\arccos \frac {a}{\sqrt {a^2+b^2}} $$ which I think maybe a small typo in your calculation.
You need not prove the first part with the help of a triangle but your approach is fine. Hope it helps.
A: The proof is only valid for $0<x<\frac\pi2$. For a more general proof, let:
$$a\cos x+b\sin x\ \equiv\ R\cos(x-\alpha)=R\cos\alpha\cos x + R\sin\alpha\sin x$$
So $a=R\cos\alpha$ and $b=R\sin\alpha$, from which you can readily find $R$ and $\alpha$.
A: Let $a = r \cos \alpha$ and $b = r \sin \alpha$. Then,
$
a\cos x + b\sin x\\
= r\cos \alpha \cos x + r\sin \alpha \sin x\\
= r \cos (x - \alpha)
$
since we know that $\cos \theta \cos \phi + \sin \theta \sin \phi = \cos (\theta - \phi)$. Now, we already have $a = r \cos \alpha$ and $b = r \sin \alpha$. Squaring and adding both of these,
$
a^2 + b^2 = r^2(\cos^2 \alpha + \sin^2 \alpha) = r^2 \\
\implies r = \sqrt{a^2 + b^2}
$
which gives us our desired result.
A: 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.

