solution to equation $a \cdot \cos(\theta) - b \cdot \sin(\theta) = c$

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$?

-

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$.

-

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.

-

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.

-