Matrix multiplication
Matrix multiplication composes linear maps. Each result entry is a row-column dot product, and the inner dimensions must match.
Definition
Matrix multiplication composes linear maps. Each result entry is a row-column dot product, and the inner dimensions must match.
Intuition
Applying B and then A corresponds to AB, so the order is significant.
Worked example
If A is 2 by 3 and B is 3 by 4, AB is 2 by 4. BA is not defined for those shapes.
The math
For and , .
In machine learning
Check tensor shapes before optimizing a neural layer; transposition mistakes can produce plausible but incorrect values.
Sources
More in Linear algebra
Assembled from the ReLU.chat curated knowledge base. These explanations are concise on purpose; check the sources for anything important.