<s>[INST] Writing $3\sin(x)+4\cos(x)$ in the form of $r \sin(x-a)$ I need to write $3\sin(x) + 4\cos(x)$ in the form of $r\sin(x-a)$.
Expanding $r\sin(x-a): r\sin(x)\cos(a)-r\sin(a)\cos(x)$
Comparing the two forms (The original equation and the expanded form): $3=r\cos(a)$ and $4=-r\sin(a)$.
Getting $r$:
$$\begin{align*}
3^2 + 4^2 &= r^2 \cos(a)^2 + r^2 \sin(a)^2\\
25 &= r^2 (\cos(a)^2 + \sin(a)^2)\\
25 &= r^2\\
r &= -5, 5
\end{align*}$$
Getting $a$:
$$\begin{align*}
\frac{-r\sin(a)}{ r\cos(a)} &= \frac{3}{4}\\
\tan(a) &= -\frac{3}{4}\\
a &= \arctan(-3/4)\\
a &= -36.87, 143.13\\
\end{align*}$$
The questions:-
There are two values for both $r$ and $a$, how should I choose the values to be in the final form?
 [/INST] $$\begin{align*}
f(x) &= 3 \sin(x) + 4 \cos(x) \\
f(x) &= 5\left(\frac{3}{5} \sin(x) + \frac{4}{5} \cos(x) \right)
\end{align*}$$
Let $\sin(y) = 4/5$ and $\cos(y) =3/5$, for some real number $y$.
$$\begin{align*}
f(x) &= 5\left(\cos(y)\sin(x) + \sin(y)\cos(x)\right)\\
f(x) &= 5\sin(x+y)&\text{(where }y = \arcsin(4/5)\text{)}
\end{align*}$$
Using trigonometric tables, $y = 36.87$.
$$f(x) = 5\sin(x + 36.87^{\circ})$$ 
which can also be written as
$$f(x) = 5 \sin (180 - x - 36.87) = -5\sin(x - 144.13).$$
This justifies the 2 values of $a$ and $r$ in $r\sin(x−a)$.
</s>