Phase 01: Math Foundations

Calculus for Machine Learning

Derivatives tell you which way is downhill. That is all a neural network needs to learn. Language: Python Compute numerical and analytical derivatives for common ML functions (x^2, sigmoid, cross-entropy). Implement gradient descent from scratch to minimize a loss function in 1D and 2D. Derive the gradient of a linear regression model and train it via manual weight updates. Explain the Hessian matrix, Taylor series approximations, and their connection to optimization methods. You have a neural network with millions of weights. Each weight is a knob. You need to figure out which direction to turn every single knob to make the model slightly less wrong. Calculus gives you that direction. Without calculus, training a neural network would mean trying random changes and hoping for the best. With derivatives, you know exactly how each weight affects the error. You turn every knob the right way, every time. A derivative measures the rate of change. For a function y = f(x), the derivative f'(x) tells you: if you nudge x by a tiny amount, how much does y change? Geometrically, the derivative is the slope of the tangent line at a point. f(x) = x^2: At x=2, the slope is 4. If you move x a tiny bit to the right, y increases by about 4 times that amount. At x=0, the…

Calculus for Machine Learning: Derivatives tell you which way is downhill. That is all a neural network needs to learn. Language: Python

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.