Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Mathematics of Machine Learning: Master linear algebra, calculus, and probability for machine learning
Purchase options and add-ons
Build a solid foundation in the core math behind machine learning algorithms with this comprehensive guide to linear algebra, calculus, and probability, explained through practical Python examples
Purchase of the print or Kindle book includes a free PDF eBook
Key Features
- Master linear algebra, calculus, and probability theory for ML
- Bridge the gap between theory and real-world applications
- Learn Python implementations of core mathematical concepts
Book Description
Mathematics of Machine Learning provides a rigorous yet accessible introduction to the mathematical underpinnings of machine learning, designed for engineers, developers, and data scientists ready to elevate their technical expertise. With this book, you’ll explore the core disciplines of linear algebra, calculus, and probability theory essential for mastering advanced machine learning concepts.
PhD mathematician turned ML engineer Tivadar Danka—known for his intuitive teaching style that has attracted 100k+ followers—guides you through complex concepts with clarity, providing the structured guidance you need to deepen your theoretical knowledge and enhance your ability to solve complex machine learning problems. Balancing theory with application, this book offers clear explanations of mathematical constructs and their direct relevance to machine learning tasks. Through practical Python examples, you’ll learn to implement and use these ideas in real-world scenarios, such as training machine learning models with gradient descent or working with vectors, matrices, and tensors.
By the end of this book, you’ll have gained the confidence to engage with advanced machine learning literature and tailor algorithms to meet specific project requirements.
What you will learn
- Understand core concepts of linear algebra, including matrices, eigenvalues, and decompositions
- Grasp fundamental principles of calculus, including differentiation and integration
- Explore advanced topics in multivariable calculus for optimization in high dimensions
- Master essential probability concepts like distributions, Bayes' theorem, and entropy
- Bring mathematical ideas to life through Python-based implementations
Who this book is for
This book is for aspiring machine learning engineers, data scientists, software developers, and researchers who want to gain a deeper understanding of the mathematics that drives machine learning. A foundational understanding of algebra and Python, and basic familiarity with machine learning tools are recommended.
Table of Contents
- Vectors and vector spaces
- The geometric structure of vector spaces
- Linear algebra in practice spaces: measuring distances
- Linear transformations
- Matrices and equations
- Eigenvalues and eigenvectors
- Matrix factorizations
- Matrices and graphs
- Functions
- Numbers, sequences, and series
- Topology, limits, and continuity
- Differentiation
- Optimization
- Integration
- Multivariable functions
- Derivatives and gradients
- Optimization in multiple variables
- What is probability?
- Random variables and distributions
- The expected value
- The maximum likelihood estimation
- It's just logic
- The structure of mathematics
- Basics of set theory
- Complex numbers
- ISBN-101837027870
- ISBN-13978-1837027873
- PublisherPackt Publishing
- Publication dateMay 30, 2025
- LanguageEnglish
- Dimensions7.5 x 1.65 x 9.25 inches
- Print length730 pages
Frequently bought together

