How do I solve two equations for two unknown angles? I need to solve these two equations for two unknown angles for a robot arm I am trying to program.


*

*$\sin\theta_{1} + \sin\theta_{2} = c_{1}$

*$\cos\theta_1  + \cos\theta_{2} = c_{2}$


I multiplied equation 1 with $\cos \theta_{1}$, and equation 2 with $\sin \theta _{1}$, and subtracted both equations and used a trig rule to arrive at this but I am stuck. How do I go further to solve one of the variables? 
$\sin({\theta_{2}-\theta_{1}}) = c_{1}\cos{\theta_{1}} - c_{2}\sin{\theta_{1}} $
Alternatively for sum to product I get


*

*$2\sin({(\theta_{1}+\theta_{2})/2})\cos({(\theta_{1}-\theta_{2})/2}) = c_{1}$

*$2\cos({(\theta_{1}+\theta_{2})/2})\cos({(\theta_{1}-\theta_{2})/2}) = c_{2}$


Adding them up, simplifying, squaring gives me
$\cos^2 (\theta_{1}-\theta_{2})/2) = (c_{1}/2)^2 + (c_{2}/2)^2$
How can I go further this route to solve for the angles?

$\def\t#1{\theta_{#1}}$
\begin{align} \sin\t1+\sin\t2&=c_1  \tag{1}\label{1} \\
 \cos\t1+\cos\t2&=c_2 \tag{2}\label{2} 
\\ \sin(\t2-\t1)  &= c_1\cos\t1
 - c_2\sin\t1 \tag{3}\label{3} 
\end{align}
The sum of squares of \eqref{2} and \eqref{1} 
gives
\begin{align}
\cos^2\t1&+2\,\cos\t1\cos\t2+\cos^2\t2
+
\sin^2\t1+2\,\sin\t1\sin\t2+\sin^2\t2
=
c_1^2+c_2^2,
\\
\cos\t1\cos\t2&+\sin\t1\sin\t2
= 
\cos(\t2-\t1)
=\tfrac12(c_1^2+c_2^2)-1
.
\end{align}  
hence
\begin{align}
\sin(\t2-\t1)&=\sqrt{1-
\left( 
\tfrac12(c_1^2+c_2^2)-1
\right)^2}
\end{align}  
Next, $\eqref{1}\times \sin\t1+\eqref{2}\times \cos\t1$
results in
\begin{align} 
1+\cos(\t2-\t1)
&=
c_1\,\sin\t1+c_2\,\cos\t1
\tag{4}\label{4}
\end{align}  
Equations \eqref{4} and \eqref{3}
present a $2\times2$ linear system
\begin{align} 
\begin{bmatrix}
\phantom{-}c_1&c_2\\ -c_2&c_1
\end{bmatrix}
\begin{bmatrix}
 \sin\t1\\ \cos\t1
\end{bmatrix}
&=
\begin{bmatrix}
\tfrac12(c_1^2+c_2^2)
\\
\sqrt{1-
 \left( 
 \tfrac12(c_1^2+c_2^2)-1
 \right)^2}
\end{bmatrix}
.
\tag{5}\label{5}
\end{align}  
Unless $c_1,c_2$ are both zero (hence $\t2 = \t1-\pi$),
solution to \eqref{5}
provides us with $\sin\t1$ and $\cos\t1$
(check that $\sin^2\t1 + \cos^2\t1\equiv1$).
Together with \eqref{1} and  \eqref{2}
we can get the $\sin$ and $\cos$ of the other angle.
Also, hence the system is symmetric,
the solution is either $\{\t1,\t2\}$ or $\{\t2,\t1\}$.
