← All articles
mathmatriceslinear algebracomputingSeptember 15, 20265 min read

What Is a Matrix? Grids of Numbers That Rotate, Solve and Rank

By the BrainSnail editorial team. How these articles are written and checked, and how to tell us when one is wrong.

A rotation of a picture on a screen, the solution of a set of equations with a thousand unknowns, the ranking of every page on the web and the guts of a language model are all the same operation, a grid of numbers multiplied by a list of numbers to produce another list. The grid is a matrix, the word is Latin for womb and was chosen by James Joseph Sylvester in 1850 for a thing out of which other things are born, and the arithmetic of matrices, worked out by Arthur Cayley in 1858, is what a graphics card does several trillion times a second.

What it is

A matrix is a rectangular array of numbers with a set number of rows and columns, a 2 by 3 matrix having two rows and three columns, and on its own it is only a table. It becomes a machine when it is multiplied by a vector, a column of numbers: each row of the matrix is laid alongside the vector, the matching entries are multiplied and the products added, and the result is one entry of a new vector. A 2 by 2 matrix therefore turns any point in the plane into another point, and the matrix is a way of writing down the whole transformation at once. The identity matrix, with ones down the diagonal and zeros elsewhere, leaves every vector unchanged; every other matrix stretches, squashes, rotates, reflects or shears the plane, and the entries say how.

The rules

Matrices add entry by entry and are scaled entry by entry, like vectors, and the operation that makes them useful is multiplication of one by another, which is the composition of the two transformations: doing the second matrix's transformation after the first is the same as applying their product. The product is computed row against column, and it has properties that surprise:

  • Order matters: A times B is not in general B times A, since rotating and then reflecting is not the same as reflecting and then rotating
  • Inverse: a matrix that undoes another exists only if the first lost no information, which is when its determinant is not zero; a matrix that flattens the plane to a line cannot be undone
  • Determinant: a single number computed from the entries that gives the factor by which the matrix scales area or volume, and whose sign says whether it flips orientation
  • Transpose: the matrix flipped across its diagonal, rows becoming columns
  • Eigenvectors: the directions a matrix stretches without turning, and eigenvalues, the amounts by which it stretches them, which reveal what a transformation fundamentally does

Solving equations

The oldest use is the reason the subject exists. A system of linear equations, three unknowns in three equations, is a matrix of coefficients times a vector of unknowns equalling a vector of constants, and solving it is finding the inverse of the matrix or, more practically, reducing it by the systematic elimination that the Chinese Nine Chapters described around 200 BC and that Gauss made a method in 1810. Every engineering analysis, from the stresses in a bridge to the flow of heat through an engine, ends in a system of thousands or millions of linear equations, and the algorithms for solving them fast, exploiting matrices that are mostly zeros, are among the most used programs in existence; weather forecasts, oil reservoirs and the structure of aircraft are all matrices being solved.

Graphics, ranking and learning

A 3D scene is a list of points, and moving the camera, rotating an object or projecting the scene onto a flat screen is a matrix multiplied by every point, which is why graphics hardware is built to multiply small matrices by enormous numbers of vectors at once; a 4 by 4 matrix, with an extra coordinate that lets translation be included, is the unit of all of it. Google's original PageRank treated the web as a matrix whose entry in row i and column j was the fraction of page j's links that pointed to page i, and the ranking of every page was the eigenvector of that matrix, found by repeated multiplication. A neural network is a chain of matrices, each layer a matrix that transforms the vector from the layer before, with the entries adjusted by training until the chain maps a picture to a label or a sentence to its continuation, and the trillions of parameters in a large model are the entries of its matrices. The graphics card that was built for games turned out to be the right machine for that too.

Beyond the grid

Matrices appeared in physics in 1925 when Werner Heisenberg found that the quantities of quantum mechanics obeyed a multiplication in which order mattered, and Max Born recognised the rules as Cayley's; the measurements of a quantum system are eigenvalues of matrices, and the fact that position times momentum is not momentum times position is the uncertainty principle in one line. A matrix is also a graph, a network of connections written as a table, a Markov chain of probabilities, a rotation of the Earth, a shuffle of a deck and the mixing of an image; the subject called linear algebra is the study of what all of these have in common, and it is the most useful mathematics that most people are never taught.

The takeaway

A matrix is a grid of numbers that transforms vectors when multiplied by them, and the product of two matrices is the composition of their transformations, with order mattering, an inverse only where nothing was flattened, a determinant that measures scaling and eigenvectors that show what the matrix really does. It solves systems of equations for engineering and weather, moves every point in computer graphics, ranks the web through an eigenvector, forms the layers of a neural network and writes the laws of quantum mechanics.

Practise this

Questions from Higher Mathematics

Reading about something is not the same as being able to recall it. These are real questions from the Higher Mathematics unit in our Math track, answers and explanations included. The unit has 120 in total across 21 steps.

  • Multiple choiceLevel 4

    1. What is the determinant of the 2x2 matrix [[1,2],[3,4]]?

    • -2correct
    • 2
    • 10
    • -10

    For [[a,b],[c,d]] the determinant is ad - bc, so here 1*4 - 2*3 = 4 - 6 = -2.

  • Fact or fibLevel 4

    2. An axiom must be proven before it can be used.

    Answer: False

    False. An axiom is a starting assumption accepted as true without proof; theorems are what get proved.

  • Odd one outLevel 4

    3. Three of these number systems are fields. Which one is NOT a field?

    • The integers Zcorrect
    • The rationals Q
    • The reals R
    • The complex numbers C

    The integers Z are not a field because most integers (like 2) have no integer multiplicative inverse; Q, R, and C are fields.