AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Matrix Multiplication Lab

Select a cell. Follow its row and column. Add the products.

Your matrices

Select a cell in C to trace how it is built

(2 × 3) × (3 × 2) → (2 x 2)

Inner sizes match: 3 terms per output cell. Shape means rows × columns.

A (2 x 3)

k = 1k = 2k = 3
i = 12-13
i = 2041

Row 1 of A

B (3 x 2)

j = 1j = 2
k = 115
k = 22-2
k = 303

Column 2 of B

C = A × B (2 x 2)

j = 1j = 2
i = 1
i = 2

Selected: C[1,2]

Tab to an output cell; Enter or Space to select.

Build C[1,2]

A dot product multiplies matching pairs, then adds their products.

2 x 5 = 10

Pair 1

Reveal pair 2

Pair 2

Reveal pair 3

Pair 3

Running sum: 10 → …

C[1,2] = 2 x 5 + … = 10 so far

k pairs each position in the row with the same position in the column.

C[1,2] uses row 1 and column 2. Step 1 of 3; running sum 10.

Output shape

A’s rows × B’s columns.

2 x 2

(2 x 3) × (3 x 2) → (2 x 2)

Terms per cell

The shared inner size.

3

3 A columns = 3 B rows

Selected result

Row 1 · Column 2.

21

C[1,2] = 21

Every output cell follows the same rule

4 output cells means 4 row-column dot products.

Incompatible example: (2 x 3) × (2 x 2)
Blocked: inner sizes 3 and 2 differ.

Dimension rule
(m × n) × (n × p) → (m × p)

C[i,j] = Σ A[i,k] × B[k,j], for k = 1 to n. Σ means add all the products. i chooses a row, j a column, and n is the shared size.