I'm trying to solve the equation of the form:
$$a \cos x+b \sin x=c$$
I've found the following already answered question on math.stackexchange and followed the solution given by Yves Daoust on Dec 21 2017 at 8:52, whereupon I get the following (if I've understood Yves' steps correctly):
Let $S=\sin(x)$ and $C=\cos(x)$ and substitute into the original equation to get:
$aC+bS=c$
$bS=c-aC$
$b^2(1-S^2)=(c-aS)^2$
$S^2-2acS+c^2-b^2=0$
$d=\sqrt{1-c^2}$
$C=bc\mp ad$
$S=ac\pm bd$
Then I solve for "x" using $arc\cos(bc\mp ad)$ or $arc\sin(ac\pm bd)$.
I'm wanting to use this method to provide an alternative way of calculating an angle in a software application that I'm working on and trying to fix an issue with.
Now I'm wondering if I've done this correctly, or if there are any steps that I have missed?