# Conversion from the linear-combination to the sinusoidal form of a sinusoidal function (simple problem, but I'm missing something.)

This is a standard trigonometric identity that can be easily verified:

$$a\cos (x) + b\sin (x) = \sqrt{a^2+b^2}\cos (x - p),\text{ where }\tan(p)=\frac ba.$$

So for example,

$$\sqrt2\cos(1)-\sqrt2\sin(1)=-0.43=2\cos(1-p_1),\text{ where }\tan(p_1)=-1,$$

and

$$-\sqrt2\cos(1)+\sqrt2\sin(1)=0.43=2\cos(1-p_2),\text{ where }\tan(p_2)=-1.$$

My question is, why is is that $p_1$ is the principal value of $\arctan (-1) = -0.79$ radians, whereas for $p_2$, I have to add $\pi$ to the principal value so as to get the positive angle $2.36$ radians?

I.e. How could I have deduced that $p_1$ lies in the $4^\text{th}$ quadrant and that $p_2$ lies in the $2^\text{nd}$ quadrant??

-
You pick the one that makes the sign of the $\cos(1-\circ)$ agree as it's supposed to. – anon Sep 20 '12 at 14:12
@anon Agree with what? The original identity doesn't explicitly indicate any restriction on the angles. – Ryan Sep 20 '12 at 14:18
Your first equation says $\cos(1-p)$ is negative, the second says $\cos(1-p)$ is positive. If you plug in $p=2.36$ in the first cosine you get a positive number (which is not correct), and if you plug in $p=-0.79$ in the second cosine you get a negative number (also incorrect). – anon Sep 20 '12 at 14:24
@anon Sorry I wasn't clear in my question. I'm not asking about the mechanics of the problem-- in fact I had designed it myself (I mean I came up with all the values above). My question is on the intuition/"why" behind it. This question arose in the context of my studying forced damped oscillations (finding a particular integral of a constant-coeff 2nd-order linear differential eqn by directly plugging in the coefficients into a sinusoidal formula WITHOUT first going through the linear-combi form). – Ryan Sep 20 '12 at 14:31
@Ryan : Writing "a\sin x" instead of "a sin x" not only causes "$\sin$" not to be italicized, but also results in proper spacing before and after "$\sin$", thus: $a sin x$ versus $a\sin x$. And similarly for \log, \arctan, \max, \det, etc. In some cases, like \max, it affects the positining of subscripts, as in $\displaystyle\max_{x\in S}$. – Michael Hardy Sep 20 '12 at 17:11

If we use the trigonometric identity $\cos(s-t)=\cos s\cos t+\sin s \sin t$, we can see that $p$ is any number (angle) whose sine is $\dfrac{b}{\sqrt{a^2+b^2}}$ and whose cosine is $\dfrac{a}{\sqrt{a^2+b^2}}$.
So in your first example, we want $p_1$ such that $\sin(p_1)=-1$ and $\cos(p_1)=1$. This happens to be $\arctan(-1)$.
In your second example, we want $\sin(p_2)=1$ and $\cos(p_2)=-1$. The same tangent as in the previous case, but definitely not given by $\arctan(-1)$.
If one remembers that it is not merely $\tan$ that needs to be matched, but both $\sin$ and $\cos$, the difficulty disappears.
Remark: Because this is a common issue, many computer languages have a built in function, often called something like atan2, which given an ordered pair of $(u,v)$ of numbers, produces an angle whose cosine is $u$ and whose sine is $v$. For each implementation, one has to check the details, because the syntax is not standard, sometimes the roles of $u$ and $v$ are reversed.