POST · MATHEMATICS

What Are Matrices?

A beginner's guide to the grid of numbers that powers computer graphics, data science and engineering — explained simply, with visual examples.

10 MIN READ · INTERACTIVE MATRIX TOOL INSIDE

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.

BASICS

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.

OPERATIONS

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.

POWER TOOLS

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 DEFINITION

A 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):

[ 1 2 3 ]
[ 4 5 6 ]
This matrix has 2 rows and 3 columns, so its dimensions are 2×3 (read "two by three").

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.

Naming convention

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.

TypeWhat makes it specialExample
Row matrixOnly one row[ 2 7 1 ]
Column matrixOnly one column[ 4 ]
[ 9 ]
[ 0 ]
Square matrixSame number of rows and columns[ 3 1 ]
[ 2 5 ]
Diagonal matrixNon-zero entries only on the main diagonal[ 3 0 ]
[ 0 5 ]
Identity matrix1s on the main diagonal, 0s elsewhere[ 1 0 ]
[ 0 1 ]
Zero matrixAll entries are zero[ 0 0 ]
[ 0 0 ]

Adding and Subtracting Matrices

ENTRY-BY-ENTRY

Adding 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:

[ 1 2 ] [ 5 6 ] [ 6 8 ]
[ 3 4 ] + [ 7 8 ] = [ 10 12 ]
Each entry is added to the entry in the same position. Subtraction works the same way.

Worked example

Add the matrices below:

A = [ 2 -1 ]   and   B = [ 3 4 ]

  1. Check dimensions: both are 1×2 (one row, two columns). ✓
  2. Add the first entries: 2 + 3 = 5
  3. Add the second entries: -1 + 4 = 3
  4. Result: [ 5 3 ]

Multiplying Matrices

THE DOT PRODUCT RULE

Matrix 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.

A(m × n) · B(n × p) = C(m × p) The inner dimensions must match; the outer dimensions give the size of the result.

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 ]

  1. Top-left entry: row 1 of A · column 1 of B = (1×5) + (2×7) = 5 + 14 = 19
  2. Top-right entry: row 1 of A · column 2 of B = (1×6) + (2×8) = 6 + 16 = 22
  3. Bottom-left entry: row 2 of A · column 1 of B = (3×5) + (4×7) = 15 + 28 = 43
  4. 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 A
×
MATRIX B
=
RESULT
19
22
43
50
Change any number and the result recalculates instantly. The result is always the dot product of a row from A and a column from B.
Key insight

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.

I₂ = [ 1 0 ]
[ 0 1 ]
For any 2×2 matrix A, A × I = I × A = A. The identity matrix is the "do nothing" matrix.

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:

A · A⁻¹ = A⁻¹ · A = I Not every matrix has an inverse. If a matrix has an inverse, it's called invertible or non-singular.

For a 2×2 matrix, the inverse has a neat formula:

A = [ a b ] → A⁻¹ = 1/(ad − bc) · [ d −b ]
[ c d ] [ −c a ]
The quantity ad − bc is the determinant. If it's zero, the inverse doesn't exist.

What Is a Determinant?

A SINGLE NUMBER THAT TELLS YOU A LOT

The determinant is a number calculated from a square matrix. For a 2×2 matrix [ a b ; c d ], the determinant is:

det(A) = ad − bc For larger matrices, the determinant is calculated using more complex rules, but the idea is the same.

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.
The big picture

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.

FAQ

Questions people actually ask.

The short answers — with the long ones one tap away.

What is a matrix in simple words?+

A matrix is a rectangular grid of numbers arranged in rows and columns. It's a compact way to store and work with many numbers at once, and it's one of the core tools of linear algebra.

How do you add and subtract matrices?+

To add or subtract two matrices, they must have the same dimensions. You simply add or subtract the matching entries — the number in row 1, column 1 of the first matrix is added to the number in row 1, column 1 of the second matrix, and so on.

How do you multiply two matrices?+

To multiply matrix A by matrix B, the number of columns in A must equal the number of rows in B. Each entry in the result is the dot product of a row from A and a column from B. The result has the same number of rows as A and the same number of columns as B.

What is the identity matrix?+

The identity matrix is a square matrix with 1s on the main diagonal and 0s everywhere else. Multiplying any matrix by the identity matrix leaves it unchanged — it works like the number 1 does in ordinary multiplication.

What is a determinant and what does it tell you?+

The determinant is a single number calculated from a square matrix. For a 2×2 matrix it's ad − bc. A non-zero determinant means the matrix is invertible; a determinant of zero means it's singular and has no inverse.

Where are matrices used in real life?+

Matrices are used in computer graphics to rotate and scale 3D objects, in machine learning to process data, in economics for input-output models, in engineering for solving systems of equations, and in physics for transformations. Any time many numbers need to be processed together, matrices are likely involved.