<s>[INST] How to solve the following trigonometrical equation? I have the following equations
\begin{align*}
R_1\cos(\omega T_1-\phi_{1})& =Q_1-R_2\cos(\omega T_2-\phi_{2})\\
R_1\sin(\omega T_1-\phi_{1})& =-Q_2-R_2\sin(\omega T_2-\phi_{2}).
\end{align*}
From these equations how can I obtain the following solution
$$\omega T_2=\pm \arccos\left(\frac{Q_1^2+Q_2^2-R_1^2+R_2^2}{2R_2\sqrt{Q_1^2+Q_1^2}}\right)-\arctan\left(\frac{Q_2}{Q_1}\right)+\phi_2+2k\pi .$$
 [/INST] Another way to tackle the same problem of solving $a \sin \theta + b \cos \theta + c = 0$ is to use the tan-half-angle substitutions
$$\begin{aligned}
t &=  \tan \left( \frac{\theta}{2} \right)\, \rightarrow & \theta = 2 \arctan(t) \\
\sin(\theta) & = \frac{2 t}{1+t^2} \\
\cos(\theta) & = \frac{1-t^2}{1+t^2}
\end{aligned}$$
The problem is transformed into a polynomial equation
$$\left. a \frac{2 t}{1+t^2} + b \frac{1-t^2}{1+t^2} + c = 0 \right\}\;\;
t=\begin{cases} \frac{a+\sqrt{a^2+b^2-c^2}}{b-c} \\ \frac{a-\sqrt{a^2+b^2-c^2}}{b-c} \end{cases} $$
With the final and solution in terms of the angle
$$ \theta = \begin{cases} 2 \arctan\left( \frac{a+\sqrt{a^2+b^2-c^2}}{b-c} \right) \\ 2 \arctan\left( \frac{a-\sqrt{a^2+b^2-c^2}}{b-c} \right) \end{cases} $$

Example
$$ 5 \sin \theta + 2 \cos \theta - 3 = 0 $$
$$ t= \begin{cases} 
  \frac{5}{2-(-3)} + \frac{ \sqrt{5^2+2^2-(-3)^2}}{2-(-3)} = 1.89443 \\
  \frac{5}{2-(-3)} - \frac{ \sqrt{5^2+2^2-(-3)^2}}{2-(-3)} = 0.10557
\end{cases} $$
$$ \theta= \begin{cases} 
 2 \arctan(1.89443) = 2.170\,{\rm rad} \\
 2 \arctan(0.10557) = 0.2104\,{\rm rad}
\end{cases} $$
Check
$$ \begin{cases}
  5 \sin(2.170)+2 \cos(2.170) -3 \approx 0 \\
  5 \sin(0.2104) + 2\cos(0.2104) -3 \approx 0
\end{cases} $$
</s>