# Solve $\cos(\theta) + \sin(\theta) = x$ for known $x$, unknown $\theta$?

After looking at the list of trigonometric identities, I can't seem to find a way to solve this. Is it solvable?

$$\cos(\theta) + \sin(\theta) = x.$$

What if I added another equation to the problem:

$$-\sin(\theta) + \cos(\theta) = y,$$ where $\theta$ is the same and $y$ is also known?

Thanks.

EDIT:

OK, so using the linear combinations I was able to whip out:

$$a \sin(\theta) + b \cos(\theta) = x = \sqrt{a^2 + b^2} \sin(\theta + \phi),$$ where $\phi = \arcsin \left( \frac{b}{\sqrt{a^2 + b^2}} \right) = \frac{\pi}{4}$ (as long as $a\geq 0$)

Giving me:

$$x = \sin(\theta + \frac{\pi}{4}) \text{ and } \arcsin(x) - \frac{\pi}{4} = \theta.$$

All set! Thanks!

-
It's definitely solvable. You may have overlooked the identity though. Just look for identities that involve sums of trigonometric functions. –  Raskolnikov Feb 5 '11 at 16:46
Hint: use en.wikipedia.org/wiki/… –  Dan Petersen Feb 5 '11 at 16:46
As you can solve the first equation, adding the second to the mix may well make it inconsistent. The second is solvable alone, using a very similar technique. –  Ross Millikan Feb 5 '11 at 16:58
Hmmm... $x$ is not the sine you write, there is is still a factor missing in your solution (equivalently, try $x=1$ and see what happens). –  Did Aug 12 '11 at 14:03

Yeah you can write $\frac{1}{\sqrt{2}}\Bigl[\cos{\theta} + \sin{\theta}\Bigl]$ as $\sin\Bigl(\frac{\pi}{4}+\theta\Bigr)$ and solve for $x$.

Multiply both sides by $\frac{1}{\sqrt{2}}$ and then try something.

-
I thought the identity was: $cos(\theta) = sin(\theta + \frac{\pi}{2})$. If I'm not mistaken, that would give me $sin(\theta) + sin(\theta + \frac{\pi}{2}) = x$. –  levesque Feb 5 '11 at 16:48
@Jcl: yeah sorry –  anonymous Feb 5 '11 at 16:49
@JCL: You could try this. –  anonymous Feb 5 '11 at 16:53
Both identities are true. But the one Chandru1 suggested is more useful for the problem at hand. –  Ross Millikan Feb 5 '11 at 16:56

Another method goes by noting that $\cos^2\theta+\sin^2\theta=1$. We have $\cos\theta+\sin\theta=x$, so $$\cos^2\theta+2\cos\theta\sin\theta+\sin^2\theta=x^2,$$ or $2\cos\theta\sin\theta=x^2-1$. But $2\cos\theta\sin\theta=\sin(2\theta)$, so $2\theta=\sin^{-1}(x^2-1)$, or $$\theta=\frac12\sin^{-1}(x^2-1).$$

-
I think squaring introduces an extraneous solution $\pi + \theta$ (where $\theta$ is the correct solution) in this problem. –  Srivatsan Aug 12 '11 at 11:24

Linear equations in $\sin \theta$ and $\cos \theta$ can be solved by a resolvent quadratic equation, using the two identities (also here):

$$\cos \theta =\frac{1-\tan ^{2}\frac{\theta }{2}}{1+\tan ^{2}\frac{\theta }{2% }}$$

and

$$\sin \theta =\frac{2\tan \frac{\theta }{2}}{1+\tan ^{2}\frac{\theta }{2}}.$$

In this case, we have

$$\begin{eqnarray*} \cos \theta +\sin \theta &=&x \\ &\Leftrightarrow &\left( 1-\tan ^{2}\frac{\theta }{2}\right) +2\tan \frac{% \theta }{2}=x\left( 1+\tan ^{2}\frac{\theta }{2}\right) \\ &\Leftrightarrow &(x+1)\tan ^{2}\frac{\theta }{2}-2\tan \frac{\theta }{2}% +x-1=0 \\ &\Leftrightarrow &\tan \frac{\theta }{2}=\frac{2\pm \sqrt{4-4(x+1)(x-1)}}{% 2(x+1)} \\ &\Leftrightarrow &\tan \frac{\theta }{2}=\frac{1\pm \sqrt{2-x^{2}}}{x+1} \\ &\Leftrightarrow &\theta =2\arctan \frac{1\pm \sqrt{2-x^{2}}}{x+1}. \end{eqnarray*}$$

-

If you know

$$\cos(\theta) + \sin(\theta) = x$$

and

$$-\sin(\theta) + \cos(\theta) = y$$

then you have a system of two linear equations in the 'unknowns' $\cos(\theta)$ and $\sin(\theta)$, and thus can solve for the values of $\cos(\theta)$ and $\sin(\theta)$:

$$\cos(\theta) = \frac{x+y}{2}$$ $$\sin(\theta) = \frac{x-y}{2}$$

and then obtain $\theta$ in your favorite manner.

-
Wow.. I am ashamed of myself for even asking this question :) –  levesque Jun 25 '12 at 15:47
Don't worry too much. While this is a neat trick and obvious in retrospect, there is something to be said about recognizing that you can solve for $\theta$ from just one equation. I've gotten a lot of good results over the years by recognizing I can use some method to solve a problem and then doing so, rather than spending more time looking for a 'simpler' solution that might not exist. –  Hurkyl Jun 25 '12 at 16:34

Maybe this is a bit too late but even without the second equation, it is solvable...

$$x=\sin\theta+\cos\theta\\ \mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }=\sin\theta+\sin\left(\frac{\pi}{2}-\theta\right)\\ \mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }=\sin\theta\cos\left(\frac{\pi}{2}-\theta\right)+\cos\theta\sin\left(\frac{\pi}{2}-\theta\right)\\ \mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }=\sin^2\theta+\cos^2\theta\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\\=1\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }$$

$$\mbox{As required.}$$

Thus, there are only trivial solutions. No non-trivial ones.

Edit: Oops! The above is completely wrong as pointed out by Andrew D in the comments. I have really done absoluted nonsense. What a silly error! The correct should be: $$x=\sin\theta+\cos\theta\\ \mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }\mbox{ }=\sin\theta+\sin\left(\frac{\pi}{2}-\theta\right)\\ =2\sin\left(\pi/4\right)\cos\left(\pi/4-\theta\right)\\ =\sqrt2\sin\left(\theta\right)$$ So, $$\theta=\arcsin\frac{x}{\sqrt2}$$

-
This is incorrect - you are trying to use the formula for $\sin(A+B)$ rather than the one for $\sin A + \sin B$, which is equal to $2\sin(\frac{A+B}{2})\cos(\frac{A-B}{2})$. –  Andrew D Jun 8 '13 at 10:22
I'm fairly sure you forgot to divide by 2 (as in you wrote $\sin(\frac{\pi}{2})$ rather than $\sin(\frac{\pi}{4})$ and similarily for the cosine term). –  Andrew D Jun 8 '13 at 10:39
@AndrewD: Yes, you're right. What's wrong with me today?! I just corrected the error. –  dimensio1n0 Jun 8 '13 at 11:11