How can simultaneous sinusoidal equations be solved? I have come across a set of simultaneous equations which I can't figure out how to solve. I have 3 equations and only two unknowns, but they are angular quantities and feature in the equations as sinusoidal functions of the angular quantities.
The system of equations is:
$$ \begin{Bmatrix}\cos\psi\sin\theta+\cos\theta\sin\phi\sin\psi \\ \sin\psi\sin\theta-\cos\psi\cos\theta\sin\phi \\ \cos\phi\cos\theta \end{Bmatrix} = \begin{Bmatrix} x \\ y \\ z \end{Bmatrix} $$
Where: x, y, z and psi are known and phi and theta are unknown.
Is it possible to rearrange these equations to solve for theta and phi using the other terms?
 A: The system is not always solvable. The two first equations factor as
$$\tag{1} \begin{pmatrix} \cos\psi & \sin\psi \\ \sin\psi & -\cos\psi \end{pmatrix}
\begin{pmatrix} \sin\theta \\ \cos\theta \sin\phi \end{pmatrix}
= \begin{pmatrix} x \\ y \end{pmatrix} $$
where the first factor is just a reflection in a line through the origin, so
$$ \sin^2\theta + \cos^2\theta\sin^2\phi = x^2 + y^2 $$
Squaring the third equation gives
$$ \cos^2\theta \cos^2\phi = z^2 $$
and adding these equations give
$$ x^2+y^2+z^2 = \sin^2\theta + \cos^2\theta(\sin^2\phi + \cos^2\phi) = 1 $$
so your system only has a solution when $(x,y,z)$ is a point on the unit sphere.
If your constants satisfy this, a natural approach would be to divide out the reflection matrix in $(1)$, producing
$$ \begin{cases} \sin \theta = x' \\ \cos\theta\sin\phi = y' \\ \cos\theta \cos\phi = z \end{cases} $$
for some $x'$ and $y'$. From here you get $\theta = \arcsin x'$ and and $\phi = \arctan \frac{y'}{z}$, both up to a choice of quadrants that have to be made in a matching way, possibly just by trial and error.
A: Note that
$$
\begin{array}{l}
 \left( {\begin{array}{*{20}c}
   x  \\
   y  \\
   z  \\
\end{array}} \right) = \left( {\begin{array}{*{20}c}
   {\cos \psi \sin \theta  + \cos \theta \sin \phi \sin \psi }  \\
   {\sin \psi \sin \theta  - \cos \psi \cos \theta \sin \phi }  \\
   {\cos \phi \cos \theta }  \\
\end{array}} \right) =  \\ 
  = \left( {\begin{array}{*{20}c}
   {\sin \theta \cos \psi  + \cos \theta \sin \phi \sin \psi }  \\
   {\sin \theta \sin \psi  - \cos \theta \sin \phi \cos \psi }  \\
   {\cos \theta \cos \phi }  \\
\end{array}} \right) =  \\ 
  = \sin \theta \left( {\begin{array}{*{20}c}
   {\cos \psi }  \\
   {\sin \psi }  \\
   0  \\
\end{array}} \right) + \cos \theta \left( {\begin{array}{*{20}c}
   {\sin \phi \sin \psi }  \\
   { - \sin \phi \cos \psi }  \\
   {\cos \phi }  \\
\end{array}} \right) =  \\ 
  = \sin \theta \left( {\begin{array}{*{20}c}
   {\cos \psi }  \\
   {\sin \psi }  \\
   0  \\
\end{array}} \right) + \cos \theta \left( {\begin{array}{*{20}c}
   {\sin \phi \cos \left( {\psi  + \pi /2} \right)}  \\
   {\sin \phi \sin \left( {\psi  + \pi /2} \right)}  \\
   {\cos \phi }  \\
\end{array}} \right) =  \\ 
  = \sin \theta \;{\bf u} + \cos \theta \;{\bf v} \\ 
 \end{array}
$$
where $\bf u$ and $\bf v$ are  given in spherical coordinates, and can be seen to be
unitary vectors and orthogonal to each other.
Their combination with $sin \theta$ and $cos \theta$ is therefore a circle in their plane.
For the system to have solutions, the vector $\bf p=(x,y,z)$ shall be on the unitary sphere.
That given, there will be multiple solutions for the three angles, corresponding to the 
infinite main circles passing through $\bf p$.
