The Complete
Guide to Matrices
Everything you need to understand, compute with, and apply matrices — from first principles through eigenvalues, with worked examples throughout.
What Is a Matrix?
A matrix is a rectangular array of numbers arranged in rows and columns. Think of it as a spreadsheet of values that carry mathematical meaning — a compact way to represent data, transformations, and systems of equations.
A matrix with m rows and n columns is called an m × n matrix. The numbers inside it are called elements or entries.
(diagonal highlighted)
Real-world analogy
Imagine a cinema's seating chart: row number is your first coordinate, seat number is your second. Any seat in the theatre can be pinpointed with two numbers — exactly how an element in a matrix is pinpointed. A matrix is just a much more powerful version of that chart, capable of encoding transformations and relationships.
Types of Matrices
Different configurations of rows, columns, and entries have special names and properties. Recognising the type immediately tells you what operations are possible.
| Name | Condition | Example shape |
|---|---|---|
| Row Matrix | Exactly 1 row | 1 × n |
| Column Matrix | Exactly 1 column | m × 1 |
| Square Matrix | m = n | n × n |
| Zero Matrix | All entries = 0 | any |
| Identity Matrix (I) | Square; diagonal = 1, rest = 0 | n × n |
| Diagonal Matrix | Square; non-diagonal entries = 0 | n × n |
| Symmetric Matrix | A = Aᵀ | n × n |
| Upper Triangular | All entries below main diagonal = 0 | n × n |
| Scalar Matrix | Diagonal with equal values | n × n |
The Identity Matrix
The identity matrix I is the matrix equivalent of the number 1: multiplying any matrix by it leaves the matrix unchanged.
Notation & Indexing
The element in row i and column j of matrix A is written aᵢⱼ or A[i,j]. Row index comes first, column second — always.
Given:
- b₁₁ = 3 (row 1, col 1)
- b₁₂ = 7 (row 1, col 2) — blue
- b₂₁ = −2 (row 2, col 1) — orange
- b₂₂ = 5 (row 2, col 2)
Addition & Subtraction
Two matrices can be added or subtracted only when they have the same dimensions. The operation is applied element-by-element.
Properties
| Property | Statement |
|---|---|
| Commutative | A + B = B + A |
| Associative | (A + B) + C = A + (B + C) |
| Zero Matrix | A + 0 = A |
| Additive Inverse | A + (−A) = 0 |
Scalar Multiplication
Multiplying a matrix by a scalar (single number) scales every element uniformly.
Matrix Multiplication
This is the heart of matrix algebra. Matrix multiplication is not element-wise — it's a dot-product operation between rows and columns.
Compute AB:
- (AB)₁₁: Row 1 of A · Col 1 of B = (1×5) + (2×7) = 5 + 14 = 19
- (AB)₁₂: Row 1 of A · Col 2 of B = (1×6) + (2×8) = 6 + 16 = 22
- (AB)₂₁: Row 2 of A · Col 1 of B = (3×5) + (4×7) = 15 + 28 = 43
- (AB)₂₂: Row 2 of A · Col 2 of B = (3×6) + (4×8) = 18 + 32 = 50
Properties
| Property | Statement | Note |
|---|---|---|
| Associative | (AB)C = A(BC) | Group how you like |
| Distributive | A(B+C) = AB + AC | |
| Identity | AI = IA = A | I is the identity |
| NOT commutative | AB ≠ BA (generally) | Order matters! |
| Zero product | AB = 0 does NOT imply A=0 or B=0 | Unlike scalars |
Transpose
The transpose of a matrix flips it across its main diagonal — rows become columns and columns become rows.
Key Properties
| Property | Formula |
|---|---|
| Double transpose | (Aᵀ)ᵀ = A |
| Sum | (A+B)ᵀ = Aᵀ + Bᵀ |
| Product (reverses) | (AB)ᵀ = BᵀAᵀ |
| Scalar | (kA)ᵀ = kAᵀ |
Determinant
The determinant is a scalar value computed from a square matrix. It encodes critical information: whether the matrix is invertible, how it scales volumes, and the sign of orientation change.
2×2 Determinant
det(A) = (3 × 6) − (8 × 4) = 18 − 32 = −14
Since det(A) ≠ 0, this matrix is invertible.
3×3 Determinant (Cofactor Expansion)
Properties of Determinants
| Property | Formula |
|---|---|
| Product | det(AB) = det(A) · det(B) |
| Transpose | det(Aᵀ) = det(A) |
| Inverse | det(A⁻¹) = 1/det(A) |
| Scalar | det(kA) = kⁿ · det(A) |
| Row swap | Swapping two rows negates det |
| Singular | det(A) = 0 iff A is not invertible |
Matrix Inverse
The inverse of a square matrix A, written A⁻¹, is the matrix such that A · A⁻¹ = A⁻¹ · A = I. It exists only when det(A) ≠ 0.
- Compute det(A): (2×4) − (3×1) = 8 − 3 = 5
- Swap diagonal: [[4, 3], [1, 2]] → [[4, -3], [-1, 2]]
- Divide by 5:
Gauss-Jordan Method (for larger matrices)
For larger matrices, form the augmented matrix [A | I] and apply row operations until the left side becomes I. The right side then becomes A⁻¹.
Rank & Linear Systems
The rank of a matrix is the maximum number of linearly independent rows (or columns). It tells us the "true dimensionality" of the data in the matrix.
Solving Systems with Matrices
A system of linear equations can be written as Ax = b. Row reduction (Gaussian elimination) on the augmented matrix [A | b] finds the solution:
- Write augmented matrix: [[2, 1, 5], [1, 3, 10]]
- R1 ↔ R2: [[1, 3, 10], [2, 1, 5]]
- R2 → R2 − 2R1: [[1, 3, 10], [0, -5, -15]]
- R2 → R2 / (−5): [[1, 3, 10], [0, 1, 3]]
- R1 → R1 − 3R2: [[1, 0, 1], [0, 1, 3]]
- Solution: x = 1, y = 3
Eigenvalues & Eigenvectors
An eigenvector of a matrix A is a non-zero vector v that only gets scaled (not rotated) when multiplied by A. The scale factor is the eigenvalue λ.
- Characteristic equation: det(A − λI) = 0 → det([[4−λ, 1],[2, 3−λ]]) = 0
- Expand: (4−λ)(3−λ) − (1)(2) = 0 → λ² − 7λ + 12 − 2 = 0 → λ² − 7λ + 10 = 0
- Factor: (λ − 5)(λ − 2) = 0 → λ₁ = 5, λ₂ = 2
- For λ₁ = 5: (A − 5I)v = 0 → v₁ = [1, 1]ᵀ
- For λ₂ = 2: (A − 2I)v = 0 → v₂ = [1, −2]ᵀ
Live Matrix Calculator
Enter values in both 2×2 matrices and compute common operations interactively.
Matrix Operations — Try It Now
Real-World Applications
Matrices are not abstract curiosities — they are the computational backbone of modern technology and science.
Machine Learning
Neural network weights are matrices. Backpropagation is matrix calculus. Every forward pass is matrix multiplication.
Computer Graphics
3D rotation, scaling, and perspective projection are all matrix transformations applied per vertex per frame.
Quantum Mechanics
Quantum states are vectors; observables are matrices (operators). Eigenvalues are measurable quantities.
Data Science (PCA)
Principal Component Analysis uses eigenvectors of the covariance matrix to reduce dimensions while preserving variance.
Google PageRank
The web is modelled as a matrix. PageRank is the dominant eigenvector of the link matrix — ranking pages by importance.
Structural Engineering
Stiffness matrices relate forces to displacements. Eigenvalues predict resonance frequencies to prevent collapse.
Economics
Input-output models (Leontief) represent inter-industry dependencies as matrices to analyse economic policy impacts.
Image Processing
A grayscale image is a matrix of pixel values. Convolution (blur, edge detection) is matrix operations applied to it.
Knowledge Check
Test Your Matrix Mastery
1. For matrix multiplication AB to be defined, which condition must hold?
2. What is det([[2,1],[5,3]])?
3. Which of these is always true for matrices A and B of compatible sizes?
4. If A is a 3×4 matrix and B is a 4×2 matrix, what is the size of AB?
5. A matrix A is invertible if and only if:
6. The eigenvalues of the identity matrix Iₙ are all equal to:
7. Which operation gives a matrix of dimension n × m from an m × n matrix?
8. If Av = λv for non-zero vector v, then v is called: