How to solve $a = \cos x - b\sin x$ where $a$ and $b$ are real numbers? I found this equation when solving a physics problem related to finding an angle when entering a river, that has a known current, and trying to get to a specific point on the other side.  I'm not sure how to solve this equation explicitly for the angle $x$.
 A: Method 1:


*

*$a=\cos x - b\sin x$

*$\cos x = a+b\sin x$

*$\cos^2x = a^2+2ab\sin x+b^2\sin^2x$

*$1-\sin^2x = a^2+2ab\sin x+b^2\sin^2x$

*$(a^2-1)+2ab\sin x+(b^2+1)\sin^2x=0$


Then quadratic.

Method 2:
$$\sin(\alpha-x)=\sin\alpha\cos x-\cos\alpha\sin x$$
$$\frac{\sin(\alpha-x)}{\sin\alpha}=\cos x-\frac1{\tan\alpha}\sin x$$
Let $\frac1{\tan\alpha}=b$, then $\frac1{\sin\alpha}=\sqrt{b^2+1}$.
The equation becomes:


*

*$a=\sqrt{b^2+1}\sin(\alpha-x)$

*$\sin(\alpha-x)=\dfrac{a}{\sqrt{b^2+1}}$

A: Another way to solve these equations is by applying Euler's formula.
$$a=\frac{e^{ix}+e^{-ix}}{2}+b\frac{e^{ix}-e^{-ix}}{2i}$$
Now substitute $u=e^{ix}$.
$$a=\frac{u+\frac{1}{u}}{2}+b\frac{u-\frac{1}{u}}{2i}$$
Solve the resulting 2nd order polynomial to get $u_{1/2}$. Plug these values back into the substitution equation $u_{1/2}=e^{ix_{1/2}}$
A: Another way to solve this to use $x=y+z$ and expand the trig into
$$ a = \cos(y) \left( \cos(z) - b \sin(z) \right) - \sin(y) \left( b \cos(z) + \sin(z) \right) $$
Solve $\cos(z) - b \sin(z)=0$ with $z =\tan^{-1}(\frac{1}{b})$ and simplify  the above into $$ a = - \sin(y) \left( b \cos(z) + \sin(z) \right) = - \sqrt{1+b^2} \sin(y)$$
This has a solution of $y = -\sin^{-1} \left(\frac{a}{\sqrt{1+b^2}}\right)$. 
Altogether the solution is
$$\boxed{ x = \tan^{-1} \left( \frac{1}{b} \right) - \sin^{-1} \left( \frac{a}{\sqrt{1+b^2}} \right) }$$
A: Looking at the equation $a = \cos x - b\sin x$, I see that it's similar in form to the sum-to product identities e.g. $\cos(A+B)=\cos A\cos B-\sin A \sin B$. With that in mind, I multiply both sides by a constant $C$ to get $a C = C \cos x-bC \sin x$ and I look for an angle $A$ such that $C=\cos A$, $bC=\sin A$.
But these imply $b=\tan A\implies A=\tan^{-1}b\implies C=\cos \tan^{-1}b=(1+b^2)^{-1/2}$. Therefore $$aC=C\cos x-b C\sin x=\cos A\cos x-\sin A\sin x=\cos(A+x),$$ which implies $$x=\cos^{-1}(aC)-A = \cos^{-1}\left(\frac{a}{\sqrt{1+b^2}}\right)-\tan^{-1}b.$$
