Matrix Multiplication Calculator

AlgebraFreeNo sign-up

Choose the sizes, enter matrices A and B, and get the product AB with every entry shown as a row of A times a column of B. AB exists only when A has as many columns as B has rows; an m × n matrix times an n × p matrix gives an m × p matrix.

Exact fractionsStepsFree

B has 3 rows, matching the columns of A.
Matrix A
Matrix B

How to multiply two matrices

To find AB, the number of columns of A must equal the number of rows of B. If A is m × n and B is n × p, the product AB is m × p. Each entry cij is the dot product of row i of A and column j of B: multiply matching entries and add.

Worked example

A = [1 2 3; 4 5 6] (2 × 3) and B = [7 8; 9 10; 11 12] (3 × 2). AB is 2 × 2.

  • c11 = 1·7 + 2·9 + 3·11 = 7 + 18 + 33 = 58
  • c12 = 1·8 + 2·10 + 3·12 = 8 + 20 + 36 = 64
  • c21 = 4·7 + 5·9 + 6·11 = 28 + 45 + 66 = 139
  • c22 = 4·8 + 5·10 + 6·12 = 32 + 50 + 72 = 154

So AB = [58 64; 139 154]. Press Example above to see it worked in the calculator.

Rules to remember

  • Order matters. AB and BA are usually different, and one may not even exist. Above, BA is 3 × 3, not 2 × 2.
  • Associative: (AB)C = A(BC).
  • Distributive: A(B + C) = AB + AC.
  • Identity: AI = IA = A.
  • AB = 0 does not mean A = 0 or B = 0.
  • (AB)ᵀ = BᵀAᵀ.

Which sizes can be multiplied?

A B AB
2 × 3 3 × 2 2 × 2
3 × 3 3 × 1 3 × 1 (a column vector)
1 × 4 4 × 1 1 × 1 (a single number)
2 × 3 2 × 3 Not defined (3 ≠ 2)

Where matrix multiplication is used

  • Writing a system of linear equations as Ax = b.
  • Combining transformations in computer graphics: rotate, then scale, as one matrix.
  • Markov chains: a probability vector times a transition matrix gives next step’s probabilities.
  • Totals in business: a quantity matrix times a price matrix gives cost per store.

Need A⁻¹ first? Use the inverse matrix calculator.

Matrix multiplication quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. A is 2 × 3 and B is 3 × 4. What size is AB?

Found a mistake? Let us know!

2. A is 2 × 3 and B is 2 × 3. Is AB defined?

Found a mistake? Let us know!

3. [1 2; 3 4] × [5; 6] = ?

Found a mistake? Let us know!

4. [1 2; 3 4] × [0 1; 1 0] = ?

Found a mistake? Let us know!

5. [2 3] × [4; 5] = ?

Found a mistake? Let us know!

6. Which property always holds for matrix multiplication?

Found a mistake? Let us know!

7. AI equals:

Found a mistake? Let us know!

8. In AB = C, entry c₂₁ uses:

Found a mistake? Let us know!

9. How many multiplications does one entry of a (3 × 4)(4 × 2) product need?

Found a mistake? Let us know!

10. A store sells 3 pens and 2 notebooks; prices are [1.50; 4]. What is the total?

Found a mistake? Let us know!

Frequently asked questions

When can two matrices be multiplied?

When the number of columns in the first equals the number of rows in the second. A 2 × 3 times a 3 × 4 works and gives a 2 × 4.

Is matrix multiplication commutative?

No. In general AB ≠ BA, and one of them may not be defined. It is associative, (AB)C = A(BC).

How do you multiply a 2×2 matrix?

For [a b; c d][e f; g h], the product is [ae + bg af + bh; ce + dg cf + dh]: each entry is a row times a column.

What size is the product matrix?

Rows of the first by columns of the second: an m × n matrix times an n × p matrix is m × p.

Can I use fractions?

Yes. Entries can be integers, decimals or fractions like 2/3, and the answer is exact. Tick Show decimals for decimal form.

Sources

Related calculators

Browse all calculators

More algebra calculators

Browse all 550 calculators

Related to This Article

What people say about "Matrix Multiplication Calculator with Steps"?

No one replied yet.

Leave a Reply