Westlake University's Free RL Textbook Hits 14,000 Stars by Fixing Math Nobody Taught
Shiyu Zhao's free, math-first RL textbook hits 16K GitHub stars and 2.1M video views, making it the clearest on-ramp to reinforcement learning theory
ProTakeaways
- Shiyu Zhao's Mathematical Foundations of Reinforcement Learning has crossed 16K GitHub stars and 2.1M+ lecture video views.
- The full book PDF and all lecture slides are free to download from the GitHub repo; a Springer hardcover (~$66-86) is also available.
- Covers 10 chapters from basic MDP concepts through actor-critic methods, all grounded in rigorous but accessible math.
- Every example uses a single grid world environment, keeping focus on the math rather than problem-specific complexity.
- A 54-video English YouTube playlist accompanies the book, covering every chapter in detail.
- Community has contributed Python, MATLAB, R, and C++ implementations of the book's algorithms, plus study notes in multiple languages.
Reinforcement learning has a textbook problem. Sutton & Barto's classic is thorough but sprawling at 500+ pages. Most online courses skip the math entirely and jump straight to code. Mathematical Foundations of Reinforcement Learning by Shiyu Zhao threads the needle: a tight, 275-page treatment that builds every algorithm from first principles without losing the reader in abstraction.
The book has quietly become one of the most-starred educational resources in the AI space. The lecture videos accompanying the book have received over 2,100,000 views across the internet. The textbook has sold over 15,000 copies, with its GitHub repository receiving over 14,000 stars. That kind of traction for a math-heavy RL textbook is unusual, and it signals something real about the gap it fills.
Who built it and why
Shiyu Zhao is an Associate Professor and Director of the Intelligent Unmanned Systems Laboratory in the School of Engineering at Westlake University, Hangzhou, China. He has been teaching a graduate-level course on reinforcement learning since 2019, and prepared this book as the lecture notes for his students. The result is a textbook that reads like a well-organized course rather than a reference manual.
Before joining Westlake University in 2019, he was a Lecturer in the Department of Automatic Control and Systems Engineering at the University of Sheffield, UK. His background in control systems shows in the book's structure: it is precise, sequential, and obsessed with explaining why each algorithm is designed the way it is.
What's inside
The first part covers the mathematical foundations of reinforcement learning, including the Bellman equation, Bellman optimality equation, and stochastic approximation. The second part covers algorithms: value iteration and policy iteration, Monte Carlo methods, temporal-difference methods, value function methods, policy gradient methods, and actor-critic methods.
The ten chapters are deliberately sequenced. You cannot skip ahead, and that is a feature. Each chapter assumes the previous one and builds toward the next. The full chapter list:
- Chapter 1: Basic Concepts (state, action, policy, reward, MDPs)
- Chapter 2: State Values and the Bellman Equation
- Chapter 3: Optimal State Values and the Bellman Optimality Equation
- Chapter 4: Value Iteration and Policy Iteration
- Chapter 5: Monte Carlo Methods
- Chapter 6: Stochastic Approximation (the theoretical glue behind TD and SGD)
- Chapter 7: Temporal-Difference Methods (TD, SARSA, Q-learning)
- Chapter 8: Value Function Approximation (including DQN)
- Chapter 9: Policy Gradient Methods (REINFORCE)
- Chapter 10: Actor-Critic Methods (A2C, off-policy, deterministic variants)
One design choice stands out: every example in the book uses the same grid world environment. This sounds limiting but is actually a strength. You are never context-switching between different problem setups, so the math stays front and center.
The pedagogical bet it makes
The book aims to help readers understand the theoretical foundations of algorithms, providing insights into their design and functionality. That is a different goal than most RL resources, which focus on getting you to run a working agent as fast as possible. Zhao's approach is to make you understand why the Bellman equation looks the way it does before you ever implement Q-learning.
The mathematical content is carefully structured to ensure readability and approachability. Specifically, deeper derivations are placed in gray-shaded boxes that readers can skip without losing the main thread. This lets the book serve two audiences simultaneously: people who want intuition, and people who want proofs.
Where it is less strong: the coverage is narrower than Sutton & Barto. You won't get an encyclopedic treatment of every RL variant ever conceived. There is no coverage of model-based RL, multi-agent settings, or offline RL. If you are working on those problems, you will need to supplement.
Everything is free
Both the slides of the open course and the PDF of this textbook are available online for free download. The full PDF is hosted directly on the GitHub repo as Book-all-in-one.pdf, and individual chapter PDFs are also available. The English lecture video series on YouTube covers all ten chapters across 54 videos, from a 30-minute overview to detailed walkthroughs of actor-critic methods.
If you prefer a physical copy, the Springer hardcover edition runs 291 pages and was published in January 2025. It is available on Amazon and other retailers, typically priced around $66-$86 USD depending on the vendor.
A growing ecosystem
One signal of how seriously people are taking this book is the community that has formed around it. The repo lists third-party implementations of the book's algorithms in Python, MATLAB, R, and C++, all contributed by readers. There are also student-written study notes in both English and Chinese, and multiple Bilibili video series made by readers explaining the material in their own words.
The comparison that has been circulating is apt: Zhao's book is to Sutton & Barto what a focused graduate seminar is to a comprehensive survey course. The open course has received over 2.5 million views across platforms. For anyone who has bounced off Sutton & Barto's density, or who wants to understand the math behind RLHF, PPO, and actor-critic methods before applying them, this is the clearest starting point available.