Skip to the content.

Free Math Textbooks: The 2027 Guide to Free Math Books for Programmers and Machine Learning

A curated, opinionated list of free math textbooks for programmers, computer science students and anyone learning math for machine learning: discrete math, proofs, linear algebra, calculus, probability, statistics, optimization, information theory and the theory behind modern ML. Every book here is legally free, published by its authors, a university or an open-textbook project, so you can download the PDF or read it online without pirate sites.

Last reviewed: December 2026. “Free” means free to read online or download from an official source at the time of review. Many of these books are also sold in print; if one changes your life, buying a copy supports the author.


Table of Contents


Who This Is For

You do not need all of these books. Pick one per subject, finish it, do the exercises.

How to Use This List

Each entry follows the same shape:

Symbols used: ⭐ = the best pick in its section. 💲 = paid book mentioned only for context (the free alternatives are listed first).


Quick Picks: One Book per Subject

If you only want one free book per subject, take these:

Subject Best free pick Why
Proofs Book of Proof Gentle, complete, full of exercises, ideal first proof book
Discrete math for CS Mathematics for Computer Science Written for MIT’s 6.042 course, covers exactly what CS needs
Linear algebra (intuition + computation) Introduction to Applied Linear Algebra (VMLS) Vectors, matrices and least squares with applications, no fluff
Linear algebra (theory) Linear Algebra Done Right The standard proof-based text, now open access
Calculus OpenStax Calculus, Volumes 1 to 3 Full university calculus sequence, peer reviewed
Probability Introduction to Probability (Stat 110 book) Story proofs and intuition from a famous Harvard course
Statistics OpenIntro Statistics Clear, modern intro used in many colleges
Bayesian stats Bayes Rules! Friendly, code-first, free online
Optimization Convex Optimization The reference for convex problems in ML and engineering
Information theory Information Theory, Inference, and Learning Algorithms Connects coding, inference and neural networks
Math for ML Mathematics for Machine Learning Linear algebra, calculus, probability and optimization in one book, aimed at ML

Roadmaps

Time estimates assume about 6 to 8 focused hours a week. Double them if you do every exercise, halve them if you already know part of the material.

Roadmap A: Math for Software Engineers (about 4 months)

Goal: be comfortable with proofs, big-O reasoning, combinatorics, graphs and basic probability, the math behind algorithms and system design.

Stage Weeks Read Do
1. Logic and proofs 3 Book of Proof, Parts I and II Prove 20 small statements by induction and contradiction
2. Discrete math core 6 Mathematics for Computer Science, Parts I to III Solve recurrences, count graphs, analyze loops
3. Probability for programmers 4 Mathematics for Computer Science, Part IV Simulate the birthday paradox and hashing collisions in code
4. Linear algebra basics 3 VMLS, Chapters 1 to 10 Implement vector and matrix ops without libraries

Roadmap B: Math for Machine Learning (about 6 to 9 months)

Goal: read ML papers and textbooks (for example Deep Learning or Pattern Recognition and Machine Learning) without getting stuck on the math.

Stage Weeks Read Do
0. Refresh algebra and functions 2 to 4 OpenStax College Algebra or Precalculus (only weak spots) Khan Academy unit tests until you pass
1. Linear algebra 6 to 8 VMLS, then Mathematics for Machine Learning Chapters 2 to 4 Implement least squares, PCA via SVD with NumPy
2. Calculus 6 to 8 OpenStax Calculus Vol. 1 (derivatives, integrals), Vol. 3 (partial derivatives, gradients) Derive gradients for linear and logistic regression by hand
3. Matrix calculus 2 The Matrix Calculus You Need for Deep Learning Write backprop for a 2-layer network from scratch
4. Probability 6 to 8 Introduction to Probability (Stat 110 book), Chapters 1 to 7 Simulate every distribution you meet; check against formulas
5. Statistics 4 to 6 OpenIntro Statistics, then Think Stats Run a real A/B test analysis on a public dataset
6. Optimization 3 to 4 Mathematics for Machine Learning Ch. 7, then Convex Optimization Ch. 1 to 5 (skim) Implement gradient descent, momentum, Adam on a toy problem
7. Glue it together 2 to 4 Mathematics for Machine Learning Part II Re-derive linear regression, PCA, GMMs and SVMs from the book

