Why Linear Algebra Matters for Programmers
Linear Algebra Fundamentals
Chapter 1 · Why Linear Algebra Matters for Programmers
Linear algebra is the math of collections of numbers that move and combine together — a vector, a matrix, a transformation. It sounds abstract until you notice how much of it is already sitting quietly inside code you've probably written: an RGB colour is a 3-vector, a CSS transform is a matrix, a "feature vector" fed into a machine learning model is, literally, a vector. This course is about making that quiet, already-present math explicit and usable on purpose, rather than leaving it as something that happens to work.
What Linear Algebra Actually Studies
Where Discrete Mathematics Fundamentals is about counting, logic, and discrete structure, linear algebra is about a different question entirely: given a collection of numbers arranged as a vector or a matrix, what operations can be done to it, and what do those operations mean geometrically? A vector can represent a position, a direction, a colour, or a list of features — the same handful of operations (add, scale, multiply by a matrix) apply regardless of what the numbers represent.
| A vector | A matrix | |
|---|---|---|
| What it is | An ordered list of numbers — [3, 4], [255, 0, 128] | A rectangular grid of numbers, arranged in rows and columns |
| One way to think about it | A point, or a direction and distance, in space | A rule for transforming vectors — rotate, scale, skew |
| Code equivalent | A Python list, a NumPy 1-D array, a tuple of coordinates | A 2-D array, a NumPy matrix, a CSS matrix() transform |
| Example use | A player's (x, y) position; an RGB colour; a document's feature vector | Rotating a sprite; converting one colour space to another; a neural network layer's weights |
Five Concrete Connections to Code Already On This Site
Every topic in this course maps onto something already covered elsewhere on this site, usually without the underlying linear algebra ever being named:
| Linear algebra topic | Where it actually shows up |
|---|---|
| Vectors & the dot product (Ch.2) | Positions and directions in any graphics/game code; the dot product is exactly how "how similar are these two things" gets measured in Machine Learning Fundamentals and Neural Networks & Deep Learning |
| Matrices as transformations (Ch.4–5) | Blender Fundamentals' object transforms, Vector Graphics and Figma's own scale/rotate/skew tools, CSS's own transform: matrix(...) |
| Systems of linear equations (Ch.6) | Fitting a straight line through a set of data points (linear regression) is solving a system of linear equations for the best-fit slope and intercept |
| Determinant & inverse (Ch.7) | Checking whether a graphics transform can be "undone" at all — a zero determinant means information was irreversibly flattened away |
| Eigenvalues & eigenvectors (Ch.9) | Principal Component Analysis (dimensionality reduction, touched on in Data Science Fundamentals and Machine Learning Fundamentals) and the mathematics underneath Google's original PageRank algorithm |
What This Course Won't Cover
A few genuinely related topics are deliberately left for their own future courses under this same Maths for Programmers subject, rather than folded in here as extra chapters:
- Calculus-based optimization — how gradient descent actually derives its update rule, or how backpropagation's chain rule works, get their own future Calculus & Optimization course, even though eigenvalues (Chapter 9) sit right next door to that territory
- Formal vector space theory — axiomatic proofs about abstract vector spaces over arbitrary fields stay out of scope; Chapter 8 covers span, basis, and dimension, but kept concrete and code-grounded rather than proof-heavy
- Numerical stability at scale — why a huge, ill-conditioned matrix can quietly produce garbage results in floating-point arithmetic is real and important, but belongs to this subject's own future Numerical Methods & Floating-Point Computation course
Where This Course Is Headed
| Chapter | Topic |
|---|---|
| 2 | Vectors — Operations & Geometric Intuition |
| 3 | The Cross Product & Working in 3D |
| 4 | Matrices — Representation & Basic Operations |
| 5 | Matrices as Transformations |
| 6 | Systems of Linear Equations & Gaussian Elimination |
| 7 | The Determinant & Matrix Inverse |
| 8 | Vector Spaces, Span, Basis & Dimension |
| 9 | Eigenvalues & Eigenvectors |
| 10 | Capstone — Linear Algebra in Practice |
Hands-On Exercises
For each of the following, say whether it's more naturally represented as a vector or a matrix, and briefly justify each answer: (a) an RGB colour, (b) a rotation that can be applied to any point in a 2D scene, (c) a single data point with five numeric features fed into a machine learning model, (d) a full black-and-white image where each pixel is a brightness value.
📄 View solutionA colleague claims "linear algebra is only really relevant if you're doing machine learning." Using this chapter's own five connections, explain at least two places linear algebra shows up in code that has nothing to do with ML.
📄 View solutionFor each of the following real tools/code artifacts, name which linear algebra topic from this chapter's own table it most directly maps to, and explain the connection in one or two sentences: (a) a CSS transform: matrix(a, b, c, d, e, f) rule, (b) fitting a straight trend line through a scatter plot of data points, (c) reducing a dataset with 50 columns down to the 2 or 3 "directions" that capture most of its variation.
Chapter 1 Quick Reference
- Vector = an ordered list of numbers, often a point or direction; matrix = a grid of numbers, often a rule for transforming vectors
- Five direct connections: vectors/dot product → positions & similarity, matrices → transforms, linear systems → curve fitting, determinant/inverse → reversibility, eigenvalues → dimensionality reduction & PageRank
- Deliberately out of scope here: Calculus & Optimization, formal vector space proofs, and Numerical Methods & Floating-Point Computation each get their own future course
- This course stays concrete and code-grounded — vectors, matrices, transformations, and the ideas built directly on top of them
- Next chapter: Vectors — operations and the geometric intuition behind them