Proof that $a\sin(x)+b\cos(x)$ can always be written in form $A\sin(x+\alpha)$ I understand how $A\sin(x+\alpha)$ is expanded to produce the form $a\sin(x)+b\cos(x)$, which means that $\tan(\alpha)=\frac{b}{a}$ and $A^2=a^2+b^2$, but I just can't wrap my head aroud why a suitable $\alpha$ and $A$ can be found for ANY coefficients of $\sin(x)$ and $\cos(x)$. For instance, if you choose a certain value of $\alpha$, for which the coefficient of $\sin(x)$ works with a given $A$, then the coefficient of $\cos(x)$ is already determined. Now what if you changed that coefficient a little bit?
I'm just finding it hard to grasp how an $A$ and $\alpha$ can be found for any $a$ and $b$...
 A: $$a\sin x+b \cos x=\sqrt{a^2+b^2}\left(\frac{a}{\sqrt{a^2+b^2}}\sin x+\frac{b}{\sqrt{a^2+b^2}}\cos x\right)=A\sin(x+\alpha)$$
where $A=\sqrt{a^2+b^2}$ and $\alpha= \arcsin\frac{b}{\sqrt{a^2+b^2}}$

A: It works because $A:=A(a,b)$ is a function dependent on both variables $a$ and $b$.
So choosing a single $a$ is not enough. You have to chose an appropriate $b$ as well.
A: Note that for every real $\alpha$, there is a unique $\theta\in(-\pi/2,\pi/2)$ such that $\tan\theta=\alpha$. Now set $\alpha=\frac{b}{a}$ and note that
$$\cos^2\theta=\frac{1}{1+\tan^2\theta}=\frac{a^2}{a^2+b^2},\text{  }\sin^2\theta=\frac{b^2}{a^2+b^2}$$
Therefore
$$a\sin x+b \cos x=\sqrt{a^2+b^2}\left(\cos\theta\sin x+\sin\theta\cos x\right)=\sqrt{a^2+b^2}\sin(x+\theta)$$
A: It's surely possible: expanding the right-hand side we find
$$
A(\sin x\cos\alpha+\cos x\sin\alpha)
$$
so we need to solve
$$
\begin{cases}
A\cos\alpha=a \\[4px]
A\sin\alpha=b
\end{cases}
$$
Squaring both equations and summing, we get $A^2=a^2+b^2$, so we can choose $A=\sqrt{a^2+b^2}$; then the point $P$ of coordinates
$$
\left(\frac{a}{\sqrt{a^2+b^2}},\frac{b}{\sqrt{a^2+b^2}}\right)
$$
lies on the circle with center at the origin and radius $1$, so there is a unique $\alpha\in[0,2\pi)$ such that
$$
\cos\alpha=\frac{a}{\sqrt{a^2+b^2}},
\qquad
\sin\alpha=\frac{b}{\sqrt{a^2+b^2}}
$$
A: Hint: Compare $a\sin(x)+b\cos(x)$ with $A\sin(x+\alpha)=A\sin(x)\cos(\alpha)+B\cos(x)\sin(\alpha)$. You will obtain:
$$a=A\cos(\alpha)$$
$$b=A\sin(\alpha).$$
Divide both equations to get an equation for $\tan(\alpha)$ and square and add both equations to get an expression for $A$. Also consider the trivial cases $a=0$ and $b=0$.
A: I have proved a formula:
 \begin{gather*} 
  a\sin(x)+b\cos(x)=\sqrt{a^2+b^2}\,\widetilde{\text{sgn}}(a)\sin\!\left(x+\phi \right),  \qquad \text{for all } a, b, x\in\mathbb{R},
\end{gather*}
 where 
 \begin{align*}
  {\widetilde{\text{sgn}}(a)=}\begin{cases}1,& \text{if }  a\geq 0,   \\
  -1, & \text{if }  a<0,  \end{cases}
 \end{align*}
    and 
    \begin{gather*}
  {\phi=}\begin{cases}\frac{\pi}{2}, & \text{if } a=0, b\geq 0,\\
  -\frac{\pi}{2}, & \text{if }   a=0, b<0. \\
  \arctan\left(\frac{b}{a}\right), & \text{if } a\neq 0.
\end{cases}
 \end{gather*}
The proof is elementary, so I omitted the details.
