Lab

One target, two arm poses

Tell a two-link arm to reach a point and it will usually have two ways to put its elbow. Put the target at the edge of reach and the two solutions become one.

Move the target

Switch the elbow branch while the target stays still. The outline shows the other valid pose. Now move the target outward until the links straighten. Beyond that circle the display marks the requested point and shows where the arm can actually reach.

Two-link inverse kinematics
Drag the target or use the arrow keys. The shaded area is reachable.

The plot uses a planar mechanism with links of length L1=1.44L_1=1.44 and L2=1.03L_2=1.03 in model units. The outer radius is L1+L2L_1+L_2. The inner radius is |L1−L2||L_1-L_2|. Switch to Orbit to inspect the same solution in three dimensions. The model lives in a horizontal plane and rotates about vertical joint axes.

Derive both solutions

At the base, q1q_1 measures the first link from the positive xx direction. At the elbow, q2q_2 measures the second link from the first. The law of cosines connects the target (x,y)(x,y) to the relative joint angle.

cosq2=x2+y2−L12−L222L1L2. \cos q_2 = \frac{x^2+y^2-L_1^2-L_2^2}{2L_1L_2}.

A cosine generally gives two angles with opposite signs. Choose a sign, then rotate the whole arm by q1q_1 to point the resulting triangle toward the target.

q1=atan2(y,x)−atan2(L2sinq2,L1+L2cosq2). q_1 = \operatorname{atan2}(y,x) - \operatorname{atan2}(L_2\sin q_2, L_1 + L_2\cos q_2).

The branches meet when the links straighten or fold completely. At either boundary sinq2=0\sin q_2=0, so the determinant of the planar position Jacobian, L1L2sinq2L_1L_2\sin q_2, is zero. At that instant, small joint motions can produce tip velocity along only one direction. The arm is at a kinematic singularity.

Lynch and Park’s chapter on inverse kinematics puts this analytical solution in the broader context of solving for end-effector configurations.

Reproduce the result

Save arm_ik.py and run the command below. It reports both branches and checks each one with forward kinematics. Try 2.47 0 for the straight arm and 2.60 0 for an unreachable target.

bash
python3 arm_ik.py 1.52 1.03

Here is the core calculation. The tolerance protects against floating-point roundoff at the workspace boundary.

python
from math import acos, atan2, cos, sin

def solve(x, y, l1, l2, branch):
    c2 = (x*x + y*y - l1*l1 - l2*l2) / (2*l1*l2)
    if abs(c2) > 1 + 1e-12:
        return None
    q2 = branch * acos(max(-1.0, min(1.0, c2)))
    q1 = atan2(y, x) - atan2(l2*sin(q2), l1 + l2*cos(q2))
    return q1, q2

A real arm also has joint limits, geometry that can collide, and a controller that can only move so fast. Those constraints influence which solution is usable as a target moves from point to point.

References and code

Cite this article

Aadi Mishra. One target, two arm poses. 26 November 2026. https://aadimishra.com/writing/one-target-two-arm-poses/index.html

@misc{mishra2026onetargettwoarmposes,
  author = {Mishra, Aadi},
  title = {{One target, two arm poses}},
  year = {2026},
  month = {November},
  day = {26},
  url = {https://aadimishra.com/writing/one-target-two-arm-poses/index.html},
  note = {Technical article on Aadi Mishra's website}
}
Download .bib