# Solving $a \sin\theta + b \cos\theta = c$

Could someone help me with the steps for solving the below equation $$a \sin\theta + b \cos\theta = c$$ I know that the solution is $$\theta = \tan^{-1} \frac{c}{^+_-\sqrt{a^2 + b^2 - c^2}} - \tan^{-1} \frac{a}{b}$$ I just can't figure out the right steps to arrive at this solution.

here is a trick: write $$\frac{a}{\sqrt{a^2+b^2}}\sin(\theta)+\frac{b}{\sqrt{a^2+b^2}}\cos(\theta)=\frac{c}{\sqrt{a^2+b^2}}$$ Setting $$\cos(\phi)=\frac{a}{\sqrt{a^2+b^2}}$$ and $$\sin(\phi)=\frac{b}{\sqrt{a^2+b^2}}$$ then you will get $$\sin(\phi+\theta)=\frac{c}{\sqrt{a^2+b^2}}$$ so $$\theta=\arcsin\left(\frac{c}{\sqrt{a^2+b^2}}\right)-\phi$$

• I'd love to figure this out, but I can't seem to get from here to the solution above... Commented Feb 14, 2018 at 17:21

Well, we have:

$$\text{a}\cdot\sin\left(x\right)+\text{b}\cdot\cos\left(x\right)=\text{c}\tag1$$

Substitute $\text{y}=\tan\left(\frac{x}{2}\right)$, so $\sin\left(x\right)=\frac{2\cdot\text{y}}{1+\text{y}^2}$ and $\cos\left(x\right)=\frac{1-\text{y}^2}{1+\text{y}^2}$:

$$\text{y}^2-\frac{\text{b}-\text{c}}{\text{b}+c}-\frac{2\cdot\text{a}\cdot\text{y}}{\text{b}+\text{c}}=0\tag2$$

Solving for $\text{y}$, gives:

$$\text{y}=\pm\sqrt{\frac{\text{a}^2}{\text{b}+\text{c}}+\frac{\text{b}-\text{c}}{\text{b}+\text{c}}}+\frac{\text{a}}{\text{b}+\text{c}}\tag3$$

You can rewrite the expression on the left side: $$a\cdot\sin(\theta)+b\cdot\cos(\theta)= A\sin(\theta+\tau)= A\cdot\sin(\theta)\cos(\tau)+A\cdot\cos(\theta)\sin(\tau)$$

$$A\cdot\cos(\tau)=a$$ $$A\cdot\sin(\tau)=b$$

The paramteres of the rewritten form: $$A=\sqrt{a^2+b^2}$$ $$\tan(\tau)=\frac{b}{a}$$

You can express $\tan(\theta+\tau)$ using $\cos(\theta+\tau)=^+_-\sqrt{1-\sin^2(\theta+\tau)}$.

You will get the result in the form you want it.

Recall the sum formula for sine $$A\sin(\theta+\alpha)=A\sin(\theta)\cos(\alpha)+A\cos(\theta)\sin(\alpha)$$

Equating this with the L.H.S gives

$$a\sin(\theta)+b\cos(\theta)=A\cos(\alpha)\sin(\theta)+A\sin(\alpha)\cos(\theta)$$

so we get the system

$$a=A\cos(\alpha)\\b=A\sin(\alpha)$$

and so $$A=\sqrt{a^2+b^2}$$.

Recall that we're defining some angle $$\alpha$$ such that both $$\cos(\alpha)=\frac{a}{\sqrt{a^2+b^2}}$$ and $$\sin(\alpha)=\frac{b}{\sqrt{a^2+b^2}}$$, so $$\alpha$$ is unique over one rotation and falls within a quadrant that depends on the signs of $$a$$ and $$b$$. You should be able to convince yourself that $$\alpha$$ takes the value

$$\alpha=\begin{cases} \arctan(b/a), &a\gt0\\ \arctan(b/a)+\pi, &a\lt0 \end{cases}$$

So for $$a>0$$, we get

$$a\sin(\theta)+b\cos(\theta)=\sqrt{a^2+b^2}\sin(\theta+\arctan(b/a))$$

and from the identity $$\sin(\theta+\pi)=-\sin(\theta)$$, then for $$a<0$$ we get

$$\sqrt{a^2+b^2}\sin(\theta+\arctan(b/a)+\pi)=-\sqrt{a^2+b^2}\sin(\theta+\arctan(b/a))$$

so we can conclude that in general

$$a\sin(\theta)+b\cos(\theta)=\frac{a}{|a|}\sqrt{a^2+b^2}\sin(\theta+\arctan(b/a))\quad (a\neq 0)$$

For $$-\sqrt{a^2+b^2}\leq c\leq\sqrt{a^2+b^2}$$, we get

$$\frac{a}{|a|}\sqrt{a^2+b^2}\sin(\theta+\arctan(b/a))=c\\ \implies\sin(\theta+\arctan(b/a))=\frac{|a|c}{a\sqrt{a^2+b^2}}\\ \implies\theta_1=\arcsin\left(\frac{|a|c}{a\sqrt{a^2+b^2}}\right)-\arctan\left(\frac{b}{a}\right),\\ \theta_2=\pi-\arcsin\left(\frac{|a|c}{a\sqrt{a^2+b^2}}\right)-\arctan\left(\frac{b} {a}\right)$$

Use the identity $$\arcsin(x)=\arctan\left(\frac{x}{\sqrt{1-x^2}}\right)$$ with $$x=\frac{|a|c}{a\sqrt{a^2+b^2}}$$ to get

$$\arcsin\left(\frac{|a|c}{a\sqrt{a^2+b^2}}\right)=\arctan\left(\frac{|a|c}{a\sqrt{a^2+b^2}}\cdot\frac{\sqrt{a^2+b^2}}{\sqrt{a^2+b^2-c^2}}\right)\\ =\arctan\left(\frac{|a|c}{a\sqrt{a^2+b^2-c^2}}\right)$$

and conclude that the general solution becomes

$$\theta_1=\arctan\left(\frac{|a|c}{a\sqrt{a^2+b^2-c^2}}\right)-\arctan\left(\frac{b}{a}\right)+2\pi k_1\\ \theta_2=-\arctan\left(\frac{|a|c}{a\sqrt{a^2+b^2-c^2}}\right)-\arctan\left(\frac{b}{a}\right)+\pi(2k_2+1)$$

where $$k_1,k_2\in\mathbb{Z}$$ and $$a\neq 0$$.

As desired.