Matrix Multiplication
How to multiply matrices — rows times columns — and why this operation encodes function composition and systems of linear maps.
2×3×3×2=2×2— inner dims match ✓
A (2×3)
120314
B (3×2)
210312
C = AB (2×2)
271014
Hover a result cell to see the row·column dot product
Definition
To multiply matrices (size ) and (size ), the number of columns of must equal the number of rows of . The result has size .
The entry of is the dot product of row of with column of :
Matrix multiplication is:
- Associative:
- Distributive:
- NOT commutative: in general
Key properties
- Associative: — a chain of products can be grouped however you like
- Distributive over addition: and
- Scalar compatibility: for any scalar
- Not commutative: in general — order matters
- The identity matrix acts as a multiplicative identity:
Common mistakes
- Assuming : matrix multiplication only commutes in special cases (e.g. both diagonal, or one is the identity) — never assume it by default
- Mismatched dimensions: is only defined when — always check the inner dimensions match
- in general: , which simplifies to only if and commute
2×2 multiplication
Try it
Show that matrix multiplication is not commutative: find matrices and with .
Solution
, .
, . So .
Related concepts
Needs first
Uses this