Jacobians
The Jacobian has entry (i,j) equal to the partial derivative of output i with respect to input j.
On this page 10 sections
01Organize several outputs and inputs#
A gradient collects coordinate rates for one scalar output. A vector-valued function has several output coordinates, each with its own dependence on the inputs. Its Jacobian puts all those first derivatives in a matrix.
We use one row per output and one column per input. If there are inputs and outputs, the Jacobian has shape .
Write for output , and for input . The entry in row , column is
Read as “the Jacobian of .” The subscript names the function. Writing means evaluate all its entries at the input point .
02Build the matrix one output at a time#
Consider . Its first output is . Differentiating that output with respect to gives ; differentiating it with respect to gives .
The first row is therefore . Both entries describe the same output, under two different input changes.
The second output is . Its -partial is , because stays fixed. Its -partial is , because stays fixed. This gives the second row .
Read down a column to see how one input affects every output. Read across a row to see how every input affects one output.
For a single scalar output, this convention produces a one-row Jacobian. Our gradient convention uses a column, so for a differentiable scalar function the Jacobian is the transpose of its gradient.
Neither convention changes any partial derivative. It changes how we arrange the entries so that matrix products have the intended meaning.
. Give as ordered rows.
Show answer and explanation
Output 2 gives .
03Keep the output and input counts separate#
Now let . There are three outputs and two inputs, so we need three rows and two columns:
The second row's zero records that does not depend on . The third row's zero records that does not depend on .
Zero entries are part of the map. Removing them would lose the alignment between derivatives and input coordinates.
A Jacobian need not be square. A model can turn two features into three outputs, or many parameters into one loss. Count outputs and inputs before calculating entries.
. Repair an omitted output 3. Give the ordered rows of .
Show answer and explanation
Keep all three output rows.
04Evaluate the derivative at a point#
Return to and choose . Evaluating the function gives . Evaluating the Jacobian gives
The output is a pair of values; the Jacobian is a table of rates. In particular, the in the bottom-left position means the second output's local rate with respect to is three at this point.
When this function follows another function, its input may be an intermediate output rather than the original starting point. The notation in parentheses tells you where to evaluate.
For example, says: calculate , then put those coordinates into the derivative formulas for . It does not mean multiply by or by .
. At , give the ordered rows of .
Show answer and explanation
Differentiate in a, then b.
05Use the Jacobian as a local linear map#
For a small input change , a differentiable vector map satisfies the first-order approximation
The Jacobian maps an input change to an approximate output change. It does not replace the original nonlinear function for arbitrary inputs.
At , choose . Our Jacobian predicts
The two contributions to the first output cancel to first order, while the second output is predicted to increase by .
The actual output at is . Compared with , the actual change is , close to the prediction.
The remaining terms are nonlinear effects. This local-map interpretation explains why the chain rule multiplies Jacobians: a small change passes through one local map, then the next.
Outputs choose rows; inputs choose columns.
- Construct the Jacobian of a vector-valued map.
Further questions
Is a scalar gradient the same shape?
Sources & further reading
- [1]MIT 18.S096, Lecture 1–2: Derivatives as Linear Operators ↗MIT OpenCourseWare · Course