This book is licensed for the personal use of the buyer. Please do not share or resell the file. Short quotations with attribution are welcome.
The information in this book is provided for education. It is not legal, financial or other professional advice. Product and company names are used only to describe them and belong to their owners.
This is a free sample: the introduction and first chapter.
IntroductionIntroduction
Every modern AI system runs on linear algebra. A word in a language model is a vector of numbers. A layer in a neural network is a matrix. Attention is a collection of dot products. Recommendation systems factor huge matrices. Image models apply matrices to grids of pixels. If you want to understand how these systems work rather than treating them as black boxes, linear algebra is the language you need.
The good news is that the core ideas are geometric and intuitive. A vector is an arrow; a matrix is a way of moving, stretching and rotating space; a dot product measures how much two arrows point the same way. This book builds those ideas step by step, with small examples you can compute by hand, and connects each one to where it appears in AI.
You need school algebra and patience. No university mathematics is assumed.
How the book is organised
Chapters 1 to 9: vectors, length, dot products, angles, similarity, projections and norms.
Chapters 10 to 18: matrices, transformations, multiplication, identity and inverses, determinants and systems of equations.
Chapters 19 to 25: rank, bases, eigenvectors, PCA, the singular value decomposition and low-rank approximations.
Chapters 26 to 31: linear algebra inside neural networks, gradients, embeddings, attention, recommendation and computation.
Chapters 32 to 38: convolutions, softmax, rotations, normalisation, high-dimensional geometry, code, tensors and further study.
Exercises and a glossary close the book.
Chapter 1Vectors as Lists and Arrows
A vector is an ordered list of numbers, such as (3, 4). It can be read in two ways:
As data: a list of features. A house might be (bedrooms, area, age) = (3, 120, 15).
As an arrow: from the origin to the point (3, 4), with a direction and a length.
Both readings are useful. In AI, data points, word embeddings, images and model parameters are all vectors, often with hundreds or thousands of entries. We cannot draw a thousand-dimensional arrow, but the geometry we learn in two dimensions still applies.
The number of entries is the vector's dimension. (3, 4) is two-dimensional; a typical embedding might have 768 or more dimensions.
You have reached the end of the free sample. The full book continues with 38 more chapters, plus the appendices.