Skip to the lesson
FixTheRobot Explore Robotics / Linear Algebra / M8 Jacobians and Robot Kinematics / M8-T4

Linear Algebra · Theory · M8

M8-T4 — Jacobian Matrices

The Jacobian turns a nonlinear function into a matrix at each point, so everything you know about matrices applies locally.

  • Lesson 4 of 10
  • Module 8: Jacobians and Robot Kinematics
  • Jacobians and kinematics
  • About 9 minutes to read

The derivative of a function from n inputs to m outputs is an m × n matrix, the Jacobian. It is the linear map that best approximates the function near a point, which is why it is the link between the nonlinear world of robot geometry and the linear algebra of Modules 2 to 6.

Learning objectives

After this lesson, you should be able to:

  • Define the Jacobian as the m × n matrix of partial derivatives and read its rows and columns.
  • Compute the Jacobian of the two-link arm and of a range-bearing sensor model.
  • Use J as the best local linear approximation, and measure the error of that approximation.
  • Compose Jacobians with the chain rule, Jg∘f = Jg Jf.

Introduction and motivation

EKF-SLAM, bundle adjustment, ICP, visual servoing and arm control all contain a step that says “linearise at the current estimate”. The object produced is a Jacobian: the matrix that says how each measurement or hand coordinate responds to each state or joint variable. Once you have the matrix, the question “which direction can the hand not move?” becomes “what is the null space or the smallest singular value of J?”, and we already know how to answer it.

The intuition

Take a function with several inputs and several outputs, such as joint angles to hand position. Nudge the first input by a tiny amount and record how all outputs respond: that is the first column. Do the same for each input in turn. The columns together are the matrix; multiplied by any small input change it predicts the output change, because small changes add.

Anatomy of a JacobianThe Jacobian of a vector function stacks the gradients of its components as rows. Entry i j is the partial derivative of output i with respect to input j. Column j is the effect of input j alone on all outputs.J = ∂f/∂q ∂f₁/∂q₁∂f₁/∂q₂∂f₁/∂q₃ ∂f₂/∂q₁∂f₂/∂q₂∂f₂/∂q₃ ↑ column 1↑ column 2↑ column 3 row 1row 2 row i = gradient of output fᵢ column j = effect of input qⱼ alone f(q + δ) ≈ f(q) + J δ size: (number of outputs) × (number of inputs) The Jacobian is the best local linear approximation of f, a matrix that changes from point to point.
Rows are gradients of the outputs; columns are the effects of each input; J predicts small changes.

Interactive figure. A two-link arm showing the Jacobian columns as arrows at the hand and the product of the Jacobian with the joint velocities as a third arrow. This figure needs JavaScript to be interactive.

Geometric and physical interpretation

Geometric view. Near a point the function stretches, rotates and shears a small neighbourhood like the linear map J does; the unit circle of input changes becomes an ellipse of output changes (the SVD picture of Module 6). Physical view. Each column of the arm Jacobian is the hand's velocity when only that joint moves at one radian per second; for a revolute joint it is the joint axis crossed with the vector from the joint to the hand.

The mathematics

f: ℝⁿ → ℝᵐ
a vector function with n inputs and m outputs, f = (f₁, …, fm).
J(q)
the Jacobian matrix, with entries Jᵢⱼ = ∂fᵢ/∂qⱼ, evaluated at the point q.
δ
a small change in the input.

Definition

J(q) = [ ∂fᵢ/∂qⱼ ]   (m rows, n columns)

What it means. Row i is the gradient of output fᵢ. Column j shows how all outputs respond to input qⱼ alone. A different matrix is obtained at each q.

Best local linear approximation

f(q + δ) = f(q) + J(q) δ + o(‖δ‖)

What it means. For small δ the output change is J times the input change, with an error that shrinks faster than the step. J is the unique matrix with this property.

The chain rule

h = g ∘ f   ⇒   Jh(q) = Jg( f(q) ) · Jf(q)

What it means. To differentiate a composition, multiply the Jacobians in order. This is how the sensor-model Jacobian is assembled from a frame change followed by a polar conversion.

Jacobian = matrix of partial derivatives, m × n; columns are the effects of each input; f(q + δ) ≈ f(q) + Jδ; compositions multiply Jacobians.