Customers who viewed this item also viewed
- Machine Learning with PyTorch and Scikit-Learn: Develop machine learning and deep learning models with PythonPaperbackFREE Shipping by AmazonGet it as soon as Saturday, Sep 19
- Python Machine Learning By Example: Unlock machine learning best practices with real-world use casesPaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Saturday, Sep 19
- Essential Math for Data Science: Take Control of Your Data with Fundamental Linear Algebra, Probability, and StatisticsPaperbackFREE Shipping by AmazonGet it as soon as Saturday, Sep 19
- Deep Learning Math Workbook: 300 puzzles to build your mathematical foundation for deep learningPaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Saturday, Sep 19
- 50 Algorithms Every Programmer Should Know: Tackle computer science challenges with classic to modern algorithms in machine learning, software design, data systems, and cryptographyPaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Saturday, Sep 19
Customers also bought or read
- Python Machine Learning By Example: Unlock machine learning best practices with real-world use cases
Paperback$29.55$29.55Delivery Sat, Sep 19 - Graph Machine Learning: Learn about the latest advancements in graph data to build robust machine learning models
Paperback$38.54$38.54FREE delivery Sat, Sep 19 - Machine Learning with PyTorch and Scikit-Learn: Develop machine learning and deep learning models with Python#1 Best SellerSpeech & Audio Processing
Paperback$36.05$36.05FREE delivery Sat, Sep 19 - Hands-On Machine Learning with Scikit-Learn and PyTorch: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$77.72$77.72FREE delivery Sat, Sep 19 - Deep Reinforcement Learning Hands-On: A practical and easy-to-follow guide to RL from Q-learning and DQNs to PPO and RLHF
Paperback$32.75$32.75Delivery Sat, Sep 19 - Building AI Agents with LLMs, RAG, and Knowledge Graphs: A practical guide to autonomous and modern AI agents
Paperback$41.99$41.99FREE delivery Sat, Sep 19 - Machine Learning and Artificial Intelligence: Concepts, Algorithms and Models
Hardcover$98.88$98.88FREE delivery Sat, Sep 19 - Generative AI with Python and PyTorch: Navigating the AI frontier with LLMs, Stable Diffusion, and next-gen AI applications
Paperback$32.99$32.99Delivery Sat, Sep 19 - Mastering PyTorch: Create and deploy deep learning models from CNNs to multimodal models, LLMs, and beyond
Paperback$34.58$34.58Delivery Sat, Sep 19 - Build a Large Language Model (From Scratch)#1 Best SellerComputer Neural Networks
Paperback$49.24$49.24FREE delivery Sat, Sep 19 - LLM Design Patterns: A Practical Guide to Building Robust and Efficient AI Systems
Paperback$42.99$42.99FREE delivery Sat, Sep 19 - Generative AI with LangChain: Build production-ready LLM applications and advanced agents using Python, LangChain, and LangGraph
Paperback$41.99$41.99FREE delivery Sat, Sep 19 - Learn Model Context Protocol with Python: Build agentic systems in Python with the new standard for AI capabilities
Paperback$32.47$32.47Delivery Oct 3 - 14 - Math for Deep Learning: What You Need to Know to Understand Neural Networks
Paperback$35.48$35.48FREE delivery Sat, Sep 19 - Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition
Paperback$37.98$37.98FREE delivery Sat, Sep 19 - Linear Algebra for Data Science, Machine Learning, and Signal Processing
Hardcover$51.71$51.71FREE delivery Sun, Sep 20 - Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python
Paperback$47.60$47.60FREE delivery Sat, Sep 19 - Essential Math for Data Science: Take Control of Your Data with Fundamental Linear Algebra, Probability, and Statistics
Paperback$36.22$36.22FREE delivery Sat, Sep 19 - Hands-On Machine Learning with C++: Build, train, and deploy end-to-end machine learning and deep learning pipelines
Paperback$38.54$38.54FREE delivery Sat, Sep 19 - Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$49.50$49.50FREE delivery Sat, Sep 19 - Design Multi-Agent AI Systems Using MCP and A2A: Engineer your own Python-based agentic AI framework with tool use, memory, and multi-agent workflows
Paperback$41.79$41.79FREE delivery Sat, Sep 19 - Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications
Paperback$40.00$40.00FREE delivery Sat, Sep 19 - Why Machines Learn: The Elegant Math Behind Modern AI#1 Best SellerDiscrete Mathematics
Hardcover$18.13$18.13Delivery Sat, Sep 19 - Learn Python Programming: A comprehensive, up-to-date, and definitive guide to learning Python
Paperback$31.99$31.99Delivery Sat, Sep 19 - Agentic Coding with Claude Code: The everyday developer's guide to agentic coding with Claude Code
Paperback$36.33$36.33FREE delivery Sat, Sep 19 - An Introduction to Statistical Learning: with Applications in Python (Springer Texts in Statistics)
Hardcover$56.21$56.21FREE delivery Sep 29 - Oct 3 - The Hundred-Page Language Models Book: hands-on with PyTorch (The Hundred-Page Books)
Paperback$46.95$46.95FREE delivery Sat, Sep 19
From the Publisher
What was your motivation for writing this book?
When I started in machine learning, I saw most of my colleagues struggle with the basic mathematics behind neural network models. Even though they were great engineers, they made basic modeling mistakes, like using the mean-squared error for classification, having trouble fixing tensor shape mismatch errors, and similar things.
So, I started to educate them about fundamental mathematical topics, like how matrix multiplication works or what the mean-squared error and cross-entropy loss are. Soon, I realized that these intuitive explanations were also missing from the machine learning literature: most books either completely ignored the mathematics behind machine learning or were way too advanced to be useful.
Because of this, I started posting my explanations as Twitter threads, and they instantly became a smash hit. Soon, I had enough material for a book, and four years later, here we are with a ~770-page tome aiming to bring mathematics closer to machine learning professionals.
Why should ML professionals learn about the underlying mathematics?
Because mathematics is the language of machine learning!
Advanced machine learning libraries like PyTorch or scikit-learn hide most of the complexities from us; training a model can be as simple as calling the .fit method.
On the one hand, this is great! Abstracting the technical details away from the user makes it possible to build cutting-edge solutions in a matter of days. Lowering the barrier of entry is one of the reasons behind the explosion of AI we see today.
On the other hand, if one has to go beyond the ready-made solutions, a user-level understanding is not enough. To beat the state-of-the-art or build something novel, you can’t get away without looking under the hood. I own an old Volvo, and even though I love that car, I’m a frequent client at the car shop. My mechanic is really great at diagnosing rare problems. He can tell precisely what’s wrong by driving the car a couple of laps around the block.
Fluency in mathematics has a similar effect in machine learning.
How is this book different from other machine learning books?
Most books are either written from a purely practical or a purely theoretical perspective. In my experience, the learning curve is extremely steep for most theory-focused books. Even with a PhD in mathematics, there are textbooks where I get stuck in the first chapter, leaving the rest of the book inaccessible to me. I wanted to change that. So, I had three guiding principles in mind.
First, I wanted to “minmax” mathematics in the sense that the knowledge in the book should be maximally useful, but minimal in quantity.
Second, explanations should be intuitive and visual, leaning toward user-friendliness rather than mathematical precision. We have machine learning in mind, not mathematics.
Third, every concept and algorithm should be implemented from scratch in Python. This is essential to understanding mathematics. In the book, we learn NumPy along with the math, implementing algorithms such as the singular value decomposition or the omnipresent gradient descent.
Mathematics of Machine Learning
|
Machine Learning with PyTorch and Scikit-Learn
|
Python Machine Learning By Example
|
Mastering PyTorch: Create and deploy deep learning models from CNNs to multim...
|
Deep Learning Math Workbook
|
|
|---|---|---|---|---|---|
|
Add to Cart
|
Add to Cart
|
Add to Cart
|
Add to Cart
|
Add to Cart
|
|
| Customer Reviews |
4.4 out of 5 stars 121
|
4.6 out of 5 stars 527
|
4.9 out of 5 stars 78
|
4.2 out of 5 stars 62
|
4.2 out of 5 stars 29
|
| Topics / New Topics | Linear algebra, calculus, multivariable calculus, and probability theory | New content on transformers, gradient boosting, and GNNs | Revised with PyTorch builds, expanded best practices, and new content on LLMs and multimodal models | New content on diffusion models, recommender systems, mobile deployment, Hugging Face, and GNNs | Math puzzles to build strong foundation for deep learning |
| Reader Knowledge Level | Beginner to Intermediate | Beginner to Intermediate | Beginner to Intermediate | Intermediate to Advanced | Students and beginners |
| Technology Used | Matplotlib, NumPy, SciPy, scikit-learn | PyTorch, scikit-learn | PyTorch, TensorFlow, pandas, NumPy, scikit-learn | PyTorch | High school level Math |
Editorial Reviews
Review
“As a professor teaching AI, I’m always looking for resources that combine mathematical rigor with practical relevance—and Mathematics of Machine Learning delivers. I plan to assign several chapters as required readings in my AI course, especially those on linear algebra and multivariable calculus. Tivadar Danka does an excellent job connecting core mathematical concepts to real-world AI applications, with clear Python examples that make the material approachable. I also highly recommend this book to professionals looking to strengthen their mathematical foundation for AI through self-study—it’s both structured and accessible.”
Prof. Tom Yeh, University of Colorado Boulder, Host of AI by Hand
“Often, the biggest obstacle to real-world machine learning success is mastering the fundamental math. Tivadar Danka's Mathematics of Machine Learning removes that roadblock by means of exact explanations and practical exercises. Designed around useful case studies, ranging from vector spaces to the geometric interpretation of gradients, this book not only provides theorems but also prepares you to immediately apply them in production projects.”
Etibar Aliyev, Team Lead (AI) at Google
“Most books that claim to teach the math behind machine learning either oversimplify or drown you in abstraction. This one does neither. It’s precise where it matters, informal when it helps, and never loses sight of why the math exists in the first place.
No fluff, no cringe analogies - just clear thinking and beautifully structured exposition. You can tell the author has done the proofs and written the code.
Highly recommend it for anyone serious about understanding, not just using, ML.”
Mike Erlihson, PhD, Head of AI at Stealth Startup
“As someone who approached machine learning with a strong commitment to understanding the underlying mathematics, I quickly discovered how fragmented and inaccessible many resources were. Mathematics for Machine Learning stands out as a comprehensive, well-structured guide that brings together all the essential topics — from linear algebra and calculus to probability and optimization — in a clear and coherent manner. The material is presented with both rigor and clarity, and the accompanying Python code bridges the gap between theory and practice. This book is an indispensable resource for anyone looking to build a solid mathematical foundation in the field.”
Prashant Kulkarni, Lead AI Security Research Engineer at Google Cloud
“This book provides a carefully constructed guide on mathematics for your machine learning projects. It gives you exactly what you need to know at just the right level! It includes principles, illustrations, and code examples to bring the concepts to life. I highly recommend it to anyone who takes their career seriously!”
T. Scott Clendaniel, AI co-instructor at the University of Pennsylvania
“Danka’s work serves as a foundational text, bridging the often-intimidating gap between abstract mathematics and its tangible application in data science. This book is an indispensable resource for aspiring machine learning engineers and data scientists who are committed to mastering the theoretical bedrock of their discipline.
The section on Linear Algebra is particularly noteworthy for its clarity and the part dedicated to Functions and Calculus is well executed. The inclusion of multivariate calculus is a testament to the book’s comprehensive nature, preparing the reader for the high-dimensional data prevalent in real-world machine learning problems. The book’s treatment of sequences, limits, continuity, and differentiation is both thorough and contextually relevant. This section empowers the reader to grasp the mechanics of model training at a much deeper level. The author successfully demystifies the calculus that underpins so much of machine learning, making it accessible to a broad audience.
Finally, the book’s inclusion of Probability Theory completes the triad of mathematical pillars essential for machine learning. The author’s overall approach encourages a mode of critical thinking that is often absent in more perfunctory texts. Readers are actively encouraged to engage with the material, to question assumptions, and even to attempt their own proofs of the theorems presented. [...] In conclusion, "Mathematics of Machine Learning" is a must-have text that excels in its clarity, its practical relevance, and its ability to inspire a genuine appreciation for the mathematical elegance of machine learning.”
Antonio Gulli, Sr. Director, Distinguished Engineer, Google
About the Author
Tivadar Danka is a mathematician by training, a machine learning engineer by profession, and an educator by passion. After finishing his PhD in 2016 (about the arcane subject of orthogonal polynomials), he switched career paths and has been working in machine learning ever since. His work includes applying deep learning to cell microscopy images to identify and phenotype cells, creating one of the most popular open source Python packages for active learning, building a full machine learning library from scratch, and collecting about a total of 100k followers on social media, all by posting high-quality educational content.
Product details
- Publisher : Packt Publishing
- Publication date : May 30, 2025
- Language : English
- Print length : 730 pages
- ISBN-10 : 1837027870
- ISBN-13 : 978-1837027873
- Item Weight : 2.72 pounds
- Dimensions : 7.5 x 1.65 x 9.25 inches
- Best Sellers Rank: #38,507 in Books (See Top 100 in Books)
- #7 in Mathematical Analysis (Books)
- #40 in Mathematics Study & Teaching (Books)
- #80 in Mathematics (Books)
- Customer Reviews:
About the author

Tivadar Danka is a mathematician by training, a machine learning engineer by profession, and an educator by passion. After finishing his PhD in 2016 (about the arcane subject of orthogonal polynomials), he switched career paths and has been working in machine learning ever since. His work includes applying deep learning to cell microscopy images to identify and phenotype cells, creating one of the most popular open source Python packages for active learning, building a full machine learning library from scratch, and collecting about a total of 100k followers on social media, all by posting high-quality educational content.
















