Maths for Machine Learning
The vectors, matrices, derivatives and probability that every machine learning course assumes you already have.
About this track
Almost every machine learning explanation stops to say "recall that the gradient points uphill" or "this is just a dot product" and moves on. This track is where you go to actually see those things, one at a time, with something you can drag.
It starts at the equation of a line and works up through vectors, matrix multiplication, derivatives and probability distributions. Nothing here assumes a maths degree, and nothing is left as an exercise for the reader.
The order matters more here than anywhere else on the site. Each page is built only from ideas introduced before it, so the track can be read straight through without ever hitting a symbol that has not been explained.
What you will be able to do
- Read a vector as both a list of numbers and a direction, and say what a dot product measures.
- Multiply matrices by hand, and explain why the inner dimensions have to agree.
- Interpret a derivative as a slope and a gradient as the direction of steepest increase.
- Tell a probability distribution from a likelihood, and read what a standard deviation claims.
- Recognise these objects when they appear unannounced in a machine learning paper.
How the track is ordered
Start at the equation of a line, because every later idea is a generalisation of it: a slope becomes a gradient, a line becomes a plane, and a coefficient becomes a weight. From there the track splits into three strands that meet at the end - linear algebra (vectors, dot products, matrices as transformations), calculus (derivatives, partial derivatives, the chain rule), and probability (distributions, expectation, Bayes). Nothing assumes a maths degree. If you can rearrange an equation and read a graph, you have the prerequisites.
Where this leads
Once the gradient and the dot product are familiar, the machine learning and deep learning tracks stop being notation and start being mechanisms. Gradient descent is a derivative followed downhill; a neuron is a dot product with a bias. Most people find those tracks considerably easier after this one, which is why it is first on the learning path.
All 47 modules, in teaching order
- 01Equation of a Line (y = mx + c)Learn the equation of a line using an interactive 2D and 3D visualizer. Understand slope and intercept with real examples, live calculations, and guided practice.
- 02LogarithmsInteractive logarithms lesson - explore log curves for any base, the product-to-sum rule, and why log scales tame huge ranges.
- 03ExponentialsInteractive exponentials lesson - growth versus decay, the number e, doubling time, and why exponential always beats polynomial eventually.
- 04Vectors and the Dot ProductInteractive lesson on vectors and the dot product - drag vectors, see magnitude, angle, projection, and why the dot product changes sign at 90 degrees.
- 05Vector NormsThree answers to how big a vector is. See why the L1 diamond's corners make Lasso produce exact zeros while the L2 circle only shrinks.
- 06Distance MetricsFour answers to how far apart two points are. Watch cosine ignore length entirely while Euclidean, Manhattan and Chebyshev disagree by shape.
- 07Matrix MultiplicationInteractive matrix multiplication - click an output cell to see the row and column that produce it, with the shape rule enforced live.
- 08A Matrix is a TransformationDrag four numbers and watch space rotate, stretch and shear. The columns are where the basis vectors land, and the determinant is the area they span.
- 09ProjectionsDrag one vector onto another and watch its shadow, plus the perpendicular residual left behind. The geometric root of least squares.
- 10DeterminantThe determinant is the area the unit square becomes. Sweep it through zero and watch the plane flatten, then turn itself inside out.
- 11Identity, Inverse and TransposeApply a transformation, then undo it. Watch the undo fail the moment the determinant hits zero, and see why the transpose is not an undo at all.
- 12Rank and Linear IndependenceDrag two columns until one is a multiple of the other and watch the reachable plane collapse onto a line. That collapse is what rank counts.
- 13Eigenvalues and EigenvectorsSweep a vector around the circle and find the two directions a matrix does not rotate. Trace, determinant and the guarantee PCA is built on.
- 14Derivatives and SlopeInteractive derivatives lesson - drag a point along a curve, shrink the secant to a tangent, and see the limit definition of the derivative in action.
- 15The Chain RuleInteractive chain rule lesson - see how derivatives multiply through composed functions, and why this is exactly what backpropagation computes.
- 16Partial Derivatives and the GradientInteractive partial derivatives and gradient lesson - explore a 2D surface, see partial slopes along each axis, and the gradient arrow pointing uphill.
- 17Mean, Mode and MedianInteractive lesson on mean, mode and median - see how skew and outliers pull the three averages apart, and which one to trust.
- 18Mean, Variance and Standard DeviationInteractive lesson on mean, variance and standard deviation - drag data points, see deviations squared, sigma bands and z-scores computed live.
- 19Covariance and CorrelationStretch and tilt a point cloud. Covariance moves with the units, correlation does not, and neither notices a curve.
- 20Probability BasicsInteractive probability basics - sample spaces, events, AND vs OR, independence, and the law of large numbers demonstrated by simulation.
- 21Conditional ProbabilityConditioning does not change the outcomes, it discards them. Watch the sample space shrink, and see why P(A given B) is not P(B given A).
- 22Bayes' TheoremInteractive Bayes theorem lesson - the medical test paradox shown as a natural frequency grid, with adjustable base rate, sensitivity and specificity.
- 23The Normal DistributionInteractive normal distribution lesson - adjust mean and standard deviation, see the 68-95-99.7 rule, z-scores, and the central limit theorem by sampling.
- 24Maximum Likelihood EstimationSlide a candidate distribution over fixed data and watch the likelihood peak. Where squared error, log loss and cross-entropy all come from.
- 25Entropy and InformationDrag a distribution and watch uncertainty rise and fall. Entropy is the average surprise, and the quantity every classification loss is built from.
- 26Cross-Entropy and KL DivergenceDrag one distribution towards another and watch the gap close. Cross-entropy is the cost of being wrong; KL divergence is how much of it is your fault.
- 27Information GainMove a split through a dataset and watch entropy fall. The threshold that drops it most is exactly the question a decision tree decides to ask.
- 28Basis, Span and Orthogonality
- 29Singular Value Decomposition
- 30The Jacobian and the Hessian
- 31Convexity and Optimisation Landscapes
- 32Taylor Series
- 33Expectation and Variance
- 34Bernoulli, Binomial and Poisson
- 35The Central Limit Theorem
- 36Quantiles and Percentiles
- 37Sampling Distributions and Standard Error
- 38Confidence Intervals
- 39Hypothesis Testing and p-values
- 40Type I and Type II Errors
- 41QR Decomposition and Gram-Schmidt
- 42Cholesky and Positive-Definiteness
- 43Matrix Calculus
- 44Lagrange Multipliers
- 45Jensen's Inequality
- 46Markov Chains
- 47Combinatorics: Permutations and Combinations