# Deriving the sum of sin and cos formula

1. Mar 15, 2017

### Mr Davis 97

1. The problem statement, all variables and given/known data
Show that $a \sin x + b\cos x = c \sin (x + \theta)$, where $c = \sqrt{a^2 + b^2}$ and $\displaystyle \theta = \arctan (\frac{b}{a})$

2. Relevant equations

3. The attempt at a solution
We see that $c \sin (x + \theta) = c \cos \theta (\sin x) + x \sin \theta (\cos x)$. So we compare coefficients. $a = c \cos \theta$ and $b = c sin \theta$. We can assume that neither $a$ or $b$ are zero, so we find by division that $c = \sqrt{a^2 + b^2}$. Next, we see that $a^2 + b^ = c^2 \cos^2 \theta + c^2 \sin^2 \theta = c^2$, so $c = \pm \sqrt{a^2+b^2}$. So it seems that I am done, since the we can take the positive root. However, what about the negative root? Would that give a valid answer too? Why isn't the negative root the one that is desired by the question?

2. Mar 15, 2017

### Buffu

I think you mean "so we find by division that $\theta = \arctan(b/a)$.

I can think of two ways why $c >0$

First because the term on LHS is the equation of a straight line in polar coordinates and $c$ corresponds to $r$ in polar. Since $r$ is always +ve and thus so is $c$.

Second, for given $a,b > 0$ you can always construct a right triangle with $h = \sqrt{a^2 + b^2}$. (h is hypotenuse).

So we can write $a\sin x + b\cos x = \sqrt{a^2 + b^2}\left({a\over \sqrt{a^2 + b^2}}\sin x + {b\over \sqrt{a^2 + b^2}}\cos x\right)$

Lets angle between $h$ and $a$ as $\theta$, So we get $\cos \theta = {a\over \sqrt{a^2 + b^2}}, \ \ \ \sin \theta = {b\over \sqrt{a^2 + b^2}}$ and $\tan \theta = {b \over a}$

From here we can get,$\theta = \arctan(b/a)$,

And $\sqrt{a^2 + b^2}\left({a\over \sqrt{a^2 + b^2}}\sin x + {b\over \sqrt{a^2 + b^2}}\cos x\right) = \sqrt{a^2 + b^2}\left(\cos \theta\sin x + \sin \theta\cos x\right) = \sqrt{a^2 + b^2}\sin (\theta + x)$

From here you can see $c = h = \sqrt{a^2 + b^2}$, and hypotenuses are not negative, Do they ?

3. Mar 15, 2017

In the determination of the angle $\theta$, $a$ and $b$ need to retain their sign, and you draw a diagram to find $\theta$. If both $a$ a $b$ are negative, then $\theta$ winds up in the third quadrant, instead of the first. There is ambiguity in the expression $arctan(\frac{b}{a})$ if you don't preserve the signs of $b$ and $a$. It is important to preserve the signs of $b$ and $a$ in this calculation. The $\theta$ you compute will be different for $a=1$ and $b=1$ as compared to $a=-1$ and $b=-1$. To preserve the signs, you need to use the positive root for $c$.