› Robot Arm Kinematics Back
Robotics

2-Link Robot Arm — Forward & Inverse Kinematics

Adjust joint angles for FK, or click the canvas to set an IK target and toggle between elbow-up and elbow-down configurations.

Mode
Link settings
Link 1 length L₁
m
Link 2 length L₂
m
Joint angles (FK)
θ₁ (joint 1)
°
θ₂ (joint 2)
°
Presets
Live values
—
Joint angle θ₁
—
Joint angle θ₂
—
End X [m]
—
End Y [m]
—
Reach |r| [m]
—
Solution branch
Real-time kinematics animation
Link 1 L₁ Link 2 L₂ End effector Other solution (elbow-up/down ghost) Workspace (annulus)
Theory & Key Formulas

$x = L_1\cos\theta_1 + L_2\cos(\theta_1+\theta_2)$
$y = L_1\sin\theta_1 + L_2\sin(\theta_1+\theta_2)$

Inverse kinematics (IK):
$\cos\theta_2 = \dfrac{x^2+y^2-L_1^2-L_2^2}{2L_1L_2}$
$\theta_1 = \mathrm{atan2}(y,x) - \mathrm{atan2}(L_2\sin\theta_2,\,L_1+L_2\cos\theta_2)$

What Are Forward and Inverse Kinematics of a Two-Link Robot Arm?

🙋
What are "forward kinematics" and "inverse kinematics" for a robot arm? The names are similar, but are they very different?
🎓
Roughly speaking, the calculation runs in opposite directions. Forward kinematics (FK) answers "if I bend the joints this much, where does the hand end up?". Inverse kinematics (IK) works backwards: "if I want the hand here, how should I bend the joints?". Try moving the θ1 and θ2 sliders above. The arm changes shape, right? That is FK. Conversely, when you click the canvas to place a target point, the arm reshapes itself to reach it. That is IK in action.
🙋
Oh, really! So the angles are calculated automatically when I click. But sometimes there are two possible arm shapes for the same target. What is that?
🎓
Good catch. Those are the two solutions, "elbow up" and "elbow down". Even with a human arm, you can put your hand in the same place with the elbow pointing up or down. Mathematically, the equation gives $\cos\theta_2$, so $\theta_2$ can take either sign, which produces two combinations of joint angles. Switch between "Elbow up" and "Elbow down" under "Solution branch" in the simulator and see how the pose changes.
🙋
I see! But when I click near the edge of the canvas, sometimes the arm cannot reach and no solution is calculated. Why is that?
🎓
That is because you picked a point outside the arm's reachable region. The hand of a two-link arm can only be placed in an annulus whose outer radius is the maximum reach $L_1+L_2$ and whose inner radius is the minimum $|L_1 - L_2|$. Try making the link lengths $L_1, L_2$ extremely short or long with the sliders and watch how this annulus changes. In design this region is called the workspace, and it is a key measure of where the robot can work.

Frequently Asked Questions

In FK mode, you set the joint angles θ1 and θ2 with the sliders and the end-effector position is calculated automatically. In IK mode, you click a target position on the canvas and the joint angles needed to reach it are calculated backwards. Switch between them as needed.
Points farther than the total link length (L1+L2), or too close (less than |L1-L2|), cannot be reached. If the joint angles were limited, there could also be no solution within those limits. Use the reachable region shown on the canvas as a guide when clicking.
This tool uses degrees (°). The sliders cover −180° to 180°. The formulas convert to radians internally, but all display and input is in degrees.
Yes. The calculated coordinates and angles are shown as numbers, so you can note them down for robot control design or teaching material. Keep in mind that this is a simplified simulator; controlling a real robot requires accounting for physical parameters and errors.

Real-World Applications

Trajectory planning for industrial robot arms:In welding, painting and assembly, the tool (end effector) is given a series of points (a trajectory) to pass through. Solving inverse kinematics at each point and computing the corresponding sequence of joint angles produces smooth motion.

Character control in games and animation:Inverse kinematics is widely used to make a character's hands or feet reach a particular place (a door knob or a weapon, for example) naturally. This creates more efficient and natural motion than setting each joint by hand.

