I have a question about the addition formula for $\sin x$ and $\cos x$ . Generally, I have seen the following formula referenced $$a\sin x + b \cos x = \sqrt{a^2+b^2} \cos ( x + \arctan{-\frac{a}{b}})$$ however, this formula seems to only hold for $b>0$ . I have attached an image for $b>0$ and for $b<0$
. First I thought it had something to do with the
principle value of $\arctan$ , however, after some experimentation I
found that the
following to hold for all $a$ and $b$
$$a\sin x + b \cos x =\frac{b}{|b|} \sqrt{a^2+b^2} \cos ( x + \arctan{-\frac{a}{b}}) $$ except for $b=0$. Does anybody know this seems to occur and moreover what is the principled way of dealing with simplifications for $a\sin x + b \cos x$ (when given values and when not)?
Thanks in advance