Confused about the sign of $c$ in the identity $a\cos x+b\sin x=c\cos(x+\alpha)$ I'm working on the identity of a linear combination of Sine and Cosine with the same frequency.
$$a\cos(x) + b\sin(x) = c\cos(x + \alpha)$$ where $c = \operatorname{sgn}(a) \sqrt{a^2+b^2}$ and $\alpha = \text{arctan}(-\frac{b}{a})$ given that $a\neq 0$.
I'm confused about the sign of $c$.
I sorta know it's because Sine is an odd function, and Cosine is an even function. However, I cannot come up with a comprehensive analysis of it.
Furthermore, what is the domain of $x$ and $\alpha$ being considered? Is it $(-\frac{\pi}{2}, \frac{\pi}{2})$ or $(0, \pi)$?
Thank you.
 A: Forall $a,b\in\Bbb R$ such that $a\ne0,$ defining
$$\alpha:=\arctan\left(-\frac ba\right),\quad c:=\operatorname{sgn}(a) \sqrt{a^2+b^2},$$
we obtain:
$$\alpha\in\left(-\frac\pi2,\frac\pi2\right)\quad\text{and}\quad a=c\cos\alpha,\quad b=-c\sin\alpha,$$
hence
$$\forall x\in\Bbb R\quad a\cos x+b\sin x=c\cos(x+\alpha).$$
A: Expanding the right-hand side of the expression we get that
$$c\cos(x+\alpha)=c(\cos(\alpha)\cos(x)-\sin(\alpha)\sin(x))=(c\cos(\alpha))\cos(x)-(c\sin(\alpha))\sin(x),$$
and after identifying with the left-hand side of the original expression we see that
$$\cos(\alpha)=\frac{a}{c},\quad \sin(\alpha)=\frac{-b}{c}.$$
Now we note the following: if (assuming that $a\neq 0$) $a$ and $c$ have the same sign, then $\cos(\alpha)> 0$, meaning that there is going to be precisely one angle $\alpha$ within the range $(-\pi/2,\pi/2)$ (which is the range of the $\arctan$ function) with the correct sine and cosine. And this seems to be the entire point as far as I can see behind having the sign of $c$ being equal to that of $a$. In general, we get that
$$\tan(\alpha)=\frac{\sin(\alpha)}{\cos(\alpha)}=\frac{-b/c}{a/c}=\frac{-b}{a},$$
and this equation has the solution
$$\alpha=\arctan(-b/a)+2n\pi$$
only if $\cos(\alpha)>0$.
Whoever showed you this particular way of rewriting sums of sine and cosine probably wanted you to have a really simple formula for $\alpha$ that would work no matter what, and this is why they felt the need to introduce the signing convention for $c$ the way they did. While I have some opinions about this particular way of teaching in general, I'd say that it's all a matter of preference in the end. If you feel like it's less confusing you can just as well work with $c=\sqrt{a^2+b^2}$ (i.e., just letting $c$ be the amplitude of the resulting wave) and solve for $\alpha$ using the equations for sine and cosine given above (remember: you only need to find one angle $\alpha$ that works). You can of course also work with the other addition/subtraction formulas for sine and cosine, it doesn't have to be the addition formula for cosine specifically.
So to answer your questions (in short):

*

*The sign of $c$ is introduced with the sole purpose of being able to give a simple formula for $\alpha$.

*With this in mind, the range of $\alpha$ is $(-\pi/2,\pi/2)$ (in the case that $a\neq 0$: otherwise $\alpha=\pm \pi/2$ depending on the sign of $b$ and $c$ that you choose). This is because this is precisely the range of the $\arctan$ function.

*The range of $x$ is actually not restricted at all in these formulas, i.e., the range of $x$ is the entirety of $\mathbb{R}$.

A: By expanding the RHS,
$$c\cos (x+\alpha) = \underbrace{(c \cos \alpha)}_a\cos x + \underbrace{(-c\sin \alpha)}_b\sin x$$
The goal is to find some $c$ and $\alpha$ combination such that
$$a = c\cos\alpha; \quad b = -c\sin \alpha \tag 1$$
One common way is to take $\alpha$ as the principal value where $\tan\alpha = \frac{-b}a$ (as your question does). Then

*

*$\alpha$ is within $\left(-\pi/2, \pi/2\right)$,

*$\sin\alpha$ follows the sign of $\frac{-b}a$, and

*$\cos\alpha$ is always positive.

To satisfy $(1)$, if $a > 0$ then $c$ has to be positive, and otherwise if $a<0$ then $c$ has to be negative. In other words, the sign of $c$ is the same as the sign of $a$.
In either case, the magnitude of $c$ comes from
$$c^2 = (c\cos\alpha)^2 + (-c\sin\alpha)^2 = a^2+b^2$$

A different option to define $c$ and $\alpha$ is that $c$ is always positive (as an amplitude), and $\alpha$ may be a phase angle from a full $2\pi$ interval.
The magnitude of $c$ is as before:
$$c = \sqrt{a^2+b^2}$$
And $\alpha$ is taken from a full $2\pi$ interval to match both these equations, including their signs:
$$\frac{a}{c} =\cos \alpha;\quad \frac{-b}c = \sin \alpha$$
In terms of atan2, the 2-argument arctangent, the following returns an $\alpha$ value in $(-\pi, \pi]$:
$$\alpha = \operatorname{atan2}(-b, a)$$
But rewriting this using the traditional $\arctan$ becomes more complicated when $a < 0$.
