Calculator Tools

← Back to Blogs

How to Multiply Matrices Step by Step

Learn the rules for multiplying matrices, check the sizes, work a 2 by 2 example, and see why the order matters. Includes addition, determinant, and inverse.

By Calculator Tools Team2 min read

  • maths
  • linear algebra
A matrix with the entries 52 and 55 on top and 68 and 71 below, shown in large type on a white card over a yellow background

A matrix is a rectangular grid of numbers. Matrix multiplication looks strange at first, but it follows one simple rule: each entry of the result is a row of the first matrix times a column of the second.

Check the sizes first

You can multiply A × B only when the number of columns in A equals the number of rows in B. If A is m × p and B is p × n, the product is m × n. A 2 × 3 matrix times a 2 × 2 matrix is not defined, because 3 is not equal to 2.

A worked example

Let A = [[3, 7], [4, 9]] and B = [[8, 2], [4, 7]].

Each entry is a row times a column:

  • Row 1 × column 1: 3·8 + 7·4 = 24 + 28 = 52
  • Row 1 × column 2: 3·2 + 7·7 = 6 + 49 = 55
  • Row 2 × column 1: 4·8 + 9·4 = 32 + 36 = 68
  • Row 2 × column 2: 4·2 + 9·7 = 8 + 63 = 71

So A × B = [[52, 55], [68, 71]].

The order matters

Matrix multiplication is not commutative. B × A is [[32, 74], [40, 91]], which is different from A × B. It is, however, associative: (A × B) × C equals A × (B × C).

Adding and subtracting

For addition and subtraction, both matrices must be the same size. Add or subtract the entries in the same position. A + B = [[11, 9], [8, 16]], and A − B = [[−5, 5], [0, 2]].

The determinant of a 2 × 2 matrix

For [[a, b], [c, d]], the determinant is a·d − b·c. For A, that is 3·9 − 7·4 = 27 − 28 = −1.

The inverse

A square matrix has an inverse only when its determinant is not zero. For a 2 × 2 matrix the inverse is (1 ÷ determinant) times [[d, −b], [−c, a]]. For A, the determinant is −1, so the inverse is [[−9, 7], [4, −3]]. Multiplying A by its inverse gives the identity matrix, [[1, 0], [0, 1]].

Useful rules

  • (A × B)ᵀ = Bᵀ × Aᵀ
  • det(A × B) = det(A) × det(B)
  • A × I = A, where I is the identity matrix

Check your answers

Our matrix calculator multiplies, adds, transposes, and finds determinants, inverses, rank, and row reduced form, with the steps shown.