Matrix Multiplication
Subtopic: Matricies
Matrix multiplication is the workhorse of linear algebra—it computes the composition of linear transformations, solves systems of equations, and powers everything from graphics to neural networks. The rule is simple once you see it: row times column, summed up.
Introduction
Why is matrix multiplication defined the way it is? It's not component-wise (that would be too simple and less useful). Instead, it's designed so that if matrix represents one transformation and represents another, then represents doing first, then .
This connection to function composition is why matrix multiplication is so powerful—and why it's not commutative. The order of transformations matters.
Definition
For and , the product is an matrix where:
Entry of is the dot product of row i of with column j of .
Critical requirement: the number of columns of must equal the number of rows of .
Geometric Interpretation
If represents transformation and represents , then AB represents the composition : first apply , then .
For a vector : . The vector is first transformed by , then the result is transformed by .
This explains why in general: rotating then scaling is different from scaling then rotating.
Step-by-Step Example
Multiply:
(row of ) (column of )
(row of ) (column of )
(row of ) (column of )
(row of ) (column of )
Key Properties
NOT commutative: in general (even when both products exist)
Associative:
Distributive: and
Identity: , where is the identity matrix
Transpose: (note the reversal)
Inverse: (note the reversal)
Matrix-Vector Multiplication
A special case: times ( 1 column vector) gives an vector.
where is column of . So is a linear combination of 's columns!
This column view is often more insightful than the row-dot-column computation.
Dimension Rules
times
The inner dimensions must match; the outer dimensions give the result size.
Memory aid: — the 's cancel.
Computational Cost
Multiplying an matrix by an matrix takes operations using the standard algorithm.
For square matrices, this is .
Faster algorithms exist (Strassen: ), but standard multiplication is usually used in practice due to better constants and numerical stability.
Block Multiplication
Matrices can be partitioned into blocks, and multiplication works block-wise as if blocks were entries:
This is useful for large matrices and parallel computation.
Applications
In graphics, transformations (rotation, scaling, translation) are matrices. Combining transformations = multiplying matrices.
In neural networks, each layer performs , where is a weight matrix. Deep networks are chains of matrix multiplications.
In solving linear systems , understanding matrix-vector multiplication reveals the column space and solution structure.
In Markov chains, powers of the transition matrix give the -step transition probabilities.
Summary
Matrix multiplication combines row–column dot products to produce a new matrix. It represents composition of linear transformations, explaining its non-commutativity. Key properties: associative, distributive, and transpose and inverse reverse order. The column view ( as a linear combination of columns) provides geometric insight. Matrix multiplication is for square matrices and underlies applications from graphics to machine learning.