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

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) }$$
