Matrix Calculus & AD

An interactive lecture series on computing derivatives correctly, checking your work, and letting the computer do it for you.

Part 1

Finite Differences

Why matrix calculus is error-prone and how to check your work with finite differences. Interactive demos of the error "V" shape and optimal step sizes.

Start here →
Part 2a

Matrix Calculus Rules

Worked examples from simple to complex. Chain rule, product rule, and a derivative workshop where you can try any function.

Explore →
Part 2b

Calculus via Differentials

Minka's differential approach: work with $d\mathbf{X}$ instead of partial derivatives. Cleaner, more mechanical, and less error-prone.

Explore →
Part 3

AD: Introduction

The tape, forward vs reverse, and why AD gives exact derivatives. Overview and comparison of both modes.

Discover →
Part 3b

Forward Mode AD

Dual numbers, tangent propagation, seed directions, and passes. Step through traced computations interactively.

Explore →
Part 3c

Reverse Mode AD

Adjoints, the backward pass, backpropagation, and a GCN example. How to differentiate millions of parameters in one pass.

Explore →
CS 520 · Spring 2026