Trig : With point $(X,Y)$ and a end point $(x_2,y_2)$, work out the 2 angles So imagine your arm, you have a shoulder point be $X,Y (0,0)$ you have a angles off this, then you have a elbow point $(x_1,y_1)$ and another angles which ends at your hand.
If you know the arm length (4 and 4), you know your starting point $(0,0)$ and you want to get the hand to say $(6,2)$ is there some maths to work out what the angles at the elbow and shoulder should be?


Draw a line from the origin to the hand, called the distance line, then you have (based on your image, I assumed $y = -2$):
$$
\begin{eqnarray}
l &=& 4 & \textrm{length of an arm segment} \\
d &=& \sqrt{x^2 + y^2} = 2\sqrt{10} & \textrm{distance from the origin to the hand} \\
\tan \theta_1 &=& \frac{y}{x} = -\frac{1}{3} & \textrm{angle between x-axis and distance line} \\
\cos \theta_2 &=& \frac{d/2}{l} = \frac{\sqrt{10}}{4} & \textrm{angle between distance line and arm} \\
\end{eqnarray}
$$
Express $\cos \theta_2$ in terms of $\tan$ and then apply the tangent sum identity to get the angle at the shoulder:
$$
\begin{eqnarray}
\tan \theta_2 &=& \frac{-\sqrt{1 - \cos^2 \theta_2}}{\cos \theta_2} &=& -\frac{\sqrt{15}}{5} & \textrm{negative in fourth quadrant} \\
\tan (\theta_1 + \theta_2) &=& \frac{\tan \theta_1 + \tan \theta_2}{1 - \tan \theta_1 \tan \theta_2} &=& -\frac{12 + 5\sqrt{15}}{21} & \textrm{tangent sum identity} \\
\theta_1 + \theta_2 &=& \arctan -\frac{12 + 5\sqrt{15}}{21} &\approx& -0.98 \, \textrm{rad}
\end{eqnarray}
$$
Apply the double angle formula to get the angles with the distance line at the shoulder and hand, then remains the angle at the elbow:
$$
\begin{eqnarray}
\cos 2\theta_2 &=& 2 \cos^2 \theta_2 - 1 &=& \frac{1}{4} & \textrm{double angle formula} \\
\theta_3 &=& \pi - \arccos \frac{1}{4} &\approx& 1.82 \, \textrm{rad} \\
\end{eqnarray}
$$
