Jacobian Methods: Transpose, Pseudo-Inverse, DLS
You have a jointed arm — a character's shoulder, elbow and wrist, or a robot's servos — and a
target in space you want the hand to touch. Forward kinematics answers the easy question: given the
joint angles \theta, where does the hand x end
up? Inverse kinematics (IK) asks the hard one in reverse: what angles put the hand
there? For anything past two or three joints there is no tidy formula — so we
iterate. We nudge the joints a little, look at how much closer the hand got, nudge again, and
repeat until the hand arrives.
The engine of that nudging is the Jacobian
J — the matrix that says how a small change in the joint angles produces a
small change in the hand's position:
\Delta x \;=\; J\,\Delta\theta.
That is a simple linear equation. IK is nothing more than the art of solving it backwards
— finding the \Delta\theta that produces the \Delta x
we want — over and over. This page walks the whole family of ways to do that, from the crudest
(transpose) to the one every production rig actually ships (damped least squares).
The update loop
Every Jacobian IK solver is the same four-step loop, run for a handful of iterations per frame:
- Error. Measure how far the hand is from the goal:
e = x_{\text{target}} - x_{\text{current}}.
- Solve. Turn that positional error into a joint move
\Delta\theta using the current Jacobian
J — this is the step the methods disagree about.
- Step. Update the joints: \theta \leftarrow \theta + \Delta\theta,
then recompute x_{\text{current}} (and J) from
the new pose.
- Repeat until \lVert e \rVert is tiny (or you run out
of iterations).
Because J is only a local, linear snapshot of a curved
relationship, no single big step lands the hand on the goal — that is why we take small steps and
rebuild J each time. Everything below is a different answer to the one
question in step two: given e and J, what is
\Delta\theta?
Method 1 — the Jacobian transpose
The cheapest trick imaginable: don't invert anything, just multiply the error by the
transpose of the Jacobian and scale it down:
\Delta\theta \;=\; \alpha\, J^{T} e,
with a small positive step size \alpha. This looks like a wild guess, but
there is a beautiful reason it works. Define the goal-distance cost
C(\theta) = \tfrac12 \lVert e \rVert^2 = \tfrac12 \lVert x_{\text{target}} - x(\theta) \rVert^2.
Its gradient with respect to the joints turns out to be exactly
\nabla C = -J^{T} e. So the transpose update is
\Delta\theta = -\alpha \nabla C — plain
gradient descent
rolling downhill on the squared error.
- The step \Delta\theta = \alpha J^{T} e is the negative gradient of
\tfrac12\lVert e\rVert^2, so for a small enough
\alpha the error's magnitude always decreases — it can never
move the hand away from the goal.
- It needs no matrix inverse and no
SVD
— only a matrix–vector product, so it is dirt cheap and never divides by anything.
The catch is that gradient descent is slow and zig-zaggy. Because it only ever knows
the downhill direction — not how far to go — it can shuffle back and forth across a narrow valley,
taking many iterations to converge, and the choice of \alpha is fiddly (too
big and it overshoots and oscillates; too small and it crawls). It is a fine fallback and a great way
to understand IK, but rarely the production choice on its own.
Method 2 — the Moore–Penrose pseudo-inverse
If J were square and invertible we would just write
\Delta\theta = J^{-1} e and land the hand in one step. But a useful arm is
redundant: it has more joints than the task has dimensions (think of all the elbow
positions that keep your fingertip on the same spot), so J is a wide,
non-square matrix with infinitely many solutions. The Moore–Penrose pseudo-inverse
J^{+} picks a canonical one:
\Delta\theta \;=\; J^{+} e, \qquad J^{+} = J^{T}\!\left(JJ^{T}\right)^{-1} \text{ for a full-rank wide } J.
- Among all joint moves that achieve the desired hand motion, J^{+} e
is the least-norm one — the smallest
\lVert \Delta\theta \rVert, i.e. the laziest, most economical wiggle of
the joints.
- When the target motion is actually reachable, it is exact: it solves
J \Delta\theta = e in a single step, no zig-zag.
Through the
SVD
J = U\Sigma V^{T}, the pseudo-inverse simply inverts each singular
value: \sigma_i \mapsto 1/\sigma_i. That is elegant — and it is also the
seed of disaster. Near a singularity (the arm stretched straight, or folded flat) one
singular value \sigma shrinks toward zero, so 1/\sigma
rockets toward infinity, and \Delta\theta explodes.
Worked example: the blow-up at a singularity
Reduce the picture to a single troublesome direction — the near-singular one — so the algebra is
scalar. Suppose the relevant singular value is \sigma = 0.05 (we are close
to a singularity) and we ask the hand to move e = 0.10 units along that
stiff direction.
Pseudo-inverse. It inverts the singular value:
\Delta\theta_{+} \;=\; \frac{e}{\sigma} \;=\; \frac{0.10}{0.05} \;=\; 2.0 \text{ rad} \;\approx\; 115^\circ.
Two radians of joint rotation demanded in a single frame — the arm snaps violently,
overshoots, and the next frame it flails back. This is the classic IK "pop" near full extension.
Damped least squares (next section) replaces 1/\sigma with
the bounded factor \sigma/(\sigma^2 + \lambda^2). Take
\lambda = 0.10:
\Delta\theta_{\text{DLS}} \;=\; \frac{\sigma\,e}{\sigma^2 + \lambda^2} \;=\; \frac{0.05 \times 0.10}{0.05^2 + 0.10^2} \;=\; \frac{0.005}{0.0125} \;=\; 0.40 \text{ rad} \;\approx\; 23^\circ.
Same Jacobian, same error — but a fifth of the joint motion, and crucially a move
that stays bounded no matter how small \sigma gets. The hand approaches the
target a touch more slowly, but the arm never snaps.
Method 3 — damped least squares (DLS / Levenberg–Marquardt)
The fix that industry converged on adds a damping term
\lambda inside the inverse:
\Delta\theta \;=\; J^{T}\!\left(JJ^{T} + \lambda^2 I\right)^{-1} e.
This is exactly the Levenberg–Marquardt update from nonlinear least squares. Instead
of demanding the hand motion be met exactly, it minimises a blended cost
\lVert J\Delta\theta - e\rVert^2 + \lambda^2 \lVert \Delta\theta \rVert^2:
the first term wants to reach the target, the second penalises big joint moves. In SVD terms the
damaging map \sigma \mapsto 1/\sigma becomes the tamed
\sigma \;\mapsto\; \frac{\sigma}{\sigma^2 + \lambda^2}.
- For a large singular value (\sigma \gg \lambda) the
factor is \approx 1/\sigma — DLS behaves like the pseudo-inverse and
barely changes the healthy directions.
- For a tiny singular value (\sigma \ll \lambda) the
factor is \approx \sigma/\lambda^2 \to 0 — the dangerous direction is
gently switched off instead of blowing up. The peak of that factor is
1/(2\lambda), a hard ceiling on how large the step can get.
- As \lambda \to 0, DLS collapses back to the plain pseudo-inverse.
So \lambda is a dial trading a little accuracy for a lot of stability: too
small and singularities still bite; too large and the solver becomes sluggish and never quite reaches
the target. A small non-zero \lambda (often adapted on the fly, larger near
singularities) is the industry-default IK solver.
Watch the damping tame the blow-up
Below is the scalar model from the worked example with unit error
(e = 1). The horizontal reference line is the
pseudo-inverse step 1/\sigma — flat, because it ignores
damping entirely. The curve is the DLS step
\sigma/(\sigma^2 + \lambda^2) as you sweep the damping
\lambda. Drag the \sigma slider toward zero to
walk into a singularity: the pseudo-inverse line shoots off the top of the chart, while the DLS curve
— which meets it at \lambda = 0 — bends down and stays bounded the moment
you give it any damping at all.
The gap between the flat line and the curve at a given \lambda is precisely
the joint velocity that damping removes — the snap it prevents. Notice that when
\sigma is large (away from any singularity) the two are nearly on top of
each other: damping costs you almost nothing where you don't need it.
Nullspace projection — a second goal for free
A redundant arm has spare freedom: many joint configurations put the hand in the same place. The
pseudo-inverse spends none of it (least-norm), but we can use it for a secondary goal
— steer toward a comfortable pose, dodge a joint limit, keep the elbow up — without disturbing the
hand. The tool is the nullspace projector:
\Delta\theta \;=\; J^{+} e \;+\; \left(I - J^{+} J\right) z.
- I - J^{+}J projects any vector z onto the
nullspace of J — the directions of joint motion that
produce zero hand motion.
- So the projected term moves the joints (toward the secondary objective, e.g.
z = -\nabla(\text{comfort cost})) while the hand stays exactly on the
primary target the first term set.
This is how a character's whole body can shift naturally while a hand stays glued to a prop, or how a
robot avoids its joint stops while its gripper tracks a path. Primary task first, personality in the
nullspace.
The pseudo-inverse is the textbook-perfect answer only away from singularities. In the wild,
arms constantly pass near full extension, folded joints, and aligned axes — and at each of those a
singular value dips toward zero, 1/\sigma spikes, and the solver demands
unbounded joint velocities. On screen that reads as the limb violently snapping,
popping, or jittering frame-to-frame; on hardware it is a safety fault. The rule is simple:
always damp. Ship damped least squares with a small non-zero
\lambda (raise it as you approach a singularity), so the worst-case step is
capped at 1/(2\lambda) instead of infinity. A plain
J^{+} in production is a bug waiting for a pose to trigger it.
Yes — and the identity is worth savouring. The hand-position error is
e = x_{\text{target}} - x(\theta), and by the chain rule
\tfrac{\partial x}{\partial \theta} = J, so the gradient of
C = \tfrac12\lVert e\rVert^2 is
\nabla_\theta C = -J^{T} e. Stepping downhill,
\Delta\theta = -\alpha\nabla C = \alpha J^{T} e — the transpose rule falls
straight out. That is why it can never increase the error and why it needs no inverse. It also explains
its personality flaw: gradient descent knows the steepest direction but not the right step length, so
it zig-zags down long thin valleys. The pseudo-inverse and DLS are, in effect, cleverer step-length
choices for the very same descent.
Writing the damping as \lambda^2 rather than \lambda
is a convention that keeps the units and the SVD tidy. Minimising
\lVert J\Delta\theta - e\rVert^2 + \lambda^2\lVert\Delta\theta\rVert^2 gives
the normal equations (J^{T}J + \lambda^2 I)\Delta\theta = J^{T}e, whose
wide-matrix twin is \Delta\theta = J^{T}(JJ^{T} + \lambda^2 I)^{-1}e. Because
\lambda^2 sits alongside \sigma^2 in the SVD, the
per-direction gain is the clean \sigma/(\sigma^2+\lambda^2), and
\lambda carries the same units as a singular value — so you can read it as
"treat any singular value below about \lambda as suspect".