Robotic surgery (surgical assistance robots):Forward kinematics determines the tip position of the surgical instrument inside the patient from the position of the master controller the surgeon operates, and inverse kinematics determines how far to drive each joint from the instrument's target position.

Rehabilitation and power-assist suits:Forward kinematics estimates the position of the hands and feet from the wearer's joint-angle sensors. Inverse kinematics is also the basis for working out the joint torques to give the motors from the target position of the motion to be assisted.

Common Misconceptions and Points to Note

First,the simple split "forward kinematics (FK) is easy and inverse kinematics (IK) is hard" is dangerous. It is true that two-link FK is just a sum of trigonometric terms, but as the number of links grows, the FK equations themselves get complicated depending on the joint layout (revolute/prismatic) and how the coordinate frames are chosen. On the other hand, the planar two-link IK handled by this tool is a special case with a geometric closed-form solution. Many practical arms such as 6-axis robots have no such closed form and are solved numerically (iteratively), so the nature of the difficulty of FK and IK can even be reversed.

Next,it is tempting to think "once a solution is found, we are done", but judging the quality of the solution matters. For example, when there are two solutions, elbow up and elbow down, for the same target, which one to choose depends on the application. With obstacles in the workspace you would choose the pose that avoids them; for energy efficiency, the pose closest to the middle of the joint ranges. Solutions close to a singular configuration (for example, the arm fully stretched out) are also hard to control, because a small change in the target causes a sudden change in the joint angles. Set L1 and L2 to the same length in this tool and place the target far out, almost on the X axis (y = 0), to get a feel for this.

Finally,always be aware of the units and reference directions of the parameters. This tool displays angles in degrees, but internal calculations and many libraries use radians. The reference axis for θ1 (usually the X axis) and the positive direction of rotation (usually counter-clockwise) depend on the coordinate system and on right- or left-handed conventions, so they are the first things to check when connecting to another system. For example, if CAD data and a robot simulator define their coordinate systems differently, the robot can move in completely unexpected ways.

How to Use

  1. Set the length of link 1 (L₁) and link 2 (L₂), for example L₁ = 1.0 m and L₂ = 0.8 m for the dimensions of an industrial robot arm
  2. In FK mode, adjust the joint 1 angle θ₁ and joint 2 angle θ₂ with the sliders and watch the end-effector position; forward kinematics computes the current position automatically
  3. In IK mode, click a target position on the canvas (or set target X/Y); the joint angles θ₁ and θ₂ are solved automatically and the arm moves to the target

Worked Example

For a two-link arm with L1 = 0.25 m and L2 = 0.20 m at joint angles θ1 = 45° and θ2 = 30°, forward kinematics puts the end effector at x ≈ 0.229 m, y ≈ 0.370 m. Conversely, for the target (0.40 m, 0.15 m), |r| ≈ 0.427 m is less than the maximum reach L1 + L2 = 0.45 m, so it is reachable, and inverse kinematics returns two solutions: θ1 ≈ 4.2°, θ2 ≈ 36.9° (elbow up) and θ1 ≈ 36.9°, θ2 ≈ −36.9° (elbow down).

Practical Notes

🎬 Watch it in motion

Ratchet & Pawl | the wheel that never turns back #Shorts
Ratchet & Pawl | the wheel that never turns back #Shorts
Scotch Yoke | a perfect sine wave, cut in steel #Shorts
Scotch Yoke | a perfect sine wave, cut in steel #Shorts
Cam & Follower | the profile IS the program #Shorts
Cam & Follower | the profile IS the program #Shorts
Geneva Mechanism | it spins non-stop, yet the output keeps stopping #Shorts
Geneva Mechanism | it spins non-stop, yet the output keeps stopping #Shorts
Four-Bar Linkage | four rods turn rotation into a controlled swing #Shorts
Four-Bar Linkage | four rods turn rotation into a controlled swing #Shorts
Projectile Motion | the safety parabola you can't beat #Shorts
Projectile Motion | the safety parabola you can't beat #Shorts