Skip to content

Module 02

Anurag Prasad edited this page Nov 7, 2026 · 9 revisions

Module 02: Calculus, Multivariable Calculus and Matrix Differentiation

Level: Foundation
Status: Introductory technical chapter with supporting lessons and learning resources

Module purpose

This module is a self-contained learning unit within the larger Deep Learning curriculum. Its purpose is to build understanding from motivation and prerequisites through mathematical reasoning, implementation and critical evaluation.

Introduction and conceptual foundation

Training a neural network requires understanding how a small parameter change affects a loss. Calculus supplies derivatives; multivariable calculus extends this idea to gradients, Jacobians and Hessians. The chain rule is the mathematical basis of backpropagation and automatic differentiation.

How the ideas develop

Study limits and single-variable derivatives before partial derivatives and vector-valued functions. Learn gradient and Jacobian shapes, then Hessian curvature and computational graphs. Verify derivatives numerically with finite differences.

What the reader should be able to explain

By the end of this module, a reader should be able to define its central objects, explain the motivation behind its main methods, interpret the governing equations, work through a small example, and identify assumptions and limitations. The goal is understanding the mechanism—not memorizing a list of terms.

Learning outcomes

  • Distinguish derivative, gradient, Jacobian and Hessian.
  • Apply chain rule to a computational graph.
  • Explain reverse-mode differentiation.

Prerequisites and connections

Module 01 provides the vector, matrix and tensor notation used in derivatives.

Useful background

Where these ideas are used next

Navigation

Focused submodules and topic extensions

The pages below provide focused treatments of substantial concepts that benefit from a separate explanation.

Topic-wise lessons

  1. Module-02-Lesson-01
  2. Module-02-Lesson-02
  3. Module-02-Lesson-03
  4. Module-02-Lesson-04
  5. Module-02-Lesson-05
  6. Module-02-Lesson-06
  7. Module-02-Lesson-07
  8. Module-02-Lesson-08
  9. Module-02-Lesson-09
  10. Module-02-Lesson-10

How to complete this module

  1. Study the lessons in prerequisite order.
  2. Write a notation sheet and derive central equations.
  3. Solve at least one hand-worked example per major mechanism.
  4. Implement core operations where appropriate.
  5. Verify outputs and gradients.
  6. Complete conceptual and coding exercises.
  7. Record limitations and research extensions.

Completion status

  • Conceptual understanding
  • Mathematical derivations
  • Worked numerical examples
  • NumPy implementation (where applicable)
  • PyTorch implementation (where applicable)
  • Tests and numerical verification
  • Experiments and interpretation
  • Revision and self-assessment

Technical chapter

1. Why this area matters

Calculus explains how changing parameters changes a model's output and loss. Neural-network training uses derivatives of scalar objectives with respect to millions of parameters. Matrix calculus provides a compact notation for these derivatives and makes vectorized backpropagation possible.

2. Core mathematical formulation

For a scalar function $f:\mathbb{R}^n\to\mathbb{R}$, the gradient is

$$ \nabla_x f = \begin{bmatrix} \partial f/\partial x_1 & \cdots & \partial f/\partial x_n \end{bmatrix}^{\top}. $$

For a vector function $f:\mathbb{R}^n\to\mathbb{R}^m$, the Jacobian is $J_{ij}=\partial f_i/\partial x_j$. The Hessian of a scalar function is $H_{ij}=\partial^2 f/\partial x_i\partial x_j$.

The chain rule for $z=f(y)$ and $y=g(x)$ is $$ \frac{dz}{dx}=\frac{dz}{dy}\frac{dy}{dx}. $$

3. Worked reasoning example

For $f(w)=\frac12(w-3)^2$, the derivative is $f'(w)=w-3$. At $w=1$, the gradient is -2. A small gradient-descent step with learning rate 0.1 gives $w_{new}=1-0.1(-2)=1.2$, which moves toward the minimizer 3.

4. Conceptual flow

flowchart TD
  A[Input x] --> B[y = g(x)]
  B --> C[z = f(y)]
  C --> D[Compute dz/dy]
  D --> E[Compute dy/dx]
  E --> F[Multiply local derivatives]
Loading

5. Implementation and verification

Verify derivatives using finite differences: compare an analytic directional derivative with [f(x+h v)-f(x-h v)]/(2h). Use float64 for gradient checks and avoid testing at non-differentiable points unless using subgradient conventions.

6. Common failure modes and misconceptions

A gradient is a vector, not a scalar derivative. Jacobian orientation depends on numerator/denominator layout conventions; state the convention. Finite differences are sensitive to step size. Automatic differentiation computes derivatives of the implemented computation graph, not necessarily of the mathematical function you intended.

7. Advanced and research directions

Study vector-Jacobian products, Jacobian-vector products, reverse-mode and forward-mode automatic differentiation, Hessian-vector products and implicit differentiation.

8. Suggested practical assignment

  1. Reproduce the smallest mathematical example by hand.
  2. Implement the central operation using NumPy.
  3. Implement the same operation using PyTorch.
  4. Compare outputs and gradients with numerical tolerances.
  5. Change one assumption or hyperparameter and document what changes.
  6. Record environment, random seed, data split, compute budget and limitations.

9. Completion criteria

  • Explain the motivation and assumptions without notes.
  • Derive the principal equations and define every symbol.
  • Complete at least one worked numerical example.
  • Trace tensor shapes through the computation.
  • Implement and test the central mechanism.
  • Explain at least two failure modes.
  • Read one primary paper and summarize its contribution and limitations.

Content status: This page now contains a technical chapter and a practical learning specification. The linked lesson pages provide focused subtopic treatment; experiments are not claimed complete until their result logs are added.

🎓 Deep Learning Hub

🏠 Home · 🗺️ Curriculum · 🧭 Learning paths

❓ Question bank · 📖 Glossary · 📚 References

Jump to module:

01 02 03 04 05 06 07 08 09 10 11 12

13 14 15 16 17 18 19 20 21 22 23 24

Part 1 · Mathematical foundations
Part 2 · Neural network fundamentals
Part 3 · Training deep networks
Part 4 · Core architectures
Part 5 · Representation and generative learning
Part 6 · Specialised, modern and responsible deep learning
Reference and meta

Clone this wiki locally