Log inStart free
LESSON 2.03 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Matrix multiplication

One matrix product, built row by column and then layer by layer.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 2.03 · MATRIX BAYA 2×3 @ B 3×2 → C 2×2
01
Stage 1 of 6 · Match the shapes
The inner sizes, 3 and 3, match, so C is 2 × 2.
Explain it simply

Look at the two inner sizes: the columns of A and the rows of B. Both are 3, so they match. The outer sizes give the shape of C: 2 rows from A and 2 columns from B.

A has 2 rows and 3 columns. B has 3 rows and 2 columns. C will have 2 rows and 2 columns.

left matrixright matrixproduct and resultzerono partner
matricesshapes22130−1−232−112A 2 × 3B 3 × 2C 2 × 21212312312(2 × 3)@(3 × 2)→2 × 2inner 3 = 34 entriesmatricesshapes22130−1−232−112A 2 × 3B 3 × 2C 2 × 21212312312(2 × 3)@(3 × 2)→2 × 2inner 3 = 34 entries
Toy: A is 2 × 3, B is 3 × 2 · small integers from a seeded generator · NumPy's @
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
(m×k) (k×n)→m×n(\sy{m}{data}{m} \times \sy{k}{ink}{k})\,(\sy{k}{ink}{k} \times \sy{n}{param}{n}) \rightarrow \sy{c}{out}{m \times n}
(2×3) (3×2)→2×2(2 \times 3)\,(3 \times 2) \rightarrow 2 \times 2

Inner sizes must match; outer sizes give the result's shape.

Common mix-ups

MYTHA @ B and B @ A give the same matrix.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01In B @ A, how many entries does the result have?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.