Math for Machine Learning: The Free Roadmap to the Math You Actually Need (2027)
A practical, free guide to math for machine learning: exactly which parts of linear algebra, calculus, probability, statistics, optimization and information theory you need for ML and deep learning, in what order to learn them, how long each takes, and the best free books, courses and videos for every topic. It is written for programmers and career switchers who want to understand machine learning math well enough to read papers and debug models, without doing a full math degree first.
Last reviewed: December 2026.
Table of contents
- How much math do you need?
- The roadmap at a glance
- Best picks (if you only use three resources)
- Stage 0: Pre-calculus refresher
- Stage 1: Linear algebra
- Stage 2: Calculus and multivariable calculus
- Stage 3: Probability
- Stage 4: Statistics
- Stage 5: Optimization
- Stage 6: Information theory
- Stage 7: Putting it together in ML books
- Topic-to-ML map
- Free books compared
- Video courses compared
- Exercises and projects
- Study plans (8 weeks, 4 months, 9 months)
- Common mistakes
- FAQ
- Where to go next
- Contributing
- License
How much math do you need?
It depends on what you want to do:
| Goal | Math needed | Rough time from high-school math |
|---|---|---|
| Use ML libraries well (applied ML, data science) | Vectors, matrices, derivatives as slopes, basic probability, descriptive statistics, evaluation metrics | 6 to 10 weeks |
| ML engineer who trains and debugs neural networks | Above + matrix calculus, chain rule/backpropagation, gradient descent variants, distributions, maximum likelihood, cross-entropy | 3 to 5 months |
| Read and implement research papers | Above + eigen/SVD decompositions, multivariate Gaussians, Bayesian inference, convex optimization basics, KL divergence | 6 to 9 months |
| ML research / theory | Above + real analysis, measure-theoretic probability, statistical learning theory, advanced optimization | Years; a math or CS graduate program helps |
The good news: most practical deep learning uses a small, repeated core. Matrix multiplication, the chain rule, gradients, probability distributions and log-likelihoods show up everywhere; you do not need to master every proof before building things.
The roadmap at a glance
| Stage | Topic | Time (8-10 h/week) | Must-know ideas |
|---|---|---|---|
| 0 | Pre-calculus refresher | 1-2 weeks | Functions, logs and exponentials, summation notation, sets |
| 1 | Linear algebra | 4-6 weeks | Vectors, dot products, matrix multiplication, linear maps, rank, eigenvectors, SVD, projections |
| 2 | Calculus + multivariable | 4-6 weeks | Derivatives, chain rule, partial derivatives, gradients, Jacobians, Hessians, Taylor approximation |
| 3 | Probability | 4-6 weeks | Random variables, common distributions, expectation, variance, conditional probability, Bayes’ rule, multivariate Gaussian |
| 4 | Statistics | 3-4 weeks | Estimators, maximum likelihood, bias-variance, confidence intervals, hypothesis tests, bootstrap |
| 5 | Optimization | 2-3 weeks | Gradient descent, SGD, momentum, Adam, convexity, Lagrange multipliers, regularization |
| 6 | Information theory | 1-2 weeks | Entropy, cross-entropy, KL divergence, mutual information |
| 7 | Integrate in ML books | ongoing | Derive linear regression, logistic regression, PCA, backprop, attention yourself |
You do not have to go strictly in order. A good pattern is to learn linear algebra and calculus in parallel, then probability and statistics, and to start an ML course after Stage 2 so you see why the math matters.
Best picks (if you only use three resources)
- Mathematics for Machine Learning by Deisenroth, Faisal and Ong (free PDF from the authors, Cambridge University Press). Written exactly for this purpose: linear algebra, analytic geometry, matrix decompositions, vector calculus, probability and optimization, then applies them to regression, PCA, Gaussian mixtures and SVMs. Best single book.
- 3Blue1Brown video series Essence of Linear Algebra, Essence of Calculus and Neural Networks. Best for intuition; watch these before or alongside any textbook.
- Harvard Stat 110 (Joe Blitzstein) with the free online book Introduction to Probability. Best probability course, with famous problem sets.
Add Khan Academy for any gaps in prerequisites.
Stage 0: Pre-calculus refresher
Why it matters for ML: logs turn products of probabilities into sums (log-likelihood), exponentials appear in softmax and sigmoid, and summation notation is how every loss function is written.
What to know:
- Functions, graphs, inverses and composition (f(g(x)) is what a neural network is).
- Exponentials and logarithms, and the rules log(ab) = log a + log b, log(a^b) = b log a.
- Sigma (∑) and product (∏) notation.
- Basic set notation and functions between sets.
Resources:
- Khan Academy: Algebra 2 and Precalculus (free).
- OpenStax Precalculus (free textbook, CC BY).
- Skim the notation used in chapters 2 and 5 of Mathematics for Machine Learning so later stages feel familiar.
Check yourself: can you simplify log(e^(2x) · e^3), and write the mean squared error of n predictions with ∑ notation?
Stage 1: Linear algebra
Why it matters for ML: data is stored as matrices (rows are examples, columns are features), every neural network layer is a matrix multiplication plus a nonlinearity, embeddings are vectors, attention is built from dot products, PCA is an eigendecomposition, and low-rank methods such as LoRA are matrix factorizations.
What to learn (in order)
- Vectors, addition, scaling, norms (L1, L2), dot product and cosine similarity.
- Matrices as linear transformations; matrix-vector and matrix-matrix multiplication; transpose.
- Systems of linear equations, Gaussian elimination, inverse, determinant (as volume scaling).
- Span, linear independence, basis, rank, column space and null space.
- Orthogonality, projections, least squares (this is linear regression).
- Eigenvalues and eigenvectors; diagonalization; symmetric matrices and the spectral theorem.
- Positive (semi)definite matrices (covariance matrices are one).
- Singular value decomposition (SVD) and low-rank approximation.
- Practical numerics: broadcasting, batched matrix multiplication, condition numbers.
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| 3Blue1Brown: Essence of Linear Algebra | Videos (~3 h) | Free | Start here. Geometric intuition for every core idea. |
| MIT 18.06 Linear Algebra (Gilbert Strang) | Full course | Free | The classic university course with lectures, problem sets and exams. |
| MIT 18.06SC (scholar version) | Self-paced course | Free | Same material packaged for self-study with recitation videos. |
| Introduction to Applied Linear Algebra (VMLS) by Boyd and Vandenberghe | Book | Free PDF | Best book for ML practitioners. Vectors, matrices, least squares, with data-fitting and classification applications. Julia and Python companions. |
| Linear Algebra Done Right by Sheldon Axler | Book | Free (open access, 4th edition) | Proof-based and elegant; for when you want deeper understanding. |
| Immersive Linear Algebra | Interactive book | Free | Interactive figures for building intuition. |
| MIT 18.065 Matrix Methods in Data Analysis, Signal Processing, and Machine Learning | Course | Free (book is paid) | Strang’s follow-up focused on SVD, low rank, and deep learning. |
| Khan Academy Linear Algebra | Videos + exercises | Free | Gentle pace with practice. |
| fast.ai Computational Linear Algebra | Notebooks | Free | Linear algebra through NumPy code and real applications. |
Best pick: 3Blue1Brown first, then VMLS for applied practice; add MIT 18.06 if you want the full university experience.
Exercises
- Implement matrix multiplication with loops, then compare with NumPy
@. Time both. - Solve linear regression with the normal equation, then with
np.linalg.lstsq, and explain why the second is preferred. - Compute PCA of a dataset using SVD (without
sklearn.decomposition.PCA) and plot the first two components. - Compress a grayscale image with a rank-k SVD and plot error vs k.
Stage 2: Calculus and multivariable calculus
Why it matters for ML: training a model means minimizing a loss function, and gradient descent needs the gradient of that loss with respect to millions of parameters. Backpropagation is just the chain rule applied efficiently on a computation graph.
What to learn
- Limits informally; the derivative as rate of change and as best linear approximation.
- Derivative rules: product, quotient, chain rule. Derivatives of exp, log, sigmoid, tanh.
- Integrals as areas and accumulations (needed for probability densities and expectations).
- Partial derivatives and the gradient; directional derivatives.
- Jacobian (vector-valued functions) and Hessian (second derivatives, curvature).
- Multivariable chain rule; computation graphs.
- Matrix calculus: derivatives of xᵀAx, ‖Ax − b‖², softmax and cross-entropy.
- Taylor series and linear/quadratic approximations (the basis of Newton’s method).
- Automatic differentiation: forward mode vs reverse mode.
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| 3Blue1Brown: Essence of Calculus | Videos | Free | Start here for intuition. |
| Khan Academy Calculus 1, 2 and Multivariable | Videos + exercises | Free | The multivariable unit (taught by Grant Sanderson) is ideal for gradients and Jacobians. |
| MIT 18.01SC Single Variable Calculus | Course | Free | Full self-study course. |
| MIT 18.02SC Multivariable Calculus | Course | Free | Gradients, optimization in several variables. |
| OpenStax Calculus Volumes 1-3 | Textbook | Free (CC BY-NC-SA) | Complete textbook with exercises and answers. |
| The Matrix Calculus You Need For Deep Learning by Terence Parr and Jeremy Howard | Article | Free | Best bridge from school calculus to neural network gradients. |
| Matrix Calculus for Machine Learning and Beyond (MIT 18.S096) | Course | Free | Treats derivatives as linear operators; excellent for autodiff understanding. |
| The Matrix Cookbook | Reference PDF | Free | Look-up table of matrix identities and derivatives. |
| Andrej Karpathy: The spelled-out intro to neural networks and backpropagation (micrograd) | Video | Free | Builds a tiny autodiff engine from scratch. |
Exercises
- Derive the gradient of mean squared error for linear regression by hand, then check it numerically with finite differences.
- Derive the gradient of softmax + cross-entropy and show it simplifies to (p − y).
- Implement a scalar autodiff engine (micrograd-style) and train a tiny MLP with it.
- Compute the Hessian of a two-variable function and classify its critical points.
Stage 3: Probability
Why it matters for ML: models output probabilities, losses are negative log-likelihoods, generative models (VAEs, diffusion, language models) are probability distributions, and uncertainty, sampling and Bayesian methods are all probability.
What to learn
- Sample spaces, events, axioms; counting basics.
- Conditional probability, independence, the law of total probability, Bayes’ rule.
- Discrete random variables: Bernoulli, binomial, categorical, Poisson, geometric.
- Continuous random variables: uniform, normal (Gaussian), exponential, beta, gamma.
- Expectation, variance, covariance, correlation; linearity of expectation.
- Joint, marginal and conditional distributions.
- The multivariate Gaussian and its covariance matrix (links back to linear algebra).
- Law of large numbers and the central limit theorem.
- Sampling methods: Monte Carlo estimates, importance sampling, an introduction to Markov chains and MCMC.
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| Harvard Stat 110 with Introduction to Probability (free online) by Blitzstein and Hwang | Lectures + book | Free | Best pick. Intuitive, story-driven, with hundreds of exercises and solutions to many. |
| MIT RES.6-012 Introduction to Probability by John Tsitsiklis | Course | Free | Rigorous, clear lectures with problem sets. |
| Seeing Theory | Interactive | Free | Visual, interactive introduction to probability and statistics from Brown University. |
| Khan Academy Statistics and Probability | Videos + exercises | Free | Gentle foundation. |
| Probability Theory: The Logic of Science by E. T. Jaynes | Book | Paid | Classic Bayesian perspective; advanced. |
| Probabilistic Machine Learning: An Introduction by Kevin Murphy | Book | Free PDF from author (MIT Press) | Probability chapters written specifically for ML. |
| Think Bayes by Allen Downey | Book | Free (CC license) | Bayesian statistics through Python code. |
Exercises
- Simulate the Monty Hall problem and the birthday problem with 100,000 trials.
- Use Bayes’ rule to compute the probability of disease given a positive test for different base rates, then explain why spam filters and medical tests have the same math.
- Sample from a 2D Gaussian with a given covariance using a Cholesky factor, plot it, and recover the covariance from the samples.
- Show the central limit theorem by averaging samples from an exponential distribution.
Stage 4: Statistics
Why it matters for ML: training is estimation, evaluation is inference, and A/B tests decide which model ships. Understanding variance, overfitting and uncertainty in metrics separates good practitioners from lucky ones.
What to learn
- Descriptive statistics, distributions of data, visualizing data.
- Estimators, bias, variance, mean squared error; the bias-variance tradeoff.
- Maximum likelihood estimation (MLE), and maximum a posteriori (MAP) as MLE plus a prior (regularization).
- Sampling distributions, standard errors, confidence intervals.
- Hypothesis testing, p-values, multiple comparisons, statistical power; A/B testing.
- Bootstrap and permutation tests.
- Linear and logistic regression from a statistical viewpoint.
- Cross-validation and why test sets must stay untouched.
- Basic Bayesian inference: priors, posteriors, conjugacy, credible intervals.
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| An Introduction to Statistical Learning (ISLR / ISLP) by James, Witten, Hastie, Tibshirani (and Taylor for the Python edition) | Book + videos | Free PDF from authors | Best pick to connect statistics with ML; R and Python editions. |
| OpenIntro Statistics | Book | Free PDF (pay what you want) | Clear intro to inference with exercises. |
| Think Stats by Allen Downey | Book | Free | Exploratory statistics through Python. |
| StatQuest with Josh Starmer | Videos | Free | Short, very clear explanations of statistical and ML concepts. |
| Statistical Rethinking by Richard McElreath | Lectures (book is paid) | Free lectures | The best course on Bayesian modeling and causal thinking. |
| The Elements of Statistical Learning by Hastie, Tibshirani, Friedman | Book | Free PDF | The advanced follow-up to ISL. |
| All of Statistics by Larry Wasserman | Book | Paid | Dense, fast tour of statistics for CS and ML students. |
Exercises
- Derive the MLE of a Gaussian’s mean and variance; show that MSE loss corresponds to a Gaussian likelihood.
- Bootstrap a 95% confidence interval for a classifier’s accuracy on a test set of 500 examples. How wide is it?
- Run an A/B test simulation where both variants are equal, and count how often p < 0.05 appears across 20 metrics.
- Fit polynomial regressions of increasing degree and plot training vs validation error to see the bias-variance tradeoff.
Stage 5: Optimization
Why it matters for ML: every training run is an optimization problem. Knowing how optimizers behave helps you choose learning rates, diagnose divergence, and understand why Adam, weight decay and learning-rate schedules work.
What to learn
- Gradient descent and the effect of the learning rate; convergence on a quadratic.
- Stochastic and mini-batch gradient descent.
- Momentum, Nesterov, RMSProp, Adam and AdamW.
- Convex sets and functions; why convex problems have no bad local minima.
- Constrained optimization: Lagrange multipliers, KKT conditions (needed for SVMs).
- Second-order methods: Newton’s method, quasi-Newton (L-BFGS).
- Regularization (L1, L2), early stopping, and learning-rate schedules (warmup, cosine decay).
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| Convex Optimization by Boyd and Vandenberghe | Book | Free PDF | The standard text; read chapters 1-5 and 9. |
| Stanford EE364A | Course | Free materials and lecture videos | The course that goes with the book. |
| Why Momentum Really Works (Distill) by Gabriel Goh | Interactive article | Free | Beautiful interactive explanation of momentum. |
| An overview of gradient descent optimization algorithms by Sebastian Ruder | Article | Free | Clear survey of SGD variants and Adam. |
| Dive into Deep Learning: Optimization Algorithms chapter | Book chapter | Free | Optimizers with runnable code. |
| Numerical Optimization by Nocedal and Wright | Book | Paid | Advanced reference on algorithms. |
Exercises
- Implement gradient descent, momentum and Adam from scratch on the Rosenbrock function and plot their paths.
- Find the largest learning rate that still converges on a quadratic and relate it to the Hessian’s largest eigenvalue.
- Solve a small constrained problem with Lagrange multipliers by hand, then verify with
scipy.optimize.
Stage 6: Information theory
Why it matters for ML: cross-entropy is the loss of nearly every classifier and language model, KL divergence appears in VAEs, knowledge distillation and RLHF, and perplexity is exponentiated cross-entropy.
What to learn
- Information content and entropy; bits vs nats.
- Cross-entropy and its link to negative log-likelihood.
- KL divergence: asymmetry, non-negativity, forward vs reverse KL.
- Mutual information and conditional entropy.
- Perplexity for language models.
Resources
| Resource | Type | Cost | Why |
|---|---|---|---|
| Information Theory, Inference, and Learning Algorithms by David MacKay | Book | Free PDF for on-screen viewing | Classic, ML-flavored, with lectures on the same site. |
| Visual Information Theory by Chris Olah | Article | Free | Best intuition for entropy, cross-entropy and KL. |
| Elements of Information Theory by Cover and Thomas | Book | Paid | The standard graduate reference. |
| Deep Learning book, chapter 3 | Book chapter | Free online | Probability and information theory in a few dense pages. |
Exercises
- Compute the entropy of a fair coin, a loaded coin and a fair die.
- Show numerically that minimizing cross-entropy between a fixed target and a model is the same as minimizing KL divergence.
- Compute the perplexity of a unigram language model on a short text.
Stage 7: Putting it together in ML books
Once the basics are in place, these free books use all of it and are where the math starts to pay off:
| Book | Level | Free? | Notes |
|---|---|---|---|
| Mathematics for Machine Learning | Beginner to intermediate | Free PDF | Part II derives linear regression, PCA, GMMs and SVMs. |
| Dive into Deep Learning (d2l.ai) | Beginner to intermediate | Free | Math appendix plus runnable PyTorch/JAX code for everything. |
| Understanding Deep Learning by Simon J. D. Prince | Intermediate | Free PDF from author | Clear modern treatment with notebooks; excellent figures. |
| Deep Learning by Goodfellow, Bengio, Courville | Intermediate | Free online | Part I is a compact math refresher for DL. |
| Deep Learning: Foundations and Concepts by Christopher and Hugh Bishop | Intermediate to advanced | Free online version | Modern, rigorous, includes transformers and diffusion. |
| Pattern Recognition and Machine Learning by Christopher Bishop | Advanced | Free PDF from Microsoft Research | Classic probabilistic ML. |
| Probabilistic Machine Learning (books 1 and 2) by Kevin Murphy | Advanced | Free PDFs | Encyclopedic reference. |
| Patterns, Predictions, and Actions by Hardt and Recht | Intermediate | Free | Concise, modern, with a strong statistical viewpoint. |
Challenge: by the end, derive each of these on paper: linear regression (normal equation), logistic regression gradient, PCA via eigendecomposition, backpropagation through a two-layer MLP, softmax cross-entropy gradient, and scaled dot-product attention with shapes.
Topic-to-ML map
| Math topic | Where it shows up in ML |
|---|---|
| Dot product, cosine similarity | Embeddings, semantic search, attention scores |
| Matrix multiplication | Every dense layer, attention, convolution (as im2col) |
| Eigendecomposition, SVD | PCA, spectral clustering, LoRA intuition, recommender systems |
| Norms | Regularization (L1 = sparsity, L2 = weight decay), gradient clipping |
| Chain rule, Jacobians | Backpropagation, autodiff |
| Gradients and Hessians | Optimizers, learning-rate choice, loss-landscape curvature |
| Bayes’ rule | Naive Bayes, Bayesian inference, posterior-based uncertainty |
| Gaussian distribution | Linear regression noise, weight initialization, VAEs, diffusion models |
| Categorical distribution + softmax | Classifiers, next-token prediction in LLMs |
| Maximum likelihood | Almost every loss function (MSE, cross-entropy) |
| KL divergence | VAEs, distillation, RLHF and DPO regularization |
| Expectation and sampling | Stochastic gradients, Monte Carlo, dropout, LLM sampling (temperature, top-p) |
| Convexity | Why linear and logistic regression are easy, and deep nets are not |
| Hypothesis testing, confidence intervals | Comparing models, A/B tests, benchmark noise |
Free books compared
| Book | Linear algebra | Calculus | Probability | Statistics | Optimization | Proofs | Best for |
|---|---|---|---|---|---|---|---|
| Mathematics for Machine Learning | Yes | Yes (vector calculus) | Yes | Some | Yes | Moderate | One-book overview |
| Introduction to Applied Linear Algebra (VMLS) | Yes | No | No | Some (least squares) | Some | Light | Practical linear algebra |
| Linear Algebra Done Right | Yes (deep) | No | No | No | No | Heavy | Mathematical maturity |
| Introduction to Probability (Blitzstein-Hwang, free online) | No | Uses it | Yes (deep) | Some | No | Moderate | Probability |
| ISLR / ISLP | No | No | Light | Yes | Light | Light | Statistics for ML |
| Convex Optimization | Uses it | Uses it | No | Some | Yes (deep) | Heavy | Optimization |
| Information Theory, Inference, and Learning Algorithms | No | Uses it | Yes | Bayesian | No | Moderate | Information theory |
Video courses compared
| Course | Length | Style | Best for |
|---|---|---|---|
| 3Blue1Brown series | Hours | Animated intuition | Everyone, first |
| MIT 18.06 | ~35 lectures | Chalkboard lectures | Thorough linear algebra |
| Harvard Stat 110 | ~35 lectures | Lectures + strategic practice | Probability |
| Mathematics for Machine Learning Specialization (Imperial College London, Coursera) | 3 courses | Short videos + Python quizzes | Guided path; audit free, certificate paid |
| Mathematics for Machine Learning and Data Science (DeepLearning.AI, Coursera) | 3 courses | Beginner-friendly + labs | Absolute beginners; certificate paid |
| Khan Academy | Self-paced | Exercises with instant feedback | Filling gaps |
| StatQuest | Short videos | Simple, step-by-step | Statistics and ML concepts |
Exercises and projects
Math sticks when you implement it. Build these in plain NumPy (no ML libraries) and compare against scikit-learn or PyTorch at the end:
- Linear regression three ways: normal equation, gradient descent, and SGD. Plot the loss curves. (Linear algebra, calculus, optimization.)
- Logistic regression from scratch on a binary dataset, with L2 regularization and a numeric gradient check. (Calculus, probability, MLE.)
- PCA and image compression using SVD on a face or MNIST dataset. (Linear algebra.)
- Naive Bayes spam classifier with Laplace smoothing. (Probability, Bayes’ rule.)
- Gaussian mixture model with EM, visualizing the ellipses at each iteration. (Probability, multivariate Gaussians, optimization.)
- A two-layer neural network with manual backprop trained on MNIST. (Matrix calculus.)
- Optimizer race: SGD, momentum, RMSProp, Adam on the same small network. (Optimization.)
- Bootstrap your model’s accuracy and report a confidence interval instead of one number. (Statistics.)
- Self-attention by hand: write scaled dot-product attention with shapes annotated and check against PyTorch. (Linear algebra, softmax.)
- Tiny language model: a character-level bigram model, then measure cross-entropy and perplexity. (Probability, information theory.)
Study plans (8 weeks, 4 months, 9 months)
Fast track: 8 weeks (applied ML)
| Week | Focus |
|---|---|
| 1 | 3Blue1Brown Essence of Linear Algebra; NumPy matrix practice |
| 2 | VMLS chapters on vectors, matrices, least squares |
| 3 | 3Blue1Brown Essence of Calculus; derivatives and chain rule |
| 4 | Khan Academy gradients; “The Matrix Calculus You Need For Deep Learning” |
| 5 | Probability basics (Seeing Theory, Stat 110 first lectures) |
| 6 | Distributions, expectation, Bayes’ rule |
| 7 | Statistics: MLE, bias-variance, cross-validation (ISL chapters 2 and 5) |
| 8 | Projects 1 and 2 from the list above |
Standard: 4 months (ML engineer)
- Month 1: Linear algebra (3Blue1Brown, VMLS or MIT 18.06 first half, MML book chapters 2-4).
- Month 2: Calculus and matrix calculus (Khan multivariable, MML chapter 5, MIT 18.S096 lectures), micrograd video.
- Month 3: Probability and statistics (Stat 110 core lectures, MML chapter 6, ISL chapters 2-6).
- Month 4: Optimization and information theory (MML chapter 7, Distill momentum, Visual Information Theory), projects 3 to 7.
Deep: 9 months (reading papers)
- Months 1-2: Full MIT 18.06 with problem sets; Axler chapters 1-7 for proofs.
- Months 3-4: Full single and multivariable calculus; MIT 18.S096 matrix calculus.
- Months 5-6: Full Stat 110 with the book’s exercises; MIT RES.6-012.
- Month 7: Statistics (ISL, then selected ESL chapters); Statistical Rethinking lectures.
- Month 8: Boyd and Vandenberghe chapters 1-5 and 9; MacKay chapters 1-8.
- Month 9: Understanding Deep Learning or Bishop’s Deep Learning; all ten projects; reproduce one paper’s derivations.
Common mistakes
- Waiting until you have “finished” math before touching ML. Start ML after the linear algebra and calculus basics; the motivation helps.
- Only watching videos. Intuition is not skill. Do exercises and implement things in code.
- Skipping probability. Many people over-study linear algebra and under-study probability, then struggle with losses, sampling and generative models.
- Getting stuck on proofs you do not need yet. Read for understanding first; return to proofs when a paper needs them.
- Memorizing formulas instead of shapes. In deep learning, writing the shape of every tensor catches most bugs.
- Using five resources for one topic. Pick one main resource per stage and use the others only for spots where you get stuck.
FAQ
Do I need math to learn machine learning? To use libraries, only a little. To understand why models work, debug training, or read papers, yes: linear algebra, calculus, probability and statistics are the core.
What is the most important math for machine learning? Linear algebra and probability are the two pillars, followed closely by multivariable calculus (for gradients) and statistics (for evaluation).
Can I learn math for machine learning for free? Yes. Every core topic here has an excellent free option: Mathematics for Machine Learning, VMLS, MIT OpenCourseWare, Harvard Stat 110, ISL and Boyd’s Convex Optimization are all legally free.
How long does it take to learn math for ML? About 2 months part time for applied ML basics, 4 months for confident ML engineering, and 6 to 9 months to read most papers comfortably.
Is Mathematics for Machine Learning (the book) good for beginners? It is great if you remember high-school algebra and some calculus. If not, do a few weeks of Khan Academy and 3Blue1Brown first.
Do I need real analysis or measure theory? Not for applied ML or ML engineering. They matter for theoretical research and some advanced probability.
Is calculus or linear algebra more important for deep learning? You need both, but you will use linear algebra every day (shapes, matrix products) while calculus is mostly handled by autodiff. Understanding the chain rule still matters for debugging.
What math do I need for LLMs and transformers? Matrix multiplication, softmax, dot-product attention, layer normalization (mean and variance), cross-entropy and perplexity, and basic sampling. Fine-tuning methods add low-rank factorization (LoRA) and KL divergence (RLHF, DPO).
I am bad at math. Can I still do ML? Yes. Most people who “are bad at math” had poor teaching or gaps in prerequisites. Start at Stage 0, go slowly, and code everything to make it concrete.
Should I learn math with Python? Yes. NumPy, Matplotlib and SymPy turn abstract ideas into experiments you can see. Many resources above (VMLS, Think Stats, Think Bayes, d2l.ai) are built around code.
Where to go next
- Start an ML course alongside or after Stage 2: fast.ai Practical Deep Learning (top-down) or Stanford CS229 materials (math-heavy).
- Read Understanding Deep Learning end to end with its notebooks.
- Watch Andrej Karpathy’s Neural Networks: Zero to Hero and redo every derivation.
- Pick a classic paper (for example the transformer paper, Attention Is All You Need) and write out every equation with tensor shapes.
Contributing
Contributions are welcome. Please:
- Add only resources that are legally free (hosted by authors, publishers or universities, or openly licensed) or clearly mark them as paid.
- Explain in one sentence why the resource is better than or different from what is already listed for that topic.
- Keep the stage structure; add exercises that can be done with NumPy alone.
- Report broken links in an issue.
License
Content is licensed under CC BY 4.0.
If this helped you, a star helps others find it.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.