r = √(x² + y²) the straight-line distance from the base to the target.
Gate 1 · Step 0 reach check. Is 8 ≤ r ≤ 40? If not, stop and move the point. 40 is the arm straight out (18 + 22). 8 is the elbow stop, not the geometric 4.
2
cos θ₂′ = (r² − L₁² − L₂²) ÷ (2 · L₁ · L₂)
Gate 2 · is cos θ₂′ between −1 and 1? Outside that, no angle has it and arccos is undefined. A negative cosine inside the range is perfectly fine — it just means an obtuse elbow.
Gate 3 · is 20° ≤ θ₁ ≤ 150°? Outside that it is correct mathematics the shoulder cannot hold.
7
Driving the arm. Easiest is GO: type the target (x, y) and the app solves it and handles the offset. Typing angles by hand? The elbow field is offset: field = −θ₂′ + 90.
Worked — the unit's own motion
start (18, 22)
end (10, 8)
r
28.43
12.81
cos θ₂′
0.000
-0.813
θ₂′
90.0°
144.4°
α
50.7°
38.7°
β
50.7°
89.5°
θ₁
101.4°
128.2°
elbow field
0.0°
-54.4°
The start is convenient on purpose: r² = 808 = L₁² + L₂², so cos θ₂′ = 0 and the links meet at a right angle.
Three ways a target fails
Too far. (30, 30), r = 42.43. cos θ₂′ = 1.253, outside −1…1. The calculator error is the answer.
Too close. (5, 4), r = 6.40. The algebra answers, because 6.40 clears the geometric 4 cm. The arm still cannot fold that tight. This is why the floor is 8.
Shoulder cannot hold it. (3, 14) is in reach, but θ₁ = 162.9° is past 150°. Nothing on paper looks wrong.
Before you call it solved
Did I check r at both endpoints before any trig?
Is each cos θ₂′ inside −1 to 1, and did I read a negative one as obtuse rather than impossible?
Did I use elbow-up at both ends, so θ₁ = α + β each time?
Is each θ₁ inside 20° to 150°?
Calculator in DEG? sin⁻¹(0.5) should give 30, not 0.5236.
If I typed angles rather than pressing GO, did I offset the elbow by −θ₂′ + 90?
Did I write my path plan — how each joint sweeps start to end and back?