Math basics › Linear algebra

Matrix multiplication

Row times column

Entry (i, j) of AB is row i of A dotted with column j of B: multiply matching entries and add.

Check the sizes

(m × n) times (n × p) gives m × p. The inside numbers must match, or the product does not exist.

Order matters

AB and BA are usually different, and one can exist without the other. Never swap them to make the algebra easier.