Matrix Calculator
English

Matrix Multiplication Guide

How to Multiply Matrices

To multiply two matrices, take each row of the first matrix and calculate its dot product with each column of the second matrix. The number of columns in the first matrix must equal the number of rows in the second matrix.

Quick Answer

Matrix multiplication is based on matching rows from the first matrix with columns from the second matrix. Each entry in the result is a dot product.

Before doing any arithmetic, check the dimensions. If A is m×n and B is n×p, then AB is defined and the result has size m×p.

When Can Two Matrices Be Multiplied?

If A is an m×n matrix and B is an n×p matrix, then:

(m×n)(n×p) = m×p

  • The two inner dimensions n must be the same.
  • The outside dimensions m and p determine the size of the result matrix.

Can These Matrices Be Multiplied?

Compatible

Matrix A

2 rows × 3 columns

×
Matrix B

3 rows × 2 columns

Columns of A = Rows of B

3 columns = 3 rows

Result size:

Rows of A × Columns of B

2 rows × 2 columns

Not Compatible

Matrix A

2 rows × 3 columns

×
Matrix B

2 rows × 2 columns

Columns of A ≠ Rows of B

3 columns ≠ 2 rows

Conclusion:

The product AB is not defined.

Check the two inner dimensions first. If they match, the outside dimensions become the size of the answer.

The Row-by-Column Rule

  1. Choose one row from matrix A.
  2. Choose one column from matrix B.
  3. Multiply corresponding entries.
  4. Add the products.

Matrix A row 1

123
456
×

Matrix B column 1

78
910
1112

Result entry c11

58
Row 1 of A and column 1 of B produce c11 in the result matrix.

(1×7) + (2×9) + (3×11) = 58

Complete Rectangular Matrix Example

A is 2×3. B is 3×2. The inner dimensions match, so the product is defined. The result will be a 2×2 matrix.

Matrix A

123
456
×

Matrix B

78
910
1112

c11: row 1 × column 1

Use row 1 of A, [1, 2, 3], and column 1 of B, [7, 9, 11].

c11 = (1×7) + (2×9) + (3×11) = 58

c12: row 1 × column 2

Use row 1 of A, [1, 2, 3], and column 2 of B, [8, 10, 12].

c12 = (1×8) + (2×10) + (3×12) = 64

c21: row 2 × column 1

Use row 2 of A, [4, 5, 6], and column 1 of B, [7, 9, 11].

c21 = (4×7) + (5×9) + (6×11) = 139

c22: row 2 × column 2

Use row 2 of A, [4, 5, 6], and column 2 of B, [8, 10, 12].

c22 = (4×8) + (5×10) + (6×12) = 154

Final result

AB

5864
139154

How to Determine the Result Size

If A is m×n and B is n×p, then AB is m×p.

3×4 × 4×2 → 3×2
1×3 × 3×1 → 1×1
3×1 × 1×3 → 3×3

Why Matrix Multiplication Order Matters

Matrix multiplication order matters because AB is usually not the same as BA. In this page's example, AB has size 2×2, while BA would have size 3×3. Since the sizes are already different, the two products cannot be equal.

In some cases AB is defined but BA is not defined at all, so always check dimensions before changing the order.

Choose the Right Next Step

Common Mistakes

  • Multiplying entries in the same positions instead of using rows and columns.
  • Forgetting to check the inner dimensions.
  • Writing the wrong size for the result matrix.
  • Using a row from both matrices instead of a row and a column.
  • Assuming AB = BA.
  • Dropping one term when multiplying rectangular matrices.

Frequently Asked Questions

Can any two matrices be multiplied?

No. Two matrices can be multiplied only when the number of columns in the first matrix equals the number of rows in the second matrix.

How do you know the size of the result matrix?

If A is an m×n matrix and B is an n×p matrix, then AB is an m×p matrix. The outside dimensions become the result size.

What does row by column mean?

Row by column means choosing one row from the first matrix, choosing one column from the second matrix, multiplying matching entries, and adding the products.

Does the order of matrix multiplication matter?

Yes. Matrix multiplication order matters because AB and BA can have different sizes, different values, or one order may be undefined.

Is matrix multiplication the same as multiplying matching entries?

No. Matrix multiplication uses dot products of rows and columns. It is not the same as multiplying entries in the same positions.

Learn matrix multiplication more easily in just 2 minutes with this free game.

Matrix Multiplication Game

Solve your matrix instantly with our free calculator.

Open Matrix Calculator →