Roadmap C: Theory Track for ML Research (12+ months)

Goal: read and write theory papers.

  1. Proof fluency (2 months): Book of Proof, then Basic Analysis Volume I.
  2. Rigorous linear algebra (2 months): Linear Algebra Done Right.
  3. Measure-light probability (2 months): Probability: Theory and Examples (first chapters), with the Stat 110 book as a companion.
  4. Convex optimization (2 months): Convex Optimization, Parts I and II, with exercises.
  5. High-dimensional probability (2 months): High-Dimensional Probability.
  6. Learning theory (2+ months): Understanding Machine Learning: From Theory to Algorithms, then Learning Theory from First Principles.

Stage 0: Refreshers (Algebra, Precalculus)

If fractions, exponents, logarithms or trigonometry feel shaky, fix them first. It saves weeks later.

Proofs and Logic

Proofs are the skill that unlocks every advanced book on this page. Spend time here even if you “just want ML”.

Discrete Mathematics

The math of algorithms: counting, recurrences, graphs, number theory and discrete probability.

Combinatorics and Graph Theory

Linear Algebra

The single most important subject for ML, graphics, robotics and scientific computing. Two tracks: applied (compute and use) and theoretical (prove and understand). Most programmers should start applied.

Applied and computational

Proof-based

Reference

Calculus

Matrix Calculus and Differentiable Programming

This is the calculus of deep learning: gradients of vector and matrix functions, the chain rule in many dimensions, automatic differentiation.

Real Analysis

Needed for research-level probability, optimization and learning theory, not for applied ML.

Probability

Statistics

Bayesian Statistics

Causal Inference

Optimization

Numerical Methods

How math meets floating point: stability, conditioning, solving linear systems, ODEs.

Information Theory

Number Theory and Abstract Algebra (for Cryptography)

Math for Machine Learning (All-in-One Books)

Learning Theory and High-Dimensional Probability


Free Courses and Videos That Pair Well

Subject Course or channel Pair with
Linear algebra MIT 18.06 Linear Algebra (OCW) VMLS or Interactive Linear Algebra
Linear algebra intuition 3Blue1Brown: Essence of Linear Algebra Any linear algebra book, watch first
Single-variable calculus MIT 18.01SC OpenStax Calculus Vol. 1
Multivariable calculus MIT 18.02SC OpenStax Calculus Vol. 3
Discrete math MIT 6.042J Mathematics for Computer Science
Probability Harvard Stat 110 Introduction to Probability (Stat 110 book)
Probability and statistics MIT 18.05 OpenIntro Statistics
Mathematical statistics MIT 18.650 StatLect
Statistics intuition StatQuest (YouTube) ISL
Bayesian modeling Statistical Rethinking lectures Bayes Rules!

More open textbooks: the American Institute of Mathematics open textbook list and the Open Textbook Library both review and catalog free, openly licensed math books.


Comparison Tables

Linear algebra: which free book?

Book Style Proofs Code Length Best for
VMLS Applied Few Julia/Python companions ~470 pp Programmers, ML beginners
Interactive Linear Algebra Geometric Some Applets Medium Visual intuition
Understanding Linear Algebra Activity-based Some Sage cells Medium Self-study with practice
Hefferon First proof course Yes No ~500 pp Math-curious engineers
Linear Algebra Done Right Abstract Yes No ~390 pp Theory, research
Mathematics for ML (Part I) ML-focused Light No 3 chapters Fast ML prep

Probability: which free book?

Book Level Strength Weakness
Stat 110 book Beginner to intermediate Intuition, story proofs, great problems Online only, not downloadable
Grinstead and Snell Beginner Free PDF, simulations Older style
Pishro-Nik Beginner to intermediate Random processes, solved problems Less narrative
Chan Intermediate Written for data science, Python Long
Durrett Advanced Rigor, measure theory Hard first book

Statistics: which free book?

Book Approach Language Best for
OpenIntro Statistics Classical None required (R labs available) First course
Introduction to Modern Statistics Simulation-first R Modern intro
Think Stats 3e Computational Python Programmers
ISL Statistical learning R or Python Moving into ML

Practice: Exercises and Projects

