Learning objectives
- Describe matrices by their size and carry out addition, subtraction, scalar multiplication, multiplication and transposition.
- Decide when a matrix operation is defined, and explain why AB ≠ BA in general.
- Interpret a matrix as a linear transformation and use homogeneous coordinates for translations.
- Interpret the determinant as an area (or volume) scale factor with a sign for orientation.
- Find the inverse of a 2×2 matrix and explain when no inverse exists.
- Explain eigenvalues and eigenvectors with A v = λ v, including matrices with no real eigenvectors.
What a matrix is
A matrix is a rectangular array of numbers. Its size (or dimensions) is written rows × columns: a 2×3 matrix has 2 rows and 3 columns. The entry in row i and column j is written aij. Asquare matrix has as many rows as columns, and the identity matrix I has 1s on its diagonal and 0s elsewhere: multiplying by I changes nothing.
Matrix operations
- Addition and subtraction: only for matrices of the same size; add or subtract matching entries.
- Scalar multiplication: k·A multiplies every entry by the number k.
- Transpose: Aᵀ swaps rows and columns, so (Aᵀ)ij = aji and an m×n matrix becomes n×m.
Matrix multiplication
The product AB is defined only when the number of columns of A equals the number of rows of B. If A is m×n and B is n×p, then AB is m×p, and each entry is a row of A “dotted” with a column of B:
(AB)ij = ai1b1j + ai2b2j + … + ainbnj
Matrix multiplication is associative ((AB)C = A(BC)) but not commutative: AB and BA are usually different, and one can exist while the other does not.
Matrices as transformations
Multiplying a column vector by a matrix transforms it. In this lab, points are column vectors and the matrix acts on the left: p′ = M p. The columns of a 2×2 matrix show where the basis vectors î = (1, 0) and ĵ = (0, 1) land, and every other point follows: (x, y) ↦ x·î′ + y·ĵ′. Such a linear transformation keeps the origin fixed and turns straight lines into straight lines and parallel lines into parallel lines.
| Transformation | 2×2 matrix |
|---|---|
| Scale by sₓ and s_y | [sₓ 0; 0 s_y] |
| Rotate anticlockwise by θ | [cos θ −sin θ; sin θ cos θ] |
| Reflect in the line at angle φ through the origin | [cos 2φ sin 2φ; sin 2φ −cos 2φ] |
| Shear (horizontal k, vertical m) | [1 k; m 1] |
To apply T₁ and then T₂, multiply the matrices as T₂ · T₁: the transformation applied first sits next to the vector. Because multiplication is not commutative, the order changes the result. (Some books and graphics tools use row vectors, p′ = p M, which reverses the order of every product; this lab uses column vectors throughout.)
Homogeneous coordinates
A translation moves the origin, so it is not a linear transformation and no 2×2 matrix can do it. The trick is to write each point as a 3-component column (x, y, 1). Then a translation becomes the 3×3 matrix [1 0 tₓ; 0 1 t_y; 0 0 1], and rotations, scalings, reflections and shears put their 2×2 matrix in the top-left corner. Every combination of these is one 3×3 matrix product, which is how computer graphics handles them.
The determinant
For a 2×2 matrix, det [a b; c d] = ad − bc. Geometrically, |det A| is the factor by which A scales areas: the unit square becomes a parallelogram of area |det A|. The sign shows orientation: a negative determinant means the transformation includes a reflection, so shapes come out as mirror images. If det A = 0 the plane is squashed onto a line or a point. For 3×3 matrices the determinant scales volumes; it can be calculated by expanding along a row: det A = a11·det M11 − a12·det M12 + a13·det M13, where M1j is A with row 1 and column j removed.
The inverse
The inverse A⁻¹ undoes A: A·A⁻¹ = A⁻¹·A = I. Only square matrices with det A ≠ 0 have one (they are called invertible or non-singular). For a 2×2 matrix,A⁻¹ = 1/(ad − bc) · [d −b; −c a]. In general A⁻¹ = adj(A)/det A, where the adjugate adj(A) is the transpose of the matrix of cofactors. A singular matrix (det A = 0) has no inverse because it loses information: many points land on the same place, so you cannot tell where they came from.
Eigenvalues and eigenvectors
An eigenvector of A is a non-zero vector v that A only stretches, shrinks or reverses, without turning it off its line: A v = λ v. The number λ is its eigenvalue. For a 2×2 matrix the eigenvalues solve λ² − (a + d)λ + (ad − bc) = 0, the characteristic equation.
- Two different real roots: two eigen-directions (for example a stretch, or the symmetric matrix [2 1; 1 2]).
- A repeated root: either every vector is an eigenvector (A = λI) or there is only one eigen-direction (a shear).
- Complex roots: no real eigenvectors at all. A rotation by 90° turns every vector, so nothing keeps its direction.
The product of the eigenvalues equals det A, and their sum equals the trace a + d.
3D transformations
In 3D, 3×3 matrices scale, rotate and reflect objects about the origin. The lab builds M = F·R·S: scale first, then rotate about one axis, then reflect in a coordinate plane. Its determinant scales volume, and a negative determinant produces a mirror image that no rotation could reach. Orbiting the camera changes your viewpoint only: the object and its matrix stay the same.
Formula reference
| Formula | Meaning and conditions |
|---|---|
| (A ± B)ij = aij ± bij | A and B the same size |
| (kA)ij = k·aij | k is a number (a scalar) |
| (AB)ij = Σk aikbkj | A is m×n, B is n×p; AB is m×p |
| (Aᵀ)ij = aji | Transpose: rows become columns |
| det [a b; c d] = ad − bc | Signed area-scaling factor (square matrices only) |
| A⁻¹ = 1/(ad − bc) · [d −b; −c a] | 2×2 inverse; exists only if ad − bc ≠ 0 |
| p′ = M p, with p = (x, y, 1) | Homogeneous 2D transformation, column-vector convention |
| A v = λ v, v ≠ 0 | Eigenvector v with eigenvalue λ |
| λ² − (a + d)λ + (ad − bc) = 0 | Characteristic equation of a 2×2 matrix |
Real-world applications
- Computer graphics and games: every frame, 4×4 homogeneous matrices position, rotate and project millions of points onto the screen.
- Robotics: chains of transformation matrices locate a robot arm’s hand from its joint angles.
- Engineering: large systems of linear equations for structures and circuits are solved with matrices.
- Data science: principal component analysis finds the eigenvectors of a data set’s covariance matrix to reveal its main directions of variation.
- Search and networks: Google’s original PageRank was an eigenvector of a huge matrix of links between pages.
- Physics: eigenvalues give the energy levels in quantum mechanics and the natural vibration frequencies of bridges and buildings.
Interesting facts
- The word “matrix” was introduced by James Joseph Sylvester in 1850; Arthur Cayley defined matrix multiplication in 1858.
- Chinese mathematicians solved systems of equations with grids of numbers, much like matrices, about 2,000 years ago in The Nine Chapters on the Mathematical Art.
- Multiplying two n×n matrices the schoolbook way takes about n³ multiplications; cleverer algorithms, starting with Strassen’s in 1969, need fewer.
- Graphics cards are, at heart, machines for multiplying matrices very quickly, which is why they also power modern AI.
Common misconceptions
- “AB = BA.” Usually false, and one product may not even be defined.
- “Multiply matrices entry by entry.” The matrix product combines rows with columns.
- “Any square matrix has an inverse.” Only if its determinant is not zero.
- “A negative determinant means negative area.” Area scales by |det|; the sign only records a flip.
- “Every matrix has real eigenvectors.” Rotations, for example, have none.
- “A matrix transformation is the same as adding vectors.” Adding a vector only shifts points; a matrix can rotate, stretch, shear and reflect them.
Important terms
- Matrix
- A rectangular array of numbers with a size rows × columns.
- Identity matrix
- The square matrix I with 1s on the diagonal; AI = IA = A.
- Transpose
- The matrix with rows and columns swapped.
- Determinant
- A number from a square matrix: its signed area or volume scale factor.
- Inverse
- The matrix that undoes A; exists only when det A ≠ 0.
- Linear transformation
- A map that keeps the origin fixed and preserves addition and scaling of vectors.
- Homogeneous coordinates
- Writing (x, y) as (x, y, 1) so translations become matrix products.
- Eigenvector and eigenvalue
- A non-zero v and number λ with A v = λ v.
Key takeaways
- Check sizes first: AB needs columns of A = rows of B.
- A matrix is a transformation; its columns show where the basis vectors go.
- Order matters: “T₁ then T₂” is T₂·T₁ with column vectors.
- |det| scales area or volume; a negative sign flips orientation; zero means no inverse.
- Eigenvectors keep their line; eigenvalues tell how much they stretch, and some matrices have none that are real.