Inverse Kinematics Formula
Calculate joint angles from a desired end-effector position using inverse kinematics.
Essential for robot arm control.
The Formula (2-Link Planar Robot Arm)
theta₁ = arctan(y / x) - arctan((L₂ sin(theta₂)) / (L₁ + L₂ cos(theta₂)))
Inverse kinematics (IK) determines the joint angles needed to place a robot's end-effector (hand or tool) at a desired position. While forward kinematics goes from angles to position, inverse kinematics works backward from position to angles.
The 2-link planar arm is the simplest and most commonly taught case. Real industrial robots use the same principles extended to 6 or more joints in 3D space.
Variables
| Symbol | Meaning | Unit |
|---|---|---|
| theta₁ | Angle of the first joint (shoulder) | radians or degrees |
| theta₂ | Angle of the second joint (elbow) | radians or degrees |
| L₁ | Length of the first link (upper arm) | m or cm |
| L₂ | Length of the second link (forearm) | m or cm |
| x | Target x-coordinate of end-effector | m or cm |
| y | Target y-coordinate of end-effector | m or cm |
Reachability Check
|L₁ - L₂| ≤ sqrt(x² + y²) ≤ L₁ + L₂
If the target distance is greater than L₁ + L₂, the arm cannot reach it. If the distance is less than |L₁ - L₂|, the target is too close.
Example 1 — Simple 2-Link Arm
A robot arm has L₁ = 30 cm and L₂ = 20 cm. Find the joint angles to reach the point (40, 15) cm.
Step 1: Check reachability. Distance = sqrt(40² + 15²) = sqrt(1600 + 225) = sqrt(1825) = 42.72 cm
Range: |30 - 20| = 10 cm to 30 + 20 = 50 cm. 42.72 is within range.
Step 2: cos(theta₂) = (40² + 15² - 30² - 20²) / (2 x 30 x 20)
cos(theta₂) = (1600 + 225 - 900 - 400) / 1200 = 525 / 1200 = 0.4375
theta₂ = arccos(0.4375) = 64.06 degrees
Step 3: theta₁ = arctan(15/40) - arctan((20 x sin(64.06)) / (30 + 20 x cos(64.06)))
theta₁ = 20.56 - arctan(17.99 / 38.75) = 20.56 - 24.90 = -4.34 degrees
theta₁ = -4.34 degrees, theta₂ = 64.06 degrees
Example 2 — Fully Extended Arm
The same arm (L₁ = 30 cm, L₂ = 20 cm) reaches for a point at (50, 0) cm, which is exactly at maximum reach.
Distance = sqrt(50² + 0²) = 50 cm = L₁ + L₂ (maximum reach)
cos(theta₂) = (2500 - 900 - 400) / 1200 = 1200 / 1200 = 1
theta₂ = arccos(1) = 0 degrees (arm is fully straight)
theta₁ = arctan(0/50) - arctan(0 / 50) = 0 - 0
theta₁ = 0 degrees, theta₂ = 0 degrees (arm points straight along x-axis)
When to Use It
Use inverse kinematics when:
- Programming a robotic arm to pick up objects at known positions
- Animating character limbs in video games and 3D graphics
- Controlling CNC machines and 3D printers with articulated arms
- Designing prosthetic limbs and exoskeletons
- Planning motions for autonomous drones with robotic manipulators