A matrix is just a grid of numbers — but that simple idea turns out to be one of the most powerful tools in all of mathematics. Here's everything you need to get started, without the jargon.
If you've ever adjusted the brightness of a photo, played a 3D video game, or wondered how Netflix predicts what you'll watch next, you've already benefited from matrices. They're everywhere — and they're far less intimidating than they look. This guide walks through what a matrix actually is, how to do basic operations with them, and why they matter in the real world.
Rows & Columns
A matrix is a rectangular array of numbers. Rows go across, columns go down — and the dimensions tell you exactly how many of each.
Add, Subtract, Multiply
You can combine matrices with simple rules. Addition is entry-by-entry; multiplication is a little more involved but follows a clean pattern.
Identity, Inverse & Determinant
These three concepts unlock the ability to solve systems of equations and understand when a matrix can be "undone."
What Exactly Is a Matrix?
THE DEFINITIONA matrix (plural: matrices) is a rectangular arrangement of numbers, symbols, or expressions, organized into rows (horizontal lines) and columns (vertical lines). The numbers inside are called entries or elements.
Here's a simple 2×3 matrix (2 rows, 3 columns):
[ 4 5 6 ]
The entry in row i and column j is often written as aij. In the example above, a11 = 1, a12 = 2, a23 = 6, and so on.
Why use matrices instead of just numbers?
Matrices let you handle many numbers at once. Instead of writing five separate equations, you can store all their coefficients in one grid and manipulate the whole system with a single set of rules. That's why they appear everywhere from solving engineering problems to training AI models.
Matrices are usually named with capital letters like A, B, or M. A matrix with m rows and n columns is called an m × n matrix.
Dimensions and Special Types of Matrices
The dimensions (or order) of a matrix are written as rows × columns. This is always the first thing to check before doing any operation, because many operations only work when dimensions match or relate in specific ways.
| Type | What makes it special | Example |
|---|---|---|
| Row matrix | Only one row | [ 2 7 1 ] |
| Column matrix | Only one column | [ 4 ] [ 9 ] [ 0 ] |
| Square matrix | Same number of rows and columns | [ 3 1 ] [ 2 5 ] |
| Diagonal matrix | Non-zero entries only on the main diagonal | [ 3 0 ] [ 0 5 ] |
| Identity matrix | 1s on the main diagonal, 0s elsewhere | [ 1 0 ] [ 0 1 ] |
| Zero matrix | All entries are zero | [ 0 0 ] [ 0 0 ] |
Adding and Subtracting Matrices
ENTRY-BY-ENTRYAdding or subtracting matrices is the simplest operation — but there's a strict rule: the matrices must have exactly the same dimensions. You can add a 2×3 to another 2×3, but not to a 3×2 or a 2×2.
When the dimensions match, you just add (or subtract) the corresponding entries:
[ 3 4 ] + [ 7 8 ] = [ 10 12 ]
Worked example
Add the matrices below:
A = [ 2 -1 ] and B = [ 3 4 ]
- Check dimensions: both are 1×2 (one row, two columns). ✓
- Add the first entries: 2 + 3 = 5
- Add the second entries: -1 + 4 = 3
- Result: [ 5 3 ]
Multiplying Matrices
THE DOT PRODUCT RULEMatrix multiplication is where things get interesting — and where most beginners need a moment to adjust. It's not just multiplying matching entries. Instead, you multiply rows by columns.
The rule: To multiply matrix A (dimensions m × n) by matrix B (dimensions n × p), the number of columns in A must equal the number of rows in B. If that condition holds, the result is an m × p matrix.
Each entry in the result is calculated by taking the dot product of a row from A and a column from B. Multiply matching entries and add them up.
Worked example — 2×2 multiplied by 2×2
Multiply:
A = [ 1 2 ] B = [ 5 6 ]
[ 3 4 ] [ 7 8 ]
- Top-left entry: row 1 of A · column 1 of B = (1×5) + (2×7) = 5 + 14 = 19
- Top-right entry: row 1 of A · column 2 of B = (1×6) + (2×8) = 6 + 16 = 22
- Bottom-left entry: row 2 of A · column 1 of B = (3×5) + (4×7) = 15 + 28 = 43
- Bottom-right entry: row 2 of A · column 2 of B = (3×6) + (4×8) = 18 + 32 = 50
Result: [ 19 22 ]
[ 43 50 ]
Try it yourself with the interactive tool below — change the numbers and watch the result update instantly.
Matrix multiplication is not commutative — A × B is usually not equal to B × A. The order matters, which is a big difference from ordinary multiplication.
The Identity Matrix and the Inverse
Two special matrices come up again and again: the identity matrix and the inverse matrix. Understanding them is key to solving matrix equations.
The identity matrix (I)
The identity matrix is a square matrix with 1s on the main diagonal and 0s everywhere else. It plays the same role as the number 1 in ordinary arithmetic: multiplying any matrix by the identity leaves it unchanged.
[ 0 1 ]
The inverse matrix (A⁻¹)
The inverse of a square matrix A, written A⁻¹, is the matrix that "undoes" A when multiplied together. Their product is the identity matrix:
For a 2×2 matrix, the inverse has a neat formula:
[ c d ] [ −c a ]
What Is a Determinant?
A SINGLE NUMBER THAT TELLS YOU A LOTThe determinant is a number calculated from a square matrix. For a 2×2 matrix [ a b ; c d ], the determinant is:
The determinant tells you two crucial things:
- If det(A) ≠ 0: the matrix is invertible. Its rows and columns are "independent" — you can undo its effect.
- If det(A) = 0: the matrix is singular — it has no inverse. It squashes space in some way that can't be reversed.
Quick example
For A = [ 3 1 ; 2 4 ]:
det(A) = (3)(4) − (1)(2) = 12 − 2 = 10. Since 10 ≠ 0, this matrix is invertible.
Where Matrices Are Used in Real Life
Matrices aren't abstract puzzles — they're practical tools used across every technical field. Here's where you'll find them:
- Computer graphics: every time you rotate, scale or move a 3D object in a game or animation, matrix multiplication is doing the heavy lifting. A 4×4 matrix can encode an entire 3D transformation.
- Machine learning: neural networks are built on matrix operations. A layer of neurons is just a matrix multiplication followed by a non-linear function.
- Engineering: solving systems of linear equations — like balancing forces in a bridge or currents in a circuit — is done efficiently with matrices.
- Economics: input-output models use matrices to track how different sectors of an economy depend on each other.
- Data science: datasets are stored as matrices (rows = samples, columns = features), and operations like PCA rely on matrix decomposition.
- Physics: quantum mechanics describes states and observables using matrices and vectors.
Matrices give us a language for manipulating many numbers at once. Once you're comfortable with the basic operations, you can start reading about linear algebra — the branch of mathematics built entirely on matrices and vectors.