Calculus & Gradients
Understand slopes, partial derivatives, the chain rule, and gradient descent through visual and coded experiments.
Concept overview
What this lesson will help you understand.
Gradients connect a model error to parameter updates and make optimization behavior explainable rather than magical.
Learn by doing
Explore the concept.
Make a prediction before changing a control. Run the experiment, explain what moved, and compare the result with the theory below.
Initializing Interactive Playground...
Complete lesson
Detailed concept deep dive.
Build intuition first, then work through implementation, mathematical derivations, failure analysis, and real system decisions.
7 guided chapters
Gradients connect a model error to parameter updates and make optimization behavior explainable rather than magical.
Before working through the formal derivations, connect the vocabulary to one small, concrete example. The goal is not to memorize definitions in isolation. It is to understand what each idea represents, which assumptions make it valid, and how the pieces relate to one another.
Ideas to understand
- Functions, slopes, derivatives, and local linear approximation
- Partial derivatives, gradients, directional derivatives, and chain rule
- Loss surfaces, learning rate, steps, and stopping criteria
Learn by doing
Make the idea concrete
Explain calculus and gradients with a concrete example and no unexplained jargon.
Try this
- Define “Functions, slopes, derivatives, and local linear approximation” in your own words, then annotate one concrete Calculus & Gradients input and output.
- Construct one valid case and one counterexample for “Partial derivatives, gradients, directional derivatives, and chain rule”; explain which assumption separates them.
- Predict how “Loss surfaces, learning rate, steps, and stopping criteria” will change one visible playground result, then test and record the before/after values.
Evidence of understanding
- You can explain the example without relying on jargon.
- You can name the assumptions and identify what would invalidate them.
- You can connect the example to at least one real ML use case.
What part of the Calculus & Gradients mental model still feels least intuitive, and what example would help clarify it?
Saved in your browser progress and included in exports.
Practice with code
Make the idea executable.
Complete the starter code, use progressive hints, and pass deterministic checks in the browser.
Runnable Python lab
Implement gradient descent and a gradient check
Minimize a simple quadratic and compare its analytical gradient with a centered finite-difference estimate.
Keep learning
Papers, standards, and practical references.
Start with the free primary sources. Books are included where a longer, connected treatment is worth the investment.
The Python Tutorial
The official, free introduction to Python syntax and core programming ideas.
Mathematics for Machine Learning
Free companion PDF covering linear algebra, calculus, probability, and optimization for ML.
CS231n Optimization Notes
Free course notes connecting gradients and optimization to neural-network training.
Test your understanding.
Answer explanations appear after every choice. Missed questions can be reviewed before a full retake.
Mastery requires 80% or higher.
Was this lesson helpful?
Your feedback helps us continuously improve the curriculum and interactive visualizations.