Skip to content
LoveToCalc

Definition — what does that mean?

Matrix multiplication

Each entry of the product AB is a row of A times a column of B: multiply the entries in pairs and add the products.

In Swedish: Matrismultiplikation

Matrix multiplication

The relation

cᵢⱼ=aᵢ₁b₁ⱼ+aᵢ₂b₂ⱼ+aᵢ₃b₃ⱼ

The product AB of an m×n matrix A and an n×p matrix B is the m×p matrix whose entry in row i and column j is row i of A times column j of B: cᵢⱼ = aᵢ₁b₁ⱼ + aᵢ₂b₂ⱼ + … + aᵢₙbₙⱼ.

Solve for

cᵢⱼ=139

cᵢⱼ equals ((4 times 7) plus (5 times 9)) plus (6 times 11), equals (28 plus 45) plus 66, equals 73 plus 66, equals 139

Working4 steps

Practice questions

You are given

  • aᵢ₁=5
  • b₁ⱼ=-1
  • aᵢ₂=2
  • b₂ⱼ=3
  • aᵢ₃=-4
  • b₃ⱼ=2

The formula

If A is an m×n matrix and B an n×p matrix, the product AB is an m×p matrix. The entry in row i and column j of AB is row i of A times column j of B. When A has three columns and B three rows, that is

With n columns in A the sum has n terms, aᵢ₁b₁ⱼ + … + aᵢₙbₙⱼ. It is the dot product of a row and a column. The card above computes one entry; for a 2×2 product, set the two numbers of the third term to 0.

Holds when A has as many columns as B has rows. Otherwise AB is not defined.

Worked example

A has the rows (1, 2, 3) and (4, 5, 6), and B has the rows (7, 8), (9, 10) and (11, 12). A is 2×3 and B is 3×2, so AB is 2×2.

The entry in row 2, column 1 is row 2 of A, (4, 5, 6), times column 1 of B, (7, 9, 11): 4 · 7 + 5 · 9 + 6 · 11 = 28 + 45 + 66 = 139.

All four entries the same way:

column 1 column 2
row 1 1 · 7 + 2 · 9 + 3 · 11 = 58 1 · 8 + 2 · 10 + 3 · 12 = 64
row 2 4 · 7 + 5 · 9 + 6 · 11 = 139 4 · 8 + 5 · 10 + 6 · 12 = 154

The order matters

In the same example BA is a 3×3 matrix, with the rows (39, 54, 69), (49, 68, 87) and (59, 82, 105). AB and BA are not even the same size. For two square matrices they are usually different as well. With A having the rows (1, 2) and (3, 4) and B the rows (0, 1) and (1, 0):

Product Rows What B does
AB (2, 1) and (4, 3) swaps the columns of A
BA (3, 4) and (1, 2) swaps the rows of A
Entry by entry (not the matrix product) (0, 2) and (3, 0) —

The last line is what multiplying the entries in the same position gives. It is a matrix of the right size, and it is not AB.

A second example: a row and a column that give 0

Row (2, −1, 3) times column (4, 5, −2) gives 8 − 5 − 6 = −3. Row (1, −2, 2) times column (4, 3, 1) gives 4 − 6 + 2 = 0. So an entry can be 0 although no number in the row or the column is 0: the row and the column are then orthogonal as vectors.

Where to go next

A matrix times its inverse is the identity matrix, which is the check on the page on the inverse of a 2×2 matrix. A linear system can be written as a matrix product, Ax = b, and is solved by Gaussian elimination; how many free variables its solution has is given by the rank.

Common mistakes

Frequently asked questions

What size is the product? An m×n matrix times an n×p matrix gives an m×p matrix: the rows of the first and the columns of the second. The two inner numbers, n and n, have to agree.

When is AB = BA? Only in particular cases, for example when one of them is the identity matrix, when both are diagonal, or when B is a power of A. As a rule AB ≠ BA.

How do I multiply a matrix by a vector? A column vector with n entries is an n×1 matrix, so Ax is computed the same way: each entry of the result is a row of A times x.

Looking for another letter? The formula solved for each one
Solved for each letter
Solve forRearrangedWith the numbersComes to
aᵢ₁cᵢⱼ−aᵢ₂b₂ⱼ−aᵢ₃b₃ⱼb₁ⱼ139−5·9−6·1174
aᵢ₂cᵢⱼ−aᵢ₁b₁ⱼ−aᵢ₃b₃ⱼb₂ⱼ139−4·7−6·1195
aᵢ₃cᵢⱼ−aᵢ₁b₁ⱼ−aᵢ₂b₂ⱼb₃ⱼ139−4·7−5·9116
b₁ⱼcᵢⱼ−aᵢ₂b₂ⱼ−aᵢ₃b₃ⱼaᵢ₁139−5·9−6·1147
b₂ⱼcᵢⱼ−aᵢ₁b₁ⱼ−aᵢ₃b₃ⱼaᵢ₂139−4·7−6·1159
b₃ⱼcᵢⱼ−aᵢ₁b₁ⱼ−aᵢ₂b₂ⱼaᵢ₃139−4·7−5·9611
cᵢⱼaᵢ₁b₁ⱼ+aᵢ₂b₂ⱼ+aᵢ₃b₃ⱼ4·7+5·9+6·11139

Last reviewed November 7, 2026 ·How pages are reviewed

Linear algebraAll formulas

Put this formula on your site

Copy the code into your page where the formula card should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.