0

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?

Quanto
  • 97,352

1 Answers1

2

Your solutions $S=ac\pm bd$ and $C=bc\mp ad$ are only for the restricted case of $a^2+b^2=1$.

In the general case, the corresponding equation for $S$ is

$$(a^2+b^2)S^2-2acS+c^2-b^2=0$$

which yields the solution,

$$S=\frac{ac\pm bd}{a^2+b^2},\>\>\>\>\> C=\frac{bc\mp ad}{a^2+b^2}, $$

where $d=\sqrt{a^2+b^2-c^2}$.

Quanto
  • 97,352