The IK Problem
Sit an animated character down at a table and ask them to pick up the mug. With
forward
kinematics you would pose the shoulder, then the elbow, then the wrist, spinning dials
until — with luck and a lot of nudging — the fingertips happen to land on the handle. That is exactly
backwards from how the shot is described. The director does not care about the shoulder angle;
the director cares that the hand reaches the mug. The hand is the goal, the joint
angles are the unknowns, and the job of finding them is the inverse kinematics (IK)
problem.
Forward kinematics is a function: feed it the joint angles and it hands you back the position
of the fingertip. Inverse kinematics runs that function the other way — you name the
fingertip position you want, and it has to hunt for the joint angles that produce it. That "run the
function backwards" is where all the difficulty lives, and this page is about why.
FK is a map; IK inverts it
Line up a chain's joint angles into a single vector
\boldsymbol{\theta} = (\theta_1, \theta_2, \ldots, \theta_n). Forward
kinematics is a fixed map f that sends that vector to the pose (position,
and often orientation) of the end-effector — the hand, the foot, the tool tip:
\mathbf{x} \;=\; f(\boldsymbol{\theta}) \qquad(\text{forward kinematics — easy, one answer}).
- Given a desired end-effector pose \mathbf{x}_{\text{target}}, find
joint angles \boldsymbol{\theta} such that
f(\boldsymbol{\theta}) = \mathbf{x}_{\text{target}}.
- Formally it is the solution set
f^{-1}(\mathbf{x}_{\text{target}}) = \{\,\boldsymbol{\theta} : f(\boldsymbol{\theta}) = \mathbf{x}_{\text{target}}\,\}
— which may contain one pose, many poses, infinitely
many, or none at all.
Evaluating f is a walk down the chain multiplying transforms together —
cheap and deterministic. Inverting it is a different animal, because f
is nothing like a nice invertible line. Four separate troubles pile up.
Why it is genuinely hard
1. Nonlinearity. Every joint contributes a rotation, and rotations put
\sin\theta and \cos\theta into
f. So f is a knot of trigonometry, not a linear
map — you cannot just "divide by the matrix" to undo it. A single planar link already gives
(x,y) = (\ell\cos\theta,\; \ell\sin\theta); stack several and the algebra
explodes.
2. Redundancy. When a chain has more joints than the target has constraints,
countless poses hit the same target. Your own arm is the classic case: pin your hand flat on a desk and
your elbow can still swing through a whole arc — the elbow circle — without
the hand moving a millimetre. That is a one-parameter family of solutions for a single target: infinitely
many correct answers.
3. Unreachability. Ask for a target beyond the arm's total length and there
is simply no pose that gets there — f^{-1}(\mathbf{x}_{\text{target}}) is
empty. The equation f(\boldsymbol{\theta}) = \mathbf{x}_{\text{target}} has
no solution, and a solver must not crash or spin forever when handed one.
4. Singularities. At special poses the chain momentarily loses a degree of
freedom. A fully straight arm is the textbook one: at full extension the hand can
still slide sideways, but it cannot move any further straight out, and near that pose a tiny
change in target demands an enormous, ill-conditioned change in joint angles. Solvers go numerically
haywire exactly there.
Hold your hand fixed in space and rotate your whole arm about the straight line running from your
shoulder to your hand. Your elbow sweeps out a circle in the air while the hand never budges —
that circle is a continuous set of distinct arm poses, all reaching the identical target. A human arm
has seven joint degrees of freedom but only needs six to fully fix a hand's position and
orientation, leaving one spare — and that one spare parameter is the elbow circle. This
"extra" freedom is not a nuisance to animators; it is a gift. It is exactly the room you need to keep an
elbow from clipping through the character's own ribs while the hand stays glued to a steering wheel.
Worked example: a two-link arm reaching a point
The smallest honest IK problem is a planar arm of two links, lengths
\ell_1 and \ell_2, with the shoulder pinned at
the origin. We want the far tip to land on a target a distance d from the
shoulder. Pure geometry — the law
of cosines on the triangle shoulder–elbow–target — settles it. The interior angle at the
elbow satisfies
d^2 = \ell_1^2 + \ell_2^2 - 2\,\ell_1 \ell_2 \cos(\pi - \theta_2)\quad\Longrightarrow\quad \cos\theta_2 = \frac{d^2 - \ell_1^2 - \ell_2^2}{2\,\ell_1 \ell_2}.
Now read off the three cases straight from that \cos\theta_2:
- Two solutions — when |\ell_1 - \ell_2| < d < \ell_1 + \ell_2.
The cosine gives a value strictly between -1 and 1,
so \theta_2 has two solutions of opposite sign: the mirror-image
elbow-up and elbow-down poses.
- One solution — when d = \ell_1 + \ell_2 (arm fully
extended) or d = |\ell_1 - \ell_2| (fully folded). The
cosine hits \pm 1, the two solutions merge into one — and this coincidence
is precisely a singularity.
- No solution — when d > \ell_1 + \ell_2 (too far) or
d < |\ell_1 - \ell_2| (too close). The cosine falls outside
[-1, 1]; there is no real angle, so the target is
unreachable.
Concretely, take \ell_1 = \ell_2 = 2 and a target at
d = 3. Then
\cos\theta_2 = (9 - 4 - 4)/(2\cdot 2\cdot 2) = 1/8 = 0.125, so
\theta_2 = \pm 82.8^\circ — two valid poses. Slide the target out to
d = 4.1 and the numerator would demand
\cos\theta_2 > 1: impossible, the arm cannot stretch that far. This tiny
two-link case has a clean closed-form answer — but notice how quickly even it fans into
cases.
Play with reach and solutions
Below is exactly that two-link arm (\ell_1 = 2.2,
\ell_2 = 1.8, so the maximum reach is 4.0). The
dashed circle is the boundary of reach. Drag the target distance and
direction sliders and watch both IK solutions redrawn live: the
elbow-up arm and the elbow-down arm, two distinct poses whose hands meet at the same
point. Push the target past the dashed circle and both solutions collapse to a single
fully-extended arm that cannot reach — a visible gap opens to the target, and the
status line flips to "out of reach". Slide the target exactly onto the circle and the two
arms become one: the singular, fully-straight pose.
Everything on this page is visible in that one picture: the two mirror solutions
(redundancy in miniature), the single merged pose at full stretch (a singularity), and
the empty gap when the target escapes the circle (unreachability).
Two families of solvers
How do you actually compute \boldsymbol{\theta}? There are two
broad approaches, and a rig usually mixes them.
- Analytic (closed-form). For simple, short chains — a two-link limb, or
a wrist with a known geometry — you can write down the exact solution with algebra, as we just did
with the law of cosines. Instant, exact, and it hands you all the solutions (both elbows)
so you can choose. But every different chain needs its own hand-derived formula, and it does not
scale to a long, general rig.
- Iterative (numerical). For general, high-DOF rigs you start from the
current pose and repeatedly nudge the joints to shrink the distance to the target — Jacobian-based
methods, CCD,
or FABRIK.
They handle any chain and any number of joints, but they converge iteratively, can stall near
singularities, and return just one of the many solutions.
The full toolkit — how the Jacobian linearises f locally, and how CCD and
FABRIK actually step — is the subject of later lessons. For now the point is the split: exact
formulas for the easy cases, iterative search for everything else.
Because the world is full of things a character must touch and hold. With pure FK, the moment
the torso shifts, the hand drifts off the steering wheel and the foot slides off the ground — you would
have to hand-correct every downstream joint on every frame. IK inverts that pain: you plant a
goal (foot on the floor, hand on the wheel, fingertip on the trigger) and the solver
keeps it pinned automatically while the rest of the body moves freely above it. Foot-planting alone —
stopping feet from sliding as a character walks — is worth the entire machinery. In practice rigs are
hybrid: spine and fingers posed with FK for expressive control, limbs driven by IK so
their ends stay locked to the world. The two are partners, not rivals.
The tempting mental model is that IK is a tidy inverse function that spits back the joint
angles. It is not. Two things break that picture, and a real solver must handle both on purpose:
- Under-determined (too many answers). A redundant chain reaches a target infinitely
many ways — the elbow circle. The equation alone cannot pick one, so the solver needs
extra criteria: stay near the current or a natural rest pose, respect
joint limits (elbows do not bend backwards), minimise energy, avoid
self-collision. Without such a tie-breaker you get valid-but-hideous poses that snap and flip between
frames.
- Over-constrained / unreachable (no answer). Ask for a target outside the reachable
set and there is nothing to return. A good solver degrades gracefully —
it reaches as far as it can toward the target (the fully-extended pose) rather than diverging,
NaN-ing, or freezing. "No exact solution" must become "best available pose", not a crash.
So IK is never just "solve the equation". It is "solve the equation if it has a solution, pick
a good one if it has many, and fail softly if it has none."