Inverse kinematics, step by step

Teacher PD. One table, run top to bottom, from a target point to the number you type into the arm. Do these yourself before you teach Week 3; that is the whole point of the session.

This arm, these numbers. L₁ = 18 cm, L₂ = 22 cm. Practical reach 8 to 40 cm. Shoulder travel 20° to 150°. Every solve in this unit is elbow-up, at both endpoints, which is why θ₁ = α + β throughout and never α − β.

The pipeline

Three gates, shaded, and you stop at any one that fails. The last row is the one most sheets stop short of: the elbow field on the arm is offset from the angle you solved, so θ₂′ = 144.4° is typed as -54.4° at the end point. Type the raw 144.4 instead and the tip lands 43.4 cm from the target, which is further than the arm is long.

L₁ L₂ r = 28.43 α β θ₂′ (18, 22)
α aims at the target. β lifts link 1 above that line. θ₁ = α + β. At the elbow, θ₂′ is the turn away from straight.
Worked: the motion's start point (18, 22)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across18
ytarget up22
rr = √(x² + y²)28.43 cm
Step 0 · reach checkis 8 ≤ r ≤ 40?yes
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)0.000
in range?is −1 ≤ cos θ₂′ ≤ 1?yes
θ₂′ (elbow)arccos(cos θ₂′)90.0°
αarctan(y ÷ x)50.7°
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)0.633
βarccos(cos β)50.7°
θ₁ (shoulder, elbow-up)α + β101.4°
shoulder checkis 20° ≤ θ₁ ≤ 150°?yes
elbow FIELD value−θ₂′ + 900.0°

This is the canonical start point used all through Week 3, and it is worth knowing why it is convenient: r² = 18² + 22² = 808, which is exactly L₁² + L₂² = 324 + 484. That makes cos θ₂′ = 0 and θ₂′ exactly 90°, so the two links meet at a right angle.

Now the other end of the same motion

L₁ L₂ r = 12.81 α β θ₂′ (10, 8)
Same three angles, a target closer in. A bigger θ₂′ folds the arm and pulls the tip nearer the base.
Worked: the motion's end point (10, 8)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across10
ytarget up8
rr = √(x² + y²)12.81 cm
Step 0 · reach checkis 8 ≤ r ≤ 40?yes
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)-0.813
in range?is −1 ≤ cos θ₂′ ≤ 1?yes
θ₂′ (elbow)arccos(cos θ₂′)144.4°
αarctan(y ÷ x)38.7°
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)0.009
βarccos(cos β)89.5°
θ₁ (shoulder, elbow-up)α + β128.2°
shoulder checkis 20° ≤ θ₁ ≤ 150°?yes
elbow FIELD value−θ₂′ + 90-54.4°
start (18, 22) end (10, 8) θ₁ 101.4° → 128.2° θ₂′ 90.0° → 144.4°
The whole motion. Elbow-up at both ends, so the arm never flips shape mid-move.
The sweep. θ₁ goes 101.4° → 128.2° and θ₂′ goes 90.0° → 144.4°, elbow-up at both ends, then reverse. Both endpoints solved, one shape held: that is the Day 16 gate.

Your turn — four targets

Blank tables, same order. Answers overleaf. Work them by hand with the calculator in DEG.

1. Target (30, 10)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90
2. Target (20, 26)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90
3. Target (6, 30)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90
4. Target (34, 14)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90

Three that do not run

startend too closetoo farshoulder r = 40 r = 8
The shaded ring is every point the arm can reach: 8 to 40 cm. Red points sit outside it. The orange point is inside the ring and still impossible, which is why the shoulder check exists.

Each fails at a different gate, and only one of them fails in a way the algebra alone will catch. Say which gate stops each, and what you would tell the student.

A. Target (5, 4)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90
B. Target (30, 30)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90
C. Target (3, 14)
StepEquationValue
L₁given18 cm
L₂given22 cm
xtarget across
ytarget up
rr = √(x² + y²)
Step 0 · reach checkis 8 ≤ r ≤ 40?
cos θ₂′(r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
in range?is −1 ≤ cos θ₂′ ≤ 1?
θ₂′ (elbow)arccos(cos θ₂′)
αarctan(y ÷ x)
cos β(L₁² + r² − L₂²) ÷ (2 · L₁ · r)
βarccos(cos β)
θ₁ (shoulder, elbow-up)α + β
shoulder checkis 20° ≤ θ₁ ≤ 150°?
elbow FIELD value−θ₂′ + 90

Answer key

Targetrcos θ₂′θ₂′αβθ₁FieldVerdict
(18, 22)28.430.00090.0°50.7°50.7°101.4°0.0°Runs as solved.
(10, 8)12.81-0.813144.4°38.7°89.5°128.2°-54.4°Runs as solved.
(30, 10)31.620.24276.0°18.4°42.5°60.9°14.0°Runs as solved.
(20, 26)32.800.33870.2°52.4°39.1°91.6°19.8°Runs as solved.
(6, 30)30.590.16280.7°78.7°45.2°123.9°9.3°Runs as solved.
(34, 14)36.770.68746.6°22.4°25.8°48.2°43.4°Runs as solved.
(5, 4)6.40-0.968165.6°38.7°121.1°159.7°-75.6°The math solves, but r = 6.40 cm is inside the 8 cm floor. The elbow only closes to 160°, so the arm cannot fold this tight. Move the point.
(30, 30)42.431.253no solution — cos θ₂′ outside −1…1Unreachable. r = 42.43 cm is past the 40 cm the arm can reach, and cos θ₂′ = 1.253 is outside −1…1, so no angle exists.
(3, 14)14.32-0.761139.6°77.9°85.0°162.9°-49.6°Reachable, but θ₁ = 162.9° is outside the shoulder's 20°–150°. Correct mathematics the arm cannot hold. Move the point or re-aim the base.

What each failure teaches

Four things to hold constant

The links are 18 and 22, always. Every solve is elbow-up, so θ₁ = α + β and never α − β, which is what keeps one shape across the motion. The reach floor is 8 cm, from the elbow stop, not the geometric 4 cm. And β comes from the Law of Cosines, cos β = (L₁² + r² − L₂²) ÷ (2 · L₁ · r), which returns a positive magnitude and so has no sign to get wrong.