# Solving system of equations which contain sin and cos

I require some help to push me in the right direction to solve these equations.

$$t_1 = P_1\sin(A)\sin(B) + P_2\cos(A)\cos(B)$$

$$t_2 = P_3\cos(A)\sin(B) + P_4\sin(A)\cos(B)$$

where $t_1, t_2, P_1, P_2, P_3, P_4$ are known coefficients. Solving for $A$ and $B$.

Any help greatly appreciated.

This may seem like it, but this is not homework

-
I've added LaTeX formatting to your question. – Zev Chonoles Jul 14 '11 at 6:12
thank you. looks much better now – leo Jul 14 '11 at 6:13
I can actually solve a specific case here. That is if $P_{1}=P_{2}$ and $P_{3}=P_{4}$ you simply have $t_{1}= P_{1} \cdot \cos(A-B)$ and $t_{2} = P_{2}\cdot \sin(A+B)$ – user9413 Jul 14 '11 at 6:15
Perhaps it would help to think of this in terms of matrices and vectors: $$\pmatrix{P_1\sin(A) & P_2\cos(A)\\ P_3\cos(A) & P_4\sin(A)}\pmatrix{\sin(B)\\ \cos(B)}=\pmatrix{t_1\\t_2}$$ – Zev Chonoles Jul 14 '11 at 6:17
thank you, however i cannot assume P1 = P2 and P3=P4 – leo Jul 14 '11 at 6:17

Using the product to sum formulas we can convert your equations into

$$e_1 = a \cos x + b \cos y$$

$$e_2 = c \sin x + d \sin y$$

where $x = A+B$ and $y = A-B$.

This gives us

$$\left(\frac{a \cos x - e_1}{b}\right)^2 + \left(\frac{c \sin x -e_2}{d}\right)^2 = 1$$

which can be made into a 4th degree polynomial in terms of $\cos x$: by moving $\sin x$ term to the right and using $\sin^2 x = 1 - \cos ^2 x$ and squaring, which is solvable in "closed" form and standard techniques exist to do that.

Once you solve for $\cos x$, it is easy to solve for $\cos y$ and thus get back $A$ and $B$.

-

Putting $x=\sin A$, $y=\sin B\$ turns the system into algebraic one: $$\left(t_1-P_1 x y\right){}^2=P_2^2 \left(1-x^2\right) \left(1-y^2\right),$$ $$\left(P_3^2 \left(x^2-1\right) y^2+P_4^2 x^2 \left(y^2-1\right)+t_2^2\right){}^2=4 P_3^2 P_4^2 x^2 \left(x^2-1\right) y^2 \left(y^2-1\right).$$ For concrete values of parameters its solutions can be obtained in mathematical software.

-