Think Linear Algebra#
Think Linear Algebra is a code-first, case-based introduction to the most widely used concepts in linear algebra, designed for readers who want to understand and apply these ideas — not just learn them in the abstract. Each chapter centers on a real-world problem like modeling traffic in the web, simulating flocking birds, or analyzing electrical circuits. Using Python and powerful libraries like NumPy, SciPy, SymPy, and NetworkX, readers build working solutions that reveal how linear algebra provides elegant, general-purpose tools for thinking and doing.
Press the play button to try this example from the chapter on affine transforms.
This book is for readers who may have struggled with traditional math instruction, or who want a more intuitive, hands-on way to learn. By working in Jupyter notebooks, readers get instant feedback as they write code, run simulations, visualize results, and explore what-if scenarios. Rather than beginning with mathematical formalism, Think Linear Algebra starts with meaningful applications and builds up the theory when it’s needed. The result is a uniquely practical and empowering introduction to linear algebra as a language for solving real problems.
Linear algebra is foundational for machine learning, scientific computing, and computer graphics — fields with enormous demand and growth. From search engines and GPS tracking to signal processing and structural engineering, linear algebra is the language behind many of the technologies that shape our world. This book shows you how to use it effectively in your own work.
This book is available under a Creative Commons license, which means that you are free to copy, distribute, and modify it, as long as you attribute the source and don’t use it for commercial purposes.
What You’ll Learn#
By the end of this book, you’ll be able to:
Formulate real-world problems using vectors and matrices, and solve them using standard linear algebra algorithms
Use Python effectively to simulate systems, compute projections, solve equations, and perform matrix decompositions
Visualize mathematical concepts including vector spaces, transformations, and system behavior using interactive, code-driven examples
Apply linear algebra tools in engineering, data science, graphics, robotics, and other computational domains
Think computationally about mathematical problems and translate between mathematical notation and working code
The notebooks#
Here are the chapters that are available now. More coming soon!
Chapter 1: The Power of Linear Algebra
Click here to run Chapter 1 on Colab: Introduces matrix multiplication and eigenvectors through a network-based model of museum traffic, and implements the PageRank algorithm for quantifying the quality of web pages.
Chapter 4: Projection
Click here to run Chapter 4 on Colab: Presents vector projection, vector rejection, orthogonality and the dot product, using the elastic collision of pool (billiards) balls as an example.
Chapter 5: To Boldly Go
Click here to run Chapter 5 on Colab: Uses matrices scale, rotate, shear, and translate vectors. Applies these methods to 2D compute graphics, including a reimplementation of the classic video game Asteroids.
Chapter 7: Systems of Equations
Click here to run Chapter 7 on Colab: Applies LU decomposition and matrix equations to analyze electrical circuits. Shows how linear algebra solves real engineering problems.
Chapter 8: Null Space
Click here to run Chapter 8 on Colab: Investigates chemical stoichiometry as a system with multiple valid solutions. Introduces concepts of rank and nullspace to describe the solution space.
Chapter 9: Truss In the System
Click here to run Chapter 9 on Colab: Models structural systems where the unknowns are vector forces. Uses block matrices and rank analysis to compute internal stresses in trusses.
Chapter 10: Regression
Click here to run Chapter 9 on Colab: Computes least squares regression using QR decomposition and orthogonality equations. Uses multiple regression and data from the General Social Survey (GSS) to explore the relationship of political ideology with time, age, and year of birth.