Finding the exact solutions for a system of equations I am computationally trying to solve the system of linear equations given below.
$
\frac{1}{1+tan(\theta/2)*tan(\phi/2)*tan(\psi/2)} 
\begin{bmatrix}
tan(\psi/2)-tan(\theta/2)*tan(\phi/2) \\
tan(\phi/2)+tan(\theta/2)*tan(\psi/2) \\
tan(\theta/2)-tan(\phi/2)*tan(\psi/2)
\end{bmatrix}
=
\begin{bmatrix}
r_1 \\ r_2 \\ r_3
\end{bmatrix} 
$
I use the least square approximations to find the solution to this equation on MATLAB. However, no effective solution was found using this method. Considering that the system values for r1, r2, r3 and $\psi$ = 0 are known whereas $\theta$ and $\phi$ are the two unknown values. Is it possible to obtain exact solution for these two unknowns of the system for $r = [0,-0.101233861621737,0.365119069777688]$.
The values I obtain on solving this system is $\theta = 0.6950 $ and $\phi =  -0.1785$, Even-though these are good approximate values, I was wondering if it's possible to obtain the exact values using a different approach.
 A: Maybe I'm missing something, but if you substitute $\psi = 0$ in the system, and denote $x = \tan(\theta/2), y = \tan(\phi/2)$, you get the system
$$
\begin{cases}
-xy = r_1 \\ y = r_2\\ x= r_3
\end{cases}.
$$
So, either $r_1 = -r_2 r_3$ and the solution is $(x,y)=(r_3, r_2)$ or you have no solution at all.
A: Assume $r_1 = 0, r_2, r_3 \ne 0$. Let $t_1 \tan\frac{\psi}{2}$, $t_2 = \tan\frac{\phi}{2}$
and $t_3 = \tan\frac{\theta}{2}$.
With help of a CAS, I get two set of solutions:
$$t_2 = \frac{s_2 - \epsilon \sqrt{s_2^2 - 4r_2^2}}{2r_2},\quad t_3 = \frac{s_3 + \epsilon \sqrt{s_3^2 + 4r_3^2}}{2r_3}\tag{*1}$$
where $\epsilon = \pm 1$ and $s_2 = r_2^2+r_3^2+1$, $s_3 = r_2^2+r_3^2-1$.
For $(r_1,r_2,r_3) = (0,−0.101233861621737,0.365119069777688)$, the approximation solution you get corresponds to the $\epsilon = +1$ solution. Numerically, the corresponding angles evaluated to
$$(\psi, \phi, \theta ) \sim
(-0.0657294323,-0.1779886273,0.7060269791)$$
The formula in $(*1)$ is relatively simple, it should be possible to derive that by hand. However, I can't figure that out yet. You can plug those expression to a CAS and verify that yourself.
Update
I sort of figure out how to derive the two solutions in $(*1)$.
When $r_1 = 0$, first equation give us $t_1 = t_2t_3$. Substitute this into second and third equation, we have
$$\frac{t_2(1+t_3^2)}{1 + t_2^2t_3^2} = r_2\quad\text{ and }\quad
\frac{t_3(1-t_2^2)}{1 + t_2^2t_3^2} = r_3\tag{*2}$$
By brute force, we have
$$s_2 = r_2^2 + r_3^2 + 1 = \frac{(1+t_2^2)(1+t_3^2)}{1+t_2^2t_3^2}
\implies r_2(1+t_2^2) - s_2t_2 = 0
$$
Similarly,
$$s_3 = r_2^2 + r_3^2 - 1 = -\frac{(1-t_2^2)(1-t_3^2)}{
1 + t_2^2t_3^2}
\implies r_3(t_3^2-1) - s_3t_3 = 0$$
Solving these two quadratic equations give us $4$ possible
combinations of $(t_2,t_3)$. Throwing them into an CAS, one
find only two of them, those appear in $(*1)$, satisfy $(*2)$.
