Step-by-Step Matrix Multiplication

Learn how to multiply matrices, check dimension compatibility, and perform dot product row-by-column operations.

The Compatibility Rule

Unlike scalar multiplication, you cannot just multiply any two matrices together. They must satisfy a strict dimension compatibility rule: the number of columns in the first matrix must equal the number of rows in the second matrix.

If matrix A has size m × n and matrix B has size p × q, the product AB is defined if and only if:

n = p

The resulting product matrix C will have the size m × q (the outer dimensions of A and B).

The Row-by-Column Dot Product

To calculate the element in Row i, Column j of the product matrix, you take the dot product of Row i of the first matrix and Column j of the second matrix. You multiply corresponding elements and add the results together:

C[i][j] = A[i][0] × B[0][j] + A[i][1] × B[1][j] + ... + A[i][n-1] × B[n-1][j]

Worked Example

Let's multiply a 2x3 matrix A and a 3x2 matrix B:

A =
123
456
B =
78
91
02

The inner dimensions match (3 columns in A, 3 rows in B), so multiplication is valid. The product AB will be a 2x2 matrix C:

The product matrix C = AB is:

2516
7349

Key Algebraic Properties

Go to RREF Calculator