Skip to content

2100: Calculus for Deep Learning

⏱ 6 min read·📅 Last updated: 2026-10-22

Build the mathematical engine of deep learning — tensor algebra by hand in PyTorch, then the chain rule as a computational graph you can differentiate.


Contents


Module Overview

This module covers the essential calculus concepts that power modern deep learning systems. From tensor algebra through backpropagation to loss-landscape geometry, you'll build the mathematical foundation needed to understand how neural networks learn.

Why This Matters:

  • Every neural network training run relies on gradient descent and backpropagation
  • Understanding derivatives enables you to debug optimization problems
  • Tensor operations are the building blocks of all modern ML frameworks
  • Strong calculus intuition helps with model architecture design

Learning Objectives

After completing this module, you will be able to:

  • Tensor Operations: Manipulate multi-dimensional arrays and understand broadcasting
  • Automatic Differentiation: Grasp how frameworks compute gradients automatically
  • Backpropagation: Derive and implement the backward pass for neural networks
  • Optimization Intuition: Understand gradient flow, vanishing/exploding gradients
  • Chain Rule Mastery: Apply chain rule to complex computational graphs
  • Loss Landscape Geometry: Read curvature, saddles, and convexity off the Hessian

Module Contents

Each lesson is written around runnable code — work through the examples, don't just read them.

Lesson 2101 — Tensors, the Language of Deep Learning

2101: Tensor Algebra and Linear Algebra for AI

  • Tensor shapes and operations (element-wise, matrix multiplication, broadcasting)
  • Einstein summation — from dot products to scaled dot-product attention in one notation
  • Reductions, SVD/PCA, reshaping, slicing, and memory layout
  • GPU tensors, tensor cores, and mixed precision
  • AI patterns: linear layers, convolution as einsum, layer normalization

Lesson 2102 — The Backpropagation Engine

2102: Backpropagation and Automatic Differentiation

  • Chain rule for scalars and tensors, forward and backward passes on computational graphs
  • How PyTorch autograd works under the hood
  • Common gradient patterns (linear layer, ReLU, softmax + cross-entropy)
  • Vanishing and exploding gradients — and the standard fixes
  • Hessians, gradient accumulation, and best practices (zeroing, inference mode, checkpointing)

Lesson 2103 — Reading the Loss Landscape

2103: Loss Landscape Geometry

  • The Hessian's diagonal entries as curvatures — sign patterns that classify minima, maxima, and saddles
  • The flat-direction trap: GD escapes the saddle in 25 steps while the flat axis needs 1,151 steps to fall to a tenth
  • Why high dimensions are saddle country — the sign-sampling counting argument
  • Convexity, tested pointwise: when any local minimum is the global answer
  • The optimizer campaign: momentum as inertia, carrying 28 of 495 shallow-basin starts into the deep well

Learning Path

  1. Verify readiness with 2100: Calculus for Deep Learning - Prerequisites
  2. 2101: Tensor Algebra and Linear Algebra for AI — shapes, broadcasting, einsum, GPU tensors
  3. 2102: Backpropagation and Automatic Differentiation — chain rule, autograd, the backward pass
  4. 2103: Loss Landscape Geometry — curvature, saddles, convexity, momentum
  5. Check understanding with the 2100: Calculus - Quiz
  6. Apply it with the 2100: Calculus - Practice exercises

Prerequisites

Required:

  • Vectors and matrices — dot products and matrix multiplication at the by-hand level
  • Derivatives and the chain rule — single-variable calculus is enough to start
  • Python programming fundamentals, ideally with some NumPy

Helpful:

  • A CUDA GPU for the 2101 GPU sections — every code example runs on CPU, and the GPU blocks are clearly marked and optional
  • PyTorch installed — 2101 starts tensor knowledge from zero

Review: 2100: Calculus for Deep Learning - Prerequisites for detailed requirements with runnable self-check examples.


Assessment

Knowledge Check

Practice Exercises

  • Format: Hands-on coding exercises
  • Duration: 2-3 hours
  • Topics:
    • Compute derivatives analytically and with autograd
    • Run gradient descent in 1D and 2D
    • Apply the chain rule to composite functions
  • Location: 2100: Calculus - Practice


Time Commitment

Activity Time
Reading (2101) 2 hours
Experiments (2101) 2 hours
Reading (2102) 2 hours
Experiments (2102) 2 hours
Reading (2103) 2 hours
Experiments (2103) 2 hours
Quiz 1 hour
Practice 2-3 hours
Total 15-16 hours

Resources

Essential Reading:

  • Mathematics for Machine Learning (Deisenroth, Faisal & Ong) — free PDF; the linear algebra and vector calculus chapters map directly onto this module
  • Deep Learning (Goodfellow, Bengio & Courville) — Chapter 2 (Linear Algebra), free to read online
  • CS231n Notes (Stanford) — "Backpropagation, Intuitions" and the gradient-check walkthroughs

Optional:


Tips for Success

  1. Don't skip the math: Understanding derivatives helps debug models
  2. Implement from scratch: Build a simple autograd before trusting frameworks
  3. Visualize gradients: Print shape and value at every stage of a backward pass
  4. Practice chain rule: It's the foundation of backpropagation
  5. Connect to code: Map every equation to a PyTorch operation and run it

Common Pitfalls

  1. Getting lost in notation: Focus on concepts, not just symbols
  2. Ignoring dimensionality: Always track tensor shapes during operations
  3. Skipping manual implementation: Using frameworks too early limits understanding
  4. Not checking gradients: Verify autograd against finite differences when debugging

Summary

  • This module is the mathematical core of Phase 2: tensor algebra first, then backpropagation — closed by a quiz and hands-on practice.
  • Everything is runnable: each lesson's examples execute offline on CPU with PyTorch, GPU sections marked and optional.
  • Plan for 15-16 hours (12 hours lessons + 1 hour quiz + 2-3 hours practice).
  • These three lessons are the prerequisite chain for the rest of Phase 2: 2200 implements what 2101 explains, 2300 engineers what 2102 derives, and every optimizer they run walks the landscapes 2103 maps.

References

External References


Next Steps

  1. Not reviewed yet? Start with 2100: Calculus for Deep Learning - Prerequisites and run its self-check examples.
  2. Work the lessons in order: 2101: Tensor Algebra and Linear Algebra for AI → 2102: Backpropagation and Automatic Differentiation → 2103: Loss Landscape Geometry - Curvature, Saddles, and the Shape of Optimization — each builds on the previous one.
  3. Close the loop: take the quiz, then the practice exercises.
  4. Continue to the next module: 2200: Deep Learning Frameworks

Related: 2101: Tensor Algebra and Linear Algebra for AI · 2102: Backpropagation and Automatic Differentiation · 2103: Loss Landscape Geometry · 2200: Deep Learning Frameworks

Experiment: No EXP_21xx overview exists — start from EXP_2101: Tensor Algebra (the hands-on companion to Lesson 2101).