Derivatives and optimisation
Be able to interpret the derivative as a slope, differentiate simple functions (polynomials), find a minimum by setting the derivative to zero, and understand the chain rule as "slope times slope".
Practise in Mattegrafen ↗ · Matematik 3cPractise in Mattegrafen ↗ · Deriveringsregler — potens, exponentialPrerequisites
Intuition
The derivative f'(x) is the slope of the curve at the point x. A positive derivative: the curve goes up. Negative: down. Zero: flat — a peak, a valley or a plateau.
If you are standing on a curve in fog and want to get down into the valley: feel the slope under your feet and walk in the direction that goes down. The derivative is that feeling. The whole of machine learning is built on walking down an error curve that way.
Formal
The rules you need:
- (xⁿ)' = n·xⁿ⁻¹, constants disappear, sums are differentiated term by term
- (c·f)' = c·f'
- The chain rule: if y = f(g(x)) then y' = f'(g(x)) · g'(x) — "outer slope times inner slope"
The minimum of f(x) = x² − 6x + 10: f'(x) = 2x − 6 = 0 ⇒ x = 3, f(3) = 1.
The chain rule on (3x + 1)²: the outer is u², the inner is 3x + 1. The derivative: 2(3x + 1) · 3 = 6(3x + 1).
The chain rule is all of backpropagation: a network is a long chain of functions, and the slope for a weight far back is the product of all the slopes along the way.
Mastery means
- Differentiates a polynomial and solves f'(x) = 0
- Applies the chain rule to a composite function
Sign in to do the exercises and build your mastery up.
Sources
Leads to
Part of the goals (31)
- Statistics for experiments
- The mathematics behind the models
- Classical ML for real
- Frontier Lab — an independent research project
- AI safety in practice
- Train an agent with reward
- Training neural networks for real
- Language models in practice
- Deep reinforcement learning
- Fine-tune a model with LoRA
- Train your first neural network
- Fine-tune and run your own models
- Multimodal systems
- Build a RAG system you can trust
- Generative models in depth
- Responsible AI in practice
- Build a voice interface
- Build a transformer from scratch
- Understand how generative AI works
- Image classification with convolutional networks
- Evals in practice
- Build an agent you can trust
- Build an NLP system end to end
- AI in production
- An AI service in operation
- Run models more cheaply: quantisation
- Build a memory system for an agent
- Build an AI service that survives production
- Reproduce a paper
- Interpreting a language model
- AI, ethics and society