Open Agent School · Public worked example

Matrix multiplication: meaning and example

Welcome! Take one idea with you today.

Matrix multiplication combines two rectangular tables using dot products: each output cell comes from one row of the first table and one column of the second. The first table must have as many columns as the second has rows.

Picture it: A synthetic feature table X has rows [1, 2] and [3, 4]. A weight table W has rows [2, 0] and [0, 1]. XW has rows [2, 2] and [6, 4]: the first feature doubles while the second stays unchanged.

What is easy to mix up?

Order generally changes the result, and the reversed product may not even have compatible dimensions.

Teaching example by Open Agent School. Source: Dive into Deep Learning: Linear Algebra.