Step-by-step derivation: assembling Jacobians and the chain rule

  1. Two-link arm. The outputs are x = l₁ cos q₁ + l₂ cos(q₁ + q₂) and y = l₁ sin q₁ + l₂ sin(q₁ + q₂); the inputs are q₁, q₂. The four partial derivatives (previous lesson) fill J = [[−l₁ s₁ − l₂ s₁₂, −l₂ s₁₂], [l₁ c₁ + l₂ c₁₂, l₂ c₁₂]] with s₁₂ = sin(q₁ + q₂), c₁₂ = cos(q₁ + q₂).
  2. Range-bearing sensor. The model h(x, y) = (r, β) = (√(x² + y²), atan2(y, x)) for a landmark at (x, y) relative to the sensor has J = [[x/r, y/r], [−y/r², x/r²]].
  3. Why J is the best linear map. If f is differentiable at q, there is a matrix A such that f(q + δ) = f(q) + Aδ + o(‖δ‖). Taking δ = h eⱼ and letting h → 0 shows that column j of A equals ∂f/∂qⱼ, so A = J.
  4. Chain rule. Let u = f(q) and h = g(u). Then δu ≈ J_f δq and δh ≈ J_g δu = J_g J_f δq, so the Jacobian of the composition is the product, evaluated at the right points.
  5. Sensor on a moving robot. The measurement of a world point ℓ is h = polar( T_BW(x, y, θ) ℓ ): a pose-dependent frame change followed by the polar conversion. The chain rule gives ∂h/∂(x, y, θ) = J_polar · J_frame, a 2 × 3 matrix: exactly the measurement Jacobian of EKF-SLAM.
  6. Non-square Jacobians. With n inputs and m outputs J is m × n. Square (n = m) Jacobians can be inverted when nonsingular (the Jacobian inverse lesson); wide ones (n > m, redundant arms) have a null space; tall ones (n < m) over-constrain the inputs, as in least squares.

Accuracy of the linear model. The error is second order: ‖f(q + δ) − f(q) − Jδ‖ ≤ ½ M ‖δ‖², where M bounds the second derivatives. It is the reason iterative methods (Newton, Gauss-Newton, inverse kinematics) re-evaluate J at every step: J only describes the neighbourhood of the current point.

Units. Entries of J have units (output unit per input unit). The arm Jacobian above has metres per radian for revolute joints. Condition numbers of a matrix with mixed units depend on the choice of units, so scale before interpreting singular values.

A worked example: two Jacobians and a prediction

  • Arm Jacobian at q = (0°, 90°) with l₁ = 1.1, l₂ = 0.8: s₁ = 0, c₁ = 1, s₁₂ = 1, c₁₂ = 0. So J = [[−0 − 0.8, −0.8], [1.1 + 0, 0]] = [[−0.8, −0.8], [1.1, 0]].
  • Prediction. Turn the shoulder by +1° (0.01745 rad) and the elbow by −2° (−0.03491 rad): δp ≈ J δq = (−0.8·0.01745 + (−0.8)(−0.03491), 1.1·0.01745) = (0.01396, 0.01920). The exact new hand position is fk(1°, 88°) = (1.1 cos 1° + 0.8 cos 89°, 1.1 sin 1° + 0.8 sin 89°) = (1.1138, 0.8191), so the true change is (0.0138, 0.0191), matching the prediction to about 2 × 10⁻⁴ (second-order error).
  • Range-bearing Jacobian at the landmark (3, 4): r = 5, J = [[0.6, 0.8], [−0.16, 0.12]]. A shift of the landmark by (0.1, −0.05) changes range by 0.6·0.1 + 0.8·(−0.05) = 0.02 and bearing by −0.16·0.1 + 0.12·(−0.05) = −0.022 rad.
  • Chain rule. A robot at the origin with heading 0 sees a landmark at world (3, 4). Moving the robot by δ = (0.1, 0) moves the landmark by (−0.1, 0) in the sensor frame, so δh = J (−0.1, 0) = (−0.06, 0.016): range falls by 6 cm and bearing grows by 0.016 rad, as the matrix product predicts.

Robotics application

EKF-SLAM and pose graphs. The measurement Jacobian above, with respect to robot pose and landmark position, is the matrix H of the EKF update and the block in the information matrix of a pose graph; see EKF-SLAM, pose graphs and nonlinear least squares.

