Skip to content

Math glossary

Matrix

A matrix is a rectangular array of numbers arranged in rows and columns. Its size is written rows by columns, so a matrix with 2 rows and 3 columns is a 2 by 3 matrix. Matrices store data, describe systems of equations and represent transformations such as rotations.

Matrix definition

A matrix (plural matrices) is a rectangular arrangement of numbers in rows and columns. For example:

A=[2153]A = \begin{bmatrix} 2 & 1 \\ 5 & 3 \end{bmatrix}

Each number is an entry or element, named by its position: a₂₁ is the entry in row 2, column 1, which is 5 here. Matrices let you treat a whole table of numbers as one object, so a system of equations, a rotation or a spreadsheet of data can be handled with a few compact rules.

Matrix dimensions

A matrix's size, or order, is rows × columns, always in that order. A matrix with 2 rows and 3 columns is 2 × 3 and has 6 entries. Dimensions decide which operations are allowed, so check them first.

Types of matrices

TypeDescriptionExample
Row matrixOne row[1 4 7]
Column matrixOne column3 × 1
Square matrixRows = columns2 × 2, 3 × 3
Zero matrixAll entries 0Acts like 0 in addition
Identity matrix (I)1s on the diagonal, 0s elsewhereActs like 1 in multiplication
Diagonal matrixNon-zero entries only on the diagonaldiag(2, 5, 9)
Symmetric matrixEqual to its transposeaᵢⱼ = aⱼᵢ
Singular matrixSquare with determinant 0Has no inverse

Matrix operations

Addition and subtraction. Only for matrices of the same size; add matching entries. With B = [[1, 4], [2, 0]], A + B = [[3, 5], [7, 3]].

Scalar multiplication. Multiply every entry by the number. 3A = [[6, 3], [15, 9]].

Transpose. Swap rows and columns. Aᵀ = [[2, 5], [1, 3]]. A 2 × 3 matrix becomes 3 × 2.

Matrix multiplication. Entry (i, j) of AB is row i of A dotted with column j of B:

  • Row 1 · column 1: 2·1 + 1·2 = 4
  • Row 1 · column 2: 2·4 + 1·0 = 8
  • Row 2 · column 1: 5·1 + 3·2 = 11
  • Row 2 · column 2: 5·4 + 3·0 = 20

So AB = [[4, 8], [11, 20]]. For AB to exist, A's columns must equal B's rows. An m × n matrix times an n × p matrix gives an m × p result.

Key properties

PropertyHolds?
A + B = B + AYes
(AB)C = A(BC)Yes
A(B + C) = AB + ACYes
AB = BANot in general
AI = IA = AYes
(AB)ᵀ = BᵀAᵀYes, note the reversed order

Inverse of a matrix

A square matrix A has an inverse A⁻¹ if AA⁻¹ = I. It exists only when the determinant is not zero. For a 2 × 2 matrix [[a, b], [c, d]], swap a and d, negate b and c, and divide by ad − bc. For A above, ad − bc = 6 − 5 = 1, so A⁻¹ = [[3, −1], [−5, 2]]. Multiply to check: AA⁻¹ gives the identity.

Solving equations with matrices

The system 2x + y = 7 and x − y = 2 can be written as one matrix equation, AX = B, with A = [[2, 1], [1, −1]], X = [x, y] and B = [7, 2]. Then X = A⁻¹B, giving x = 3, y = 1. Row reduction (Gaussian elimination) does the same job for larger systems and is how computers solve them.

Matrices in the real world

  • Computer graphics: every rotation, scaling and camera move in a game is a matrix multiplication.
  • Machine learning: neural network layers multiply input vectors by weight matrices.
  • Economics: input-output models track how industries supply each other.
  • Networks: adjacency matrices record which nodes connect, used in route finding and page ranking.
  • Cryptography: the Hill cipher encrypts letters with matrix multiplication.

Matrix vs determinant vs vector

These three words are often confused. A matrix is the whole grid of numbers. A vector is a matrix with a single row or a single column, such as the list of unknowns [x, y]. A determinant is not a grid at all but one number calculated from a square matrix. So a 3 × 3 matrix has nine entries, multiplies a three-entry vector, and has one determinant. Keeping the three separate makes textbook instructions much easier to follow: "find the matrix product" gives a grid, while "evaluate the determinant" gives a number.

A quick example from everyday data

Suppose a café sells 30 coffees and 12 muffins on Monday and 25 coffees and 18 muffins on Tuesday, with coffee at $3 and muffins at $2. Put the sales in a 2 × 2 matrix and the prices in a 2 × 1 column. The product gives Monday's revenue, 30·3 + 12·2 = $114, and Tuesday's, 25·3 + 18·2 = $111, in one step. Spreadsheets do exactly this behind functions such as MMULT.

Row operations, trace and "division"

Three row operations do not change the solutions of the system a matrix represents: swapping two rows, multiplying a row by a non-zero number, and adding a multiple of one row to another. Gaussian elimination uses them to reduce a matrix to a simpler form and solve equations.

The trace of a square matrix is the sum of its main-diagonal entries. For A = [[2, 1], [5, 3]] the trace is 2 + 3 = 5.

There is no matrix division. To "divide" by B, multiply by its inverse B⁻¹, and only if B is square with a non-zero determinant. Because order matters, AB⁻¹ and B⁻¹A are usually different.

Common mistakes

  • Writing dimensions as columns × rows.
  • Multiplying entry by entry instead of row by column.
  • Assuming AB = BA.
  • Adding matrices of different sizes.
  • Trying to invert a matrix whose determinant is 0.

Try any of these with the matrix calculator, and see matrices basics explained and determinants and inverses explained.

FAQ

Frequently asked questions

01What is a matrix in math?

A matrix is a rectangular array of numbers arranged in rows and columns, written inside brackets. It is described by its dimensions, rows × columns, so a matrix with 2 rows and 3 columns is 2 × 3.

02How do you multiply two matrices?

Each entry of the product is a row of the first matrix multiplied entry by entry with a column of the second, then added. The first matrix's column count must equal the second's row count.

03Is matrix multiplication commutative?

No. In general AB ≠ BA, and one product may exist while the other does not. Order matters every time.

04What is an identity matrix?

A square matrix with 1s on the main diagonal and 0s elsewhere. Multiplying any matrix by the identity of the right size leaves it unchanged, like multiplying a number by 1.

05What are matrices used for?

Solving systems of linear equations, transforming images and 3D graphics, storing data tables, modelling networks, and powering machine learning, where data and weights are stored as matrices.

06Can you divide matrices?

Not directly. Instead you multiply by the inverse: to undo multiplication by B, multiply by B⁻¹. This only works when B is square and its determinant is not zero.

Related terms

Last updated November 9, 2026. See all math terms.