Matrices, from tables of numbers to 3D graphics
A matrix is simply a rectangular table of numbers, yet it is one of the most useful ideas in mathematics. It can hold a system of equations, a network, an image or a rotation in space. This page explains the main operations, the history behind them and where you meet matrices every day.
What is a matrix?
A matrix is a grid of numbers with m rows and n columns, written as an m x n matrix. A single row or column is called a vector. Matrices of the same size are added entry by entry, and multiplying by a number, a scalar, simply multiplies every entry. The real power appears when you treat a matrix as a machine that turns one vector into another.
How matrix multiplication works
To find the entry in row i and column j of A x B, walk along row i of A and down column j of B, multiply the pairs and add them up. That is why A needs as many columns as B has rows. The rule looks odd at first, but it means that A x B does exactly what applying B and then A does. Order matters: rotating and then stretching is not the same as stretching and then rotating.
Determinant and inverse
The determinant of a square matrix is one number that says how much the matrix scales area in 2D or volume in 3D. A determinant of 2 doubles every area, a negative one also mirrors the shape, and 0 means space is squashed flat. A squashed shape cannot be unfolded again, so exactly the matrices with determinant 0 have no inverse. For all others the inverse undoes the matrix: A x A^-1 gives the identity matrix, with ones on the diagonal and zeros elsewhere.
Cayley, Sylvester and the history of matrices
Arrays of numbers were used to solve equations long before they had a name: the Chinese Nine Chapters on the Mathematical Art, about 2000 years old, already eliminates unknowns from a table of coefficients. Determinants were studied by Seki Takakazu and Leibniz in the late 17th century. In 1850 James Joseph Sylvester introduced the word matrix, Latin for womb, because he saw it as the source from which determinants are born. His friend Arthur Cayley published A Memoir on the Theory of Matrices in 1858, treating matrices as objects in their own right with addition, multiplication and inverses, and stating what is now called the Cayley-Hamilton theorem.
Matrices in computer graphics
Every time a game or 3D viewer draws a frame, millions of points are multiplied by matrices. A 4x4 matrix can rotate, scale and move a point in one step, and multiplying several of them combines a whole chain of movements into a single matrix. The camera and the perspective view are matrices too. Graphics cards are built to do these multiplications in parallel, which is also why they turned out to be so good at training neural networks.
Frequently asked questions
Can you divide one matrix by another?
Not directly. Instead you multiply by the inverse: A x B^-1 or B^-1 x A, which usually give different results. This only works when B is square and its determinant is not 0.
What does the rank of a matrix tell me?
The rank is the number of rows that are truly independent, meaning none of them can be made from the others. A 3x3 matrix with rank 3 is invertible. Rank 2 means everything is squashed onto a plane, and rank 1 onto a line.
What is the identity matrix?
It is the square matrix with ones on the diagonal and zeros everywhere else, written I. It plays the role of the number 1: A x I = I x A = A. Any matrix to the power 0 is defined as I.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open the Matrix calculator