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 vectorA matrix
What it isAn ordered list of numbers — [3, 4], [255, 0, 128]A rectangular grid of numbers, arranged in rows and columns
One way to think about itA point, or a direction and distance, in spaceA rule for transforming vectors — rotate, scale, skew
Code equivalentA Python list, a NumPy 1-D array, a tuple of coordinatesA 2-D array, a NumPy matrix, a CSS matrix() transform
Example useA player's (x, y) position; an RGB colour; a document's feature vectorRotating 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 topicWhere 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
Why draw the line here instead of covering everything at once
Each of those three topics is substantial enough to deserve its own real depth rather than a rushed chapter bolted onto this course. This course stays tightly scoped to vectors, matrices, transformations, and the handful of ideas (systems of equations, determinants, eigenvalues) that sit directly on top of them — the concrete foundation the other courses will each build on, once their own turn comes.

Where This Course Is Headed

ChapterTopic
2Vectors — Operations & Geometric Intuition
3The Cross Product & Working in 3D
4Matrices — Representation & Basic Operations
5Matrices as Transformations
6Systems of Linear Equations & Gaussian Elimination
7The Determinant & Matrix Inverse
8Vector Spaces, Span, Basis & Dimension
9Eigenvalues & Eigenvectors
10Capstone — Linear Algebra in Practice
This course's throughline
Every chapter answers a version of the same question: how do you represent and manipulate multi-dimensional data with a small, consistent set of operations? Once vectors and matrices are second nature, tools that look completely unrelated on the surface — a game engine's transform stack, a machine learning model's weight matrix, a graphic design app's rotate handle — turn out to be the exact same handful of operations wearing different names.

Hands-On Exercises

Exercise 1

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 solution
Exercise 2

A 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 solution
Exercise 3

For 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.

📄 View solution

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