Reading without doing is the most common reason people “finish” a math book and remember nothing. Try these projects, each tied to a section above:

  1. Proof journal. Each week write up three proofs in LaTeX or Markdown. Use Book of Proof exercises.
  2. Big-O from scratch. Derive the running time of merge sort and binary search with recurrences (MCS Chapter on recurrences), then measure them in code and plot.
  3. Hash collision simulator. Compute the birthday-bound probability analytically, simulate it, and compare.
  4. Mini NumPy. Implement vector add, dot product, matrix multiply, transpose and Gaussian elimination in pure Python. Test against NumPy.
  5. Least squares house prices. Fit a linear model with normal equations and with QR, compare numerical stability (VMLS + Fundamentals of Numerical Computation).
  6. PCA on images. Compute an SVD of a small image dataset and reconstruct images with k components.
  7. Gradient checker. Derive gradients for logistic regression by hand, then verify with finite differences.
  8. Backprop by hand. Implement a two-layer neural network forward and backward pass using only NumPy and the matrix calculus guide.
  9. Distribution zoo. For each distribution in the Stat 110 book, sample 100,000 values and compare histograms with the PDF.
  10. A/B test analysis. Analyze a public A/B test dataset with both a frequentist test and a Bayesian model (OpenIntro + Bayes Rules!).
  11. Optimizer race. Implement gradient descent, momentum and Adam on the Rosenbrock function and plot the paths.
  12. Entropy coder. Implement Huffman coding and compare compressed size to the entropy bound (MacKay Chapter 5).
  13. Toy RSA. Implement modular exponentiation, extended Euclid and RSA with small primes (Shoup or Stein).
  14. Project Euler. Project Euler problems mix number theory, combinatorics and programming.

How to Study a Math Textbook


FAQ

What math do I need for machine learning? Linear algebra (vectors, matrices, eigenvalues, SVD), multivariable calculus (gradients, the chain rule), probability (distributions, expectation, Bayes’ rule) and some statistics and optimization. Mathematics for Machine Learning covers this list in one free book.

What math do I need for software engineering? For most jobs, discrete math (logic, sets, counting, graphs), big-O analysis and basic probability are enough. Graphics, games and ML need linear algebra; cryptography needs number theory.

Are these textbooks really free and legal? Yes. Every link points to the author’s site, a university, arXiv, OpenStax or another open-textbook project. If a link ever points to an unofficial copy, please open an issue.

Where can I find a free PDF of Linear Algebra Done Right? On the official site. The 4th edition is open access.

Is there a free version of Introduction to Probability by Blitzstein and Hwang? Yes, the authors provide a free online version at probabilitybook.net. It is read-online only.

What is the best free calculus textbook? OpenStax Calculus (Volumes 1 to 3) for a standard course; Active Calculus if you prefer activities; Calculus Made Easy if you are anxious about the subject.

Should I learn linear algebra or calculus first for ML? Linear algebra first. Most of ML is matrix operations, and you need only basic derivatives at the start.

How long does it take to learn math for machine learning? With 6 to 8 hours a week and some high school algebra, roughly 6 to 9 months to be comfortable (Roadmap B). You can start practical ML courses in parallel after the linear algebra stage.

Do I need proofs for ML engineering? Not to use libraries. You do need them to read theory papers, invent new methods, or work in research.

I’m bad at math. Can I still do this? Yes. Start with Stage 0, use Khan Academy for instant feedback, and choose the friendliest books (OpenStax, Interactive Linear Algebra, Think Stats). Progress comes from consistent practice, not talent.

Is Khan Academy enough? For refreshers and high school to early college level, it is excellent. For linear algebra, probability and beyond, pair it with a book from this list.

What is the difference between ISL and ESL? ISL is the applied introduction with labs; ESL is the denser, more mathematical graduate version from overlapping authors. Start with ISL.


Where to Go Next


Contributing

Suggestions are welcome. To add a book, open an issue or pull request with:

  1. The official link (author, university, publisher or open-textbook site only; no unofficial PDF mirrors).
  2. Level, format, and one honest sentence on who it is best for.
  3. Confirmation that it is free to read from that link today.

Please also report broken links and books that stopped being free.

License

This list is released under CC BY 4.0. The books belong to their authors and publishers and keep their own licenses.

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.