liveBook · Manning

Jacobian

As explained in Deep Learning with JAX

The matrix of all first-order partial derivatives of a vector-valued function with respect to multiple inputs.

When a function has several inputs and outputs, one derivative is not enough. A Jacobian collects every first-order partial derivative of that vector-valued function into a matrix. section 4.2.5

JAX provides jacfwd() and jacrev(). Both return the same Jacobian values, but forward-mode autodiff suits tall matrices with many outputs, while reverse-mode autodiff suits wide matrices with many inputs. section 4.2.5 section 4.3.2

Computing a vector-valued Jacobian

For f(x) = [x₀² + x₁² − x₁x₂, x₀² − x₁² + 3x₀x₂] at x = [3, 4, 5], both transformations produce [[6, 3, −4], [21, −8, 9]]. The example reports jacfwd() faster for this two-output, three-input function. Use jvp() instead when you need a Jacobian-vector product without materializing the full matrix. section 4.2.5 section 4.3.2

The Jacobian connects several levels of automatic differentiation:

  • Forward mode computes one Jacobian column per input direction and can recover the full matrix in as many evaluations as inputs. section 4.3.2
  • The chain rule expresses derivatives through products of layer Jacobians, connecting Jacobians to neural-network differentiation. section 4.2.5

How Deep Learning with JAX covers it

How deep it goes
Defines the matrix, compares forward and reverse implementations, and demonstrates computation while deferring autodiff implementation internals.
Examples
Demonstrates a two-output, three-input polynomial function with jacfwd(), jacrev(), jvp(), and recovered Jacobian columns.
What it assumes
Assumes familiarity with derivatives and partial derivatives while building from scalar gradients toward vector-valued functions.
What you can do after
Apply it via JAX transformations, choosing jacfwd() or jacrev() by matrix shape and using jvp() for directional products.
How it connects
Connects Jacobians to gradients, the chain rule, forward-mode autodiff, reverse-mode autodiff, Hessians, and Jacobian-vector products.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.