UAV estimators. The state-transition and measurement Jacobians in the EKF and the error-state Kalman filter are built by the chain rule; see the extended Kalman filter and the error-state Kalman filter.

Manipulators. The arm Jacobian maps joint velocities to hand velocity and joint torques to hand forces (next lessons).

LiDAR registration. The Jacobian of a point-to-plane residual with respect to a small rotation and translation is a 1 × 6 row per point; stacking N rows gives the matrix whose normal equations ICP solves; see ICP fundamentals.

Engineering implications and limitations

Practical rules

  • Evaluate J at the current estimate. A Jacobian is not a constant; computing it once and reusing it is a common reason for solver divergence.
  • Check shapes. m outputs by n inputs. A transposed Jacobian passes silently when the matrix is square.
  • Verify with central differences. Compare each column with a numerical derivative at random points before using it in a filter.
  • Scale columns before judging conditioning. Metres per radian and metres per metre in one matrix have different scales; normalise or whiten.
  • Keep angle units consistent. The Jacobian with respect to degrees differs by π/180 from that with respect to radians.
  • Use the chain rule structurally. Build sensor Jacobians as products of small, tested pieces (frame change, polar conversion), not one large hand-expanded formula.

Limits

J describes the function only to first order and only near the evaluation point. At non-differentiable points (contacts, saturation, an angle wrap) it is undefined, and for strongly curved functions the valid neighbourhood is small.

Common misconceptions

“The Jacobian is a property of the robot.”

It is a property of the robot at a configuration; it changes with q.

“J maps a configuration to a hand position.”

That is the forward-kinematics function. J maps small changes (velocities) in the input to small changes (velocities) in the output.

“The Jacobian is always square.”

It is m × n. A redundant arm has more columns than rows, a camera model may have more rows than columns.

“The linear approximation is good everywhere.”

It is good in a neighbourhood whose size depends on curvature, and the error grows quadratically with the step.

Engineering takeaways

  1. The Jacobian J = [∂fᵢ/∂qⱼ] is m × n: rows are gradients of outputs, columns are the effects of single inputs.
  2. f(q + δ) ≈ f(q) + J(q)δ is the best local linear approximation; the error is second order.
  3. The Jacobian of a composition is the product of the Jacobians.
  4. The arm Jacobian is [[−l₁s₁ − l₂s₁₂, −l₂s₁₂], [l₁c₁ + l₂c₁₂, l₂c₁₂]]; the range-bearing Jacobian is [[x/r, y/r], [−y/r², x/r²]].
  5. Evaluate J at the current point, check shapes and units, and verify against finite differences.

References and further reading

Primary papers and authoritative documentation.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

Write the Jacobian of f(x, y) = (x² + y, xy) and evaluate it at (2, 3).

Explanation

J = [[∂f₁/∂x, ∂f₁/∂y], [∂f₂/∂x, ∂f₂/∂y]] = [[2x, 1], [y, x]]. At (2, 3): [[4, 1], [3, 2]].

Question 2

With J = [[−0.8, −0.8], [1.1, 0]] predict the hand displacement for δq = (0.02, 0.01) rad.

Explanation

δp ≈ J δq = (−0.8·0.02 − 0.8·0.01, 1.1·0.02) = (−0.024, 0.022) m.

Question 3

A range sensor and a bearing sensor each give one row of a Jacobian. If the two rows were parallel (for example both = (0.6, 0.8)), what would that say about the pose information?

Explanation

Parallel rows mean both measurements respond to position change in the same direction only: the Jacobian has rank 1, and motion perpendicular to (0.6, 0.8) is unobservable from these two measurements. A second landmark in a different direction is needed for full rank.

What’s next

With the Jacobian in hand, the velocity-level kinematics of an arm is a single matrix equation. The next lesson reads it in both directions: joint speeds to hand speed, and hand force to joint torque.

Practice this lesson

Interactive Robotic Arm and Inverse Kinematics

Drive a two-link arm to targets by inverse kinematics, watch the pseudoinverse blow up near a singularity, and fix it with damping.

Next lesson

M8-T5 — Differential Kinematics

Relate joint velocities to hand velocity with the Jacobian, and joint torques to hand forces with its transpose.

Nothing below is required to finish this lesson.