Introduction
A matrix is a rectangular array of numbers. More importantly, it is a linear map written in coordinates. Rotations, reflections, enlargements and shears, systems of simultaneous equations, Markov chains and the computations behind computer graphics and machine learning are all expressed with matrices. On this page we develop matrix algebra, the determinant, inverses, the geometry of transformations and a first look at eigenvalues.
Mathematical motivation
The system , can be written as one equation, :
If we could "divide by ", we would have . Making sense of , and knowing when it exists, is the central question of this topic. The answer, , has a geometric meaning: must not flatten the plane.
Intuitive explanation
For a matrix , the first column is and the second is . Since is linear, knowing where and go determines everything: the unit square becomes the parallelogram spanned by the two columns.
- is the area of that parallelogram, i.e. the factor by which every area scales.
- means orientation is reversed (a reflection is involved).
- means the plane is squashed onto a line or a point, so information is lost and cannot be inverted.
Explore this live in the linear algebra visualiser.
Formal definitions
If is and is , then is the matrix with . The product is defined only when the inner dimensions agree.
has s on the diagonal and elsewhere; . A square matrix is invertible (non-singular) if there is with . Then is unique and written .
. For , expand along the first row:
A non-zero vector is an eigenvector of with eigenvalue if . The eigenvalues are the roots of the characteristic equation .
Important notation
- : the entry in row , column . : the transpose, .
- , : determinant. : trace (sum of diagonal entries).
- or : the zero matrix. : real matrices.
Important identities
In general .
Rotation by anticlockwise: . Reflection in : . Enlargement scale : . Shear parallel to the -axis: .
Theorems and propositions
A square matrix is invertible if and only if . Equivalently, has only the solution , and has a unique solution for every .
For square matrices of the same size, .
Every matrix satisfies its characteristic equation: .
If an matrix has linearly independent eigenvectors forming the columns of , with eigenvalues on the diagonal of , then , and .
Proofs of important results
, and similarly . Since inverses are unique, the result follows.
∎Directly, . Dividing by gives the inverse. If there is no inverse, since otherwise .
∎With , and . Subtracting gives .
∎Suppose and are with . Then , so and exists by the formula. Now , so as well. The same argument works for matrices once you know in general (proved in the first university section below). It fails in infinite dimensions: on infinite sequences, "shift left" undoes "shift right" but not the other way round.
∎Let and with and . Suppose . Applying gives ; subtracting times the first equation leaves , so , and then . So and are independent, the matrix is invertible, and . A matrix with distinct eigenvalues is always diagonalisable (Q41, Q44, Q49, Q54). With a repeated eigenvalue it may not be: the shear in Q26 has only one eigenvector direction.
∎A line is invariant under when its image is the same line. That needs parallel to , so the direction is still an eigenvector, say , and it needs to be parallel to . Suppose has a second eigenvector with eigenvalue , and write . Then , which is parallel to iff .
- If , then : the only invariant line in direction is the one through .
- If , every line in direction is invariant. For example (a stretch parallel to the -axis) maps every line to itself.
A shear has only one eigenvector direction, , but is always parallel to , so again every line is invariant.
∎Step-by-step derivations
Finding eigenvalues and eigenvectors
For :
For : gives , so . For : , so .
Check: trace and determinant . These two quick checks catch most arithmetic slips.
Invariant lines
A line through the origin is mapped to itself exactly when its direction is an eigenvector (with a nonzero eigenvalue). For the matrix above, and are invariant lines.
Worked examples
"Rotate by then reflect in the -axis" is where is the rotation, because the transformation applied first sits on the right:
which is reflection in .
For : , so .
Common mistakes
Matrix multiplication is not commutative. Expanding , not .
. To undo "put on socks, then shoes", you take off the shoes first.
does not imply unless is invertible. For example, with , any that differ only in their second row give .
This is false in general: .
Applications
- Computer graphics: every rotation, scaling and projection is a matrix (with homogeneous coordinates for 3D).
- Systems of equations: in engineering, economics and circuits.
- Markov chains: transition matrices; long-run behaviour comes from the eigenvalue .
- Population models (Leslie matrices) and coupled ODEs , solved via eigenvalues.
- Data science: principal component analysis and least squares are matrix decompositions.
Connections to other topics
- Vector spaces and linear transformations are the abstract setting.
- Eigenvalues and diagonalisation develop the last section in depth.
- Complex numbers correspond to rotation–scaling matrices .
- Groups: invertible matrices form the group .
- Induction proves formulae for .
Summary
- Multiply rows by columns; the inner dimensions must match; in general.
- is the signed area or volume scale factor; exists iff .
- inverse: swap and , negate and , divide by .
- The columns of are the images of the basis vectors; transformations compose right to left.
- Eigenvectors give the invariant directions; gives the eigenvalues.
University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.
What the determinant really is (university)
The formula and the cofactor expansion look arbitrary. They are not: the determinant is the only function with three natural properties.
There is exactly one function from matrices to numbers that is
- linear in each column separately (with the other columns fixed),
- alternating: whenever two columns are equal, and
- normalised: .
It is the determinant, and it is given by the Leibniz formula
where is the set of all permutations of and according to whether is an even or odd number of swaps.
Geometrically, properties 1–3 say: the signed volume of the parallelepiped spanned by the columns scales when one edge is scaled, adds when one edge is split into two, vanishes when the box is flat, and is for the unit cube.
Alternating implies swapping two columns changes the sign: by linearity, , the two other terms vanishing. Now write each column as and expand by linearity into terms . Terms with a repeated index vanish; the rest have a permutation , and sorting the columns back into order takes as many swaps as has, giving . So is forced to be the Leibniz formula. Conversely one checks that the formula has properties 1–3.
∎For the two permutations give . For the six permutations give the six terms of the cofactor expansion.
Fix with and define . The columns of are times the columns of , so is linear in each column of , alternating, and . By uniqueness, . (If , then also squashes space, and both sides are .)
This is the proof of Q42 that works in every dimension, with no algebra at all. The same uniqueness argument shows , which is why everything said about columns holds for rows too.
Computing in practice. The Leibniz formula has terms, which is hopeless for ( terms). Row reduction is far faster: adding a multiple of one row to another does not change the determinant (property 1 plus property 2), so reduce to triangular form and multiply the diagonal entries. That takes about operations, the method used in Q57's check.
Rank, kernel and the shape of solution sets (university)
When , the system has either no solutions or infinitely many (Q33, Q48). Rank and kernel make this precise.
For an matrix , the image (column space) is the span of the columns, and the kernel (null space) . The rank is , the number of independent columns; the nullity is .
Choose a basis of and extend it to a basis of , so . Every is a combination of (the are zero). These are independent: if then , so it is a combination of the , and independence of the whole basis forces every . So .
∎The dimensions lost in the kernel are exactly the dimensions missing from the image: "information destroyed" equals "room lost".
is solvable iff , i.e. iff . If is one solution, the full solution set is
a point, line or plane parallel to the kernel.
For three equations in three unknowns, this classifies the configurations of three planes:
| Solutions | Picture | ||
|---|---|---|---|
| one point | planes meet at a point | ||
| a line | sheaf (three planes through a common line) | ||
| none | triangular prism, or two parallel planes cut by a third | ||
| a plane | all three planes coincide | ||
| none | parallel planes, at least two distinct |
In Q48 with , ; the value makes the augmented rank as well (a sheaf), and any other makes it (a prism).
Linear algebra in one sentence: for a square matrix the following are equivalent: ; is invertible; ; ; the columns are a basis; is not an eigenvalue; has exactly one solution for every .
Symmetric matrices and the spectral theorem (university)
The matrices in Q41, Q47 and Q54 were symmetric (), and in each case the eigenvalues were real and the eigenvectors perpendicular. That is not a coincidence.
If is a real symmetric matrix, then all its eigenvalues are real, and there is an orthonormal basis of eigenvectors. Equivalently, with orthogonal () and diagonal.
Real eigenvalues. Let with nonzero, and write for the complex conjugate. Then . Taking the conjugate transpose of this number, and using , gives the same number with in place of . Since , .
Perpendicular eigenvectors. If and with , then
so and .
The full theorem (including repeated eigenvalues) follows by induction on : take one unit eigenvector ; symmetry means maps the plane (or hyperplane) perpendicular to into itself, and restricted to it is again symmetric.
∎Geometric meaning. Every symmetric matrix is a stretch along perpendicular axes: rotate to the eigenvector axes (), stretch by the eigenvalues (), rotate back (). For the axes are and the stretches are and ; the positive square root in Q54 just uses stretches of and along the same axes.
Quadratic forms. The curve is . In coordinates along the eigenvectors it becomes : an ellipse with semi-axes and , tilted at . This "principal axes" method classifies every conic and quadric surface, finds the principal axes of inertia of a rigid body, and (as principal component analysis) finds the directions of greatest variation in a data set from its symmetric covariance matrix.
Beyond symmetry. For an arbitrary matrix, two generalisations survive. The singular value decomposition (with , orthogonal and diagonal with entries ) exists for every real matrix, even rectangular ones: every linear map is a rotation, a stretch along perpendicular axes, and another rotation. The Jordan normal form shows that every complex square matrix is similar to one that is diagonal except for some s just above the diagonal. The simplest non-diagonalisable example is the shear , whose powers (Q56, Q59) grow like instead of geometrically.
Why does this work?
The columns of a matrix are the images of and , so the unit square maps to the parallelogram they span. Its area is (base times height, or the cross product). Since linear maps scale every small square by the same factor, every area is scaled by . The sign records whether orientation is reversed.
Beyond the syllabus
Mathematical curiosities
Every square matrix satisfies its own characteristic equation. For : . So .
Further exploration
Reading pathway: Linear Algebra Done Right (Axler); Visual Group Theory (Carter).