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?


Another slightly more complicated approach would be to use a system of trigonometric equations. Let $a$ be the angle at the elbow from the x-axis to the hand, $b$ the angle at the shoulder from the x-axis to the elbow, $x$ the abscissa of the hand, $y$ the ordinate of the hand. Given $4$ is the length of an arm segment, we have these equations:
$$
4 \cos a + 4 \cos b = x \\
4 \sin a + 4 \sin b = y \\
$$
If we solve $a$, we have this equation where we use the positive $\arccos$ because the arm is assumed to bend upward at the elbow:
$$
P = \frac{x^2 + y^2 - 32}{32} \\
a = b + \arccos P \\
$$
If we solve $b$, we have this equation where we use the negative $\arccos$ because the arm is assumed to bend downard at the shoulder:
$$
Q = \sqrt{2(P + 1)} \\
b = \arccos \frac{\sqrt{1 - P^2}}{Q} - \arccos \frac{y}{4Q} \\
$$
If we plug these equations into SageMath with $x = 6$ and $y = -2$, we get the same angles as before:
sage: var('x', 'y')
sage: P = (x^2 + y^2 - 32)/32
sage: Q = sqrt(2*(P + 1))
sage: b = arccos(sqrt(1 - P^2)/Q) - arccos(y/(4*Q))
sage: a = b + arccos(P)
sage: n(b.subs(x=6,y=-2))
-0.980808590223051
sage: n((pi + b - a).subs(x=6,y=-2))
1.82347658193698

