Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Does the equation

$$ a \cdot \cos(\theta) - b \cdot \sin(\theta) = c$$ have a closed-form solution for $\theta$? What about the case where $a^2 + b^2 = 1$?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Using the identity $ sin(x)^2 + cos(x)^2=1 $, we have,

$$a \cdot\, \cos(\theta) - b \cdot \sin(\theta) = c \Rightarrow a\sqrt{1-\sin^2(\theta)}= b \cdot \sin(\theta) + c $$ $$ \Rightarrow a^2\,(1-\sin^2(\theta)) = ( b\sin(\theta) +c)^2 $$

$$ (a^2 + b^2)\sin(\theta)^2 + 2bc \sin(\theta) + (c^2-a^2)=0\,. $$

The above equation is quadratic in $\sin(\theta)$. Solving the equation in $\sin(\theta)$ yields,

$$ \sin(\theta) = \frac{ -2bc \pm \sqrt{4b^2c^2-4(a^2+b^2)(c^2-a^2)}}{2(a^2+b^2)} $$

I believe you know how to find theta from here. Do not forget that $-1\leq \sin(\theta) \leq 1$.

share|improve this answer
add comment

Given your use of signs I'll take it that $a,b \ge 0$. In which case, if $R = \sqrt{a^2+b^2}$ and $\alpha = \tan^{-1} \dfrac{b}{a}$ then

$$a \cos \theta - b\sin \theta = R\cos(\theta + \alpha)$$

and so if $\left| c \right| \le R$, we can solve the equation to get

$$\theta = \cos^{-1} \dfrac{c}{R} - \alpha = \boxed{\cos^{-1} \dfrac{c}{\sqrt{a^2+b^2}} - \tan^{-1} \dfrac{b}{a}}$$

Of course, this is just one solution; we can obtain the others by considering symmetries.

share|improve this answer
add comment

Yes, if this is acceptable as closed-form for you.

Using the formula, you can solve for $\theta$ and have an answer in terms of nothing more complicated than arcsine and square roots.

$$\theta=\arcsin(c/\sqrt{a^2+b^2})-\phi$$

I'll leave the determination of $\phi$ up to you as an exercise.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.