Inverse Kinematics Calculator — 2-Link Planar Manipulator
Solve the classic 2-link inverse kinematics relation θ₂ = acos( (x² + y² − L₁² − L₂²) / (2·L₁·L₂) ) for joint angles, target position, or link length — with a live arm visualization, workspace analysis, both elbow configurations, and companion manipulability metrics.
It is the law of cosines in disguise
The formula for θ₂ comes directly from the law of cosines applied to the triangle formed by the two links and the line from base to target. The three sides are L₁, L₂ and r = √(x² + y²). Solving for the angle opposite the r side gives cos θ₂ = (r² − L₁² − L₂²)/(2 L₁ L₂) — exactly the argument of the arccos. This is why the formula is exact, requires no iteration, and can be evaluated in closed form in microseconds on any microcontroller.
Two configurations, one target
For any reachable target there are exactly two distinct joint configurations that place the end-effector at the same point: the "elbow-down" (θ₂ > 0) and "elbow-up" (θ₂ < 0) solutions, which are mirror images across the line from base to target. Both are valid IK solutions; the choice between them depends on obstacles, joint limits, and desired manipulability.
Reachability is a hard geometric bound
The target must lie within the annular workspace bounded by the circles of radius |L₁ − L₂| (inner) and L₁ + L₂ (outer). If r exceeds L₁ + L₂, the target is simply too far. If r is less than |L₁ − L₂|, the target lies inside the inner void — the arm cannot reach into its own "elbow circle". The argument of the arccos being outside [−1, +1] is exactly the algebraic signature of these two geometric failures.
Manipulability quantifies conditioning
The Jacobian determinant of the 2-link arm is w = |L₁ L₂ sin θ₂|, called the manipulability measure. It is zero at the two singular configurations θ₂ = 0 (fully extended) and θ₂ = ±180° (fully folded), where the arm loses the ability to move the tip in certain directions. The maximum manipulability is at θ₂ = ±90°, where the arm is "square" and can move the tip freely in every direction.
How to Use This Calculator
The 2-link IK relation links six quantities: L₁, L₂, x, y, θ₁, and θ₂. Pick which one you want the tool to solve, then fill in the others.
1. Choose what to solve for
Pick θ₂ (elbow angle, the classic IK), θ₁ (shoulder angle), x or y (forward kinematics from the angles). When solving for θ₂, the tool also computes θ₁ as a companion; when solving for x or y, the other coordinate is computed too.
2. Start from a manipulator preset
Presets cover the practical range: small educational arms, SCARA-style arms, human-arm proportions, industrial manipulators, and singular cases like the fully-extended reach limit and the inner-void boundary.
3. Watch for reachability
If your target lies outside the annulus |L₁ − L₂| ≤ r ≤ L₁ + L₂, the IK has no solution and the argument of the arccos will fall outside [−1, +1]. The calculator clips the value to ±1 for display and flags the target as unreachable.
4. Pick the right elbow configuration
The sign of θ₂ selects between two mirror-image solutions: positive is "elbow-down", negative is "elbow-up". The companion panel lists both solutions with their θ₁ and manipulability so you can pick the better one.
5. Read the result and verdict
The result card shows the solved value with the companion metrics — reach r, the other joint angle, manipulability w. A colour-coded verdict classifies the configuration from near-singular through well-conditioned.
6. Switch to Advanced for depth
Advanced mode adds charts of θ₁ vs. reach and manipulability vs. θ₂, a sensitivity panel, and a companion metrics panel including both IK solutions, both FK verifications, and reach ratios.
What This Tool Offers
Built around the classic 2-link inverse kinematics relation θ₂ = acos((x²+y²−L₁²−L₂²)/(2L₁L₂)), the closed-form solution at the heart of every planar robot arm.
Four-way solving
Solve for elbow angle, shoulder angle, or either coordinate of the target. Switch between IK and FK modes freely.
Live workspace and arm
A to-scale diagram showing the annular workspace, both elbow configurations (primary + ghost), the reach line, angle arcs, and the target crosshair — all updated live.
Reachability verdict
Each result is classified by proximity to singular configurations — fully extended, fully folded, or well-conditioned — with a colour-coded warning.
Both IK solutions
Every IK computation reports both the elbow-down and elbow-up solutions with their respective shoulder angles, so you can choose the better configuration.
Manipulability metric
The Jacobian determinant w = |L₁ L₂ sin θ₂| is reported and plotted, showing how well-conditioned the arm is and where the singularities lie.
Reference tables
Typical robot arm parameters, IK formula summary, and a full variable reference with unit conversion notes.
Reference Tables & Conversions
An angle converter, a link length converter, and typical 2-link manipulator parameters.
Angle & length converter
IK Solutions for the Current Configuration
Both valid IK solutions for the current target (if reachable). Values in degrees.
| Configuration | θ₁ (shoulder) | θ₂ (elbow) | Manipulability | Notes |
|---|---|---|---|---|
| Click Calculate to populate both IK solutions | ||||
Typical 2-Link Manipulator Parameters
Representative values. Real robots also include joint limits, link offsets, and base transforms.
| Platform | L₁ (m) | L₂ (m) | Max reach (m) | Inner void (m) | Typical use |
|---|---|---|---|---|---|
| Educational mini-arm | 0.10 | 0.10 | 0.20 | 0.00 | Classroom, hobby robotics |
| SCARA-style | 0.30 | 0.25 | 0.55 | 0.05 | Assembly, pick-and-place |
| Human arm (upper+fore) | 0.30 | 0.27 | 0.57 | 0.03 | Ergonomic modelling |
| Dobot Magician | 0.20 | 0.20 | 0.40 | 0.00 | Desktop robotics, education |
| UR3e | 0.24 | 0.24 | 0.50 | 0.00 | Collaborative, tabletop |
| UR5e (2-link slice) | 0.42 | 0.39 | 0.85 | 0.03 | Industrial collaborative |
| KUKA KR6 (2-link slice) | 0.60 | 0.55 | 1.15 | 0.05 | Industrial 6-axis arm |
| Large gantry arm | 1.50 | 1.20 | 2.70 | 0.30 | Palletising, welding |
Variable Reference
| Symbol | Meaning | Typical range | Units |
|---|---|---|---|
| L₁ | First link (proximal) length | 0.05 – 3 | m |
| L₂ | Second link (distal) length | 0.05 – 3 | m |
| x, y | Target coordinates of the end-effector | −(L₁+L₂) – +(L₁+L₂) | m |
| r | Distance from base to target = √(x²+y²) | |L₁−L₂| – L₁+L₂ | m |
| φ | Direction to target = atan2(y, x) | −180 – +180 | deg |
| θ₁ | Shoulder angle (link 1 from +x) | −180 – +180 | deg |
| θ₂ | Elbow angle (link 2 relative to link 1) | −180 – +180 | deg |
| w | Manipulability = |L₁ L₂ sin θ₂| | 0 – L₁·L₂ | m² |
What Does the 2-Link Inverse Kinematics Relation Measure?
Inverse kinematics answers the question: given a desired position for the robot's end-effector, what joint angles place it there? For a planar 2-link arm the answer is a pair of angles (θ₁, θ₂) that can be computed in closed form from the target position (x, y) and the link lengths (L₁, L₂). This is the simplest nontrivial IK problem, and it serves as the foundation for every real robot's kinematic solver — because even a 6-axis industrial arm is usually decomposed into a 3-link position chain (solved by a variant of the 2-link formula) and a 3-link orientation chain (solved by a separate set of geometric relations).
The formula for θ₂ comes from the law of cosines. Consider the triangle formed by the two links and the virtual line of length r = √(x² + y²) drawn from base to target. The three sides of this triangle are L₁, L₂, and r, and the angle opposite r is π − θ₂ (or θ₂ itself, depending on the internal-vs-external convention). Applying the law of cosines gives cos θ₂ = (r² − L₁² − L₂²)/(2 L₁ L₂) — exactly the argument of the arccos in the formula.
Inverse Kinematics Formula
The defining relation for the elbow angle is:
Once θ₂ is known, the shoulder angle follows from:
And the forward kinematic check verifies the solution:
y = L₁ sin θ₁ + L₂ sin(θ₁ + θ₂)
Companion geometric quantities:
Direction to target: φ = atan2( y, x )
Maximum reach: rmax = L₁ + L₂
Minimum reach: rmin = | L₁ − L₂ |
Reachability: rmin ≤ r ≤ rmax
Manipulability: w = | L₁ L₂ sin θ₂ |
Inverse Kinematics Variables
| Symbol | Meaning | Notes |
|---|---|---|
| L₁ | First link length | Proximal (base-to-elbow) link |
| L₂ | Second link length | Distal (elbow-to-tip) link |
| x, y | Target coordinates | Position of the end-effector relative to the base |
| r | Reach | Distance from base to target = √(x²+y²) |
| φ | Bearing | Direction from base to target = atan2(y, x) |
| θ₁ | Shoulder angle | Absolute orientation of link 1 |
| θ₂ | Elbow angle | Relative orientation of link 2 with respect to link 1 |
| w | Manipulability | Jacobian determinant; equals zero at singularities |
How Each Variable Affects the Solution
The elbow angle θ₂ depends only on the reach r and the two link lengths. As r increases from rmin to rmax, θ₂ decreases monotonically from 180° (arm fully folded) to 0° (arm fully extended). At the two endpoints of this range the arm is at a singularity — the Jacobian determinant vanishes and the inverse kinematics loses rank. In the middle, at rmid = √(L₁² + L₂²), the elbow angle passes through 90°, which is generally the best-conditioned configuration.
The shoulder angle θ₁ combines the bearing φ with a correction ψ = atan2(L₂ sin θ₂, L₁ + L₂ cos θ₂) that accounts for how the elbow is bent. When θ₂ = 0 (fully extended), ψ = 0 and θ₁ = φ. When θ₂ = ±90°, ψ takes its maximum value. The two signs of θ₂ give the two mirror-image configurations.
Inverse Kinematics Calculation Examples
r² = 0.35² + 0.20² = 0.1625
L₁² + L₂² = 0.09 + 0.0625 = 0.1525
2 L₁ L₂ = 0.15
cos θ₂ = (0.1625 − 0.1525) / 0.15 = 0.06667
θ₂ = acos(0.06667) = 86.18° (elbow-down)
φ = atan2(0.20, 0.35) = 29.74°
ψ = atan2(0.25 sin 86.18°, 0.30 + 0.25 cos 86.18°) = 38.24°
θ₁ = 29.74° − 38.24° = −8.50°
ψ = atan2(−0.24944, 0.31667) = −38.24°
θ₁ = 29.74° − (−38.24°) = 67.98°
r = 0.55 = L₁ + L₂ → cos θ₂ = 1 → θ₂ = 0°
θ₁ = 0°
Manipulability w = |L₁ L₂ sin 0°| = 0 (singular)
x = 0.30 cos(−8.50°) + 0.25 cos(77.68°) = 0.2967 + 0.0533 = 0.350 ✓
y = 0.30 sin(−8.50°) + 0.25 sin(77.68°) = −0.0443 + 0.2443 = 0.200 ✓
r = 1.00, rmax = 0.55 → r > rmax
cos θ₂ = (1.00 − 0.1525) / 0.15 = 5.65 ≫ 1 → no solution
Frequently Asked Questions
Because the law of cosines gives cos θ₂ = (r² − L₁² − L₂²)/(2 L₁ L₂), and the arccos returns a value in [0, π]. But the equation cos θ₂ = c has two solutions in [−π, +π]: θ₂ = +acos(c) and θ₂ = −acos(c). Both give the same r, so both place the tip at the same distance from the base. Combined with the corresponding θ₁ values, they form two mirror-image configurations — the "elbow-down" and "elbow-up" solutions.
The manipulability w = |L₁ L₂ sin θ₂| is the magnitude of the Jacobian determinant of the arm's velocity mapping. A large determinant means small joint motions produce large, well-spread tip motions in all directions. When w = 0 (at θ₂ = 0 or ±180°), the Jacobian is singular: joint velocities of a certain direction produce zero tip velocity, and the inverse mapping from desired tip velocity to joint velocities blows up.
Compute the reach r = √(x² + y²) and compare it to the two critical distances: rmin = |L₁ − L₂| and rmax = L₁ + L₂. If r > rmax, the target is beyond the arm's maximum extension. If r < rmin, the target is inside the inner void. Only when rmin ≤ r ≤ rmax does a solution exist.
It depends on the task. Three common criteria: (1) Obstacle avoidance — pick the configuration that keeps the links away from obstacles. (2) Manipulability — pick the configuration with higher w = |L₁ L₂ sin θ₂|. (3) Joint limits — pick the configuration where both θ₁ and θ₂ are within the physical limits of the actuators.
Not directly, but it can be extended. For a 3-link planar arm the tip position has two equations (x, y) and three unknowns (θ₁, θ₂, θ₃), so the problem is underdetermined. Real solvers either fix one joint angle and solve the remaining 2-link problem, or use a redundancy-resolution criterion (minimise joint motion, maximise manipulability, avoid obstacles) to pick one solution.
At θ₂ = 0° (fully extended), the arm is straight and can only produce tip motion perpendicular to its length — motion along the length is impossible. The Jacobian determinant vanishes and the inverse velocity mapping is singular. At θ₂ = ±180° (fully folded), the same loss of rank occurs. Position IK still has a unique solution at the singularity, but velocity IK fails and must be handled specially.
When L₁ = L₂, the inner void has zero radius (rmin = 0), so the workspace is a full disk of radius 2L₁ — the arm can reach every point within that disk, including the base itself. This maximises the reachable area for a given total link length. The trade-off is that the arm passes through the fully-folded singularity at the exact centre of its workspace.
Real robot joints have finite ranges — typically ±180° for a revolute joint, or less when cables and hoses limit motion. The IK formula gives the geometric solution; you must then check that both θ₁ and θ₂ fall within the allowed ranges. If they don't, the other elbow configuration may work, or the target may be geometrically reachable but kinematically infeasible.
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| theta2 | Required elbow joint angle | degrees |
| x, y | Target end-effector coordinates | m |
| L1, L2 | Lengths of the first and second links | m |
What it means
For a two‑link planar arm, this formula gives the elbow angle θ2 (the angle between the two links) needed to reach a given end‑effector position (x, y). It is derived from the law of cosines. The equation gives two possible solutions (elbow‑up/down), which must be chosen based on configuration. This is a key step in inverse kinematics, which is used for control: given a desired end‑effector position, compute the joint angles to achieve it. Inverse kinematics is essential for robot programming and path planning. Understanding this helps in solving more complex inverse problems using numerical methods.
Worked example
Inverse Kinematics Elbow Angle – Two Detailed Examples
Real‑World| Parameter | Value |
|---|---|
| L1 (m) | 1 |
| L2 (m) | 1 |
| x (m) | 1 |
| y (m) | 1 |
| Parameter | Value |
|---|---|
| L1 | 1 |
| L2 | 1 |
| x | 1.5 |
| y | 0.5 |
Common mistakes
- Inverse kinematics elbow angle: θ2 = acos((x²+y² − L1² − L2²) / (2·L1·L2)).
- Argument of acos: Must be between −1 and 1 – otherwise the point is unreachable.
- Two solutions: acos gives the positive angle – the negative angle corresponds to the other elbow configuration.
- Units: x, y, L1, L2 in consistent units; θ2 in radians.
- Singularity: When the denominator is zero (L1=0 or L2=0) – not realistic for a robot.
Applications
Inverse kinematics for a 2‑link planar manipulator, θ₂ = arccos((x² + y² − L₁² − L₂²)/(2·L₁·L₂)), computes the required joint angles for a given end‑effector position. This is essential for real‑time robot control, as it allows the robot to move to desired Cartesian points. Engineers use inverse kinematics to position the end‑effector accurately for tasks such as welding, assembly, and painting. It also guides trajectory planning and obstacle avoidance. By solving for the elbow angle, they can choose between multiple configurations (elbow‑up/elbow‑down). This formula is the basis for more advanced methods like analytical and numerical IK for redundant manipulators. Understanding inverse kinematics is crucial for robotic automation.
- Real‑time positioning control of robot arms
- Task space planning and path generation
- Obstacle avoidance and configuration selection
- Calibration and error compensation in robots
- Educational insight into kinematic redundancy
Related calculators · Kinematics
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.