Multiplying matrices is how you chain two or more linear transformations into one. If you already know how a single matrix moves a vector, this is the next step: applying a rotation and then a scaling, or any sequence you need, using one combined matrix as the result.
What does matrix multiplication actually represent?
Think of every matrix as a set of instructions for where the basis vectors i hat and j hat land after a transformation. When you multiply matrix A by matrix B, you are not doing an element by element operation. You are composing transformations: first you apply B to space, and then you apply A on top of that already transformed space.
That order matters more than it looks. Composition reads from right to left, so in A por B, B happens first and A happens second [01:00]. Keep that direction in your head every time you see two matrices side by side.
What does it mean to compose two matrices? It means applying one transformation after another to the same space. In A·B, you transform with B first and then with A, and the resulting matrix encodes both moves at once.
When is matrix multiplication even possible?
Before you compute anything, check the dimensions. The number of columns of the first matrix must equal the number of rows of the second one. If those inner dimensions do not match, the operation simply cannot happen [01:35].
The resulting matrix takes the outer dimensions. If A is m × k and B is k × n, then A·B is m × n. This compatibility check is the first habit to build before multiplying.
How do you compute A·B step by step?
Let's use a concrete example with two 2×2 matrices [02:00]:
- Matrix A is a shear: first column (1, 0), second column (1, 1).
- Matrix B is a 90 degree left rotation: first column (0, 1), second column (-1, 0).
- Goal: find C = A·B, meaning rotate first, then shear.
The trick is to read B as two column vectors and apply the matrix vector product you already know, one column at a time.
For the first column of C, multiply A by B's i hat, which is (0, 1). Using the linear combination view, that equals 0·(1, 0) + 1·(1, 1) = (1, 1). That is the first column of C.
For the second column of C, multiply A by B's j hat, which is (-1, 0). That equals -1·(1, 0) + 0·(1, 1) = (-1, 0). That is the second column of C.
So C has first column (1, 1) and second column (-1, 0). Visually, i hat and j hat first rotate to the left and then stretch with the shear, landing exactly on those new coordinates [03:30].
Why do we read matrix products from right to left? Because the matrix closest to the vector acts first. In A·B·v, B transforms v, then A transforms the result. Reversing the order changes the meaning of the composition.
What properties should you remember when multiplying matrices?
Three properties shape how you can manipulate these expressions in practice [04:15]:
- It is not commutative. A·B is generally different from B·A. If B is a rotation and A is a scaling, rotating first and then scaling is not the same as scaling first and then rotating.
- It is associative. (A·B)·C equals A·(B·C), so you can regroup the parentheses without changing the result.
- It is distributive over addition and subtraction. A·(B + C) equals A·B + A·C, and the same logic applies with subtraction.
These rules let you simplify long chains of transformations safely, as long as you never swap the order of two matrices that were not commutative to begin with.
How can you practice composing transformations yourself?
Here is the exercise to lock in the idea [05:10]. Take matrix A = [[1, 1], [0, 1]] as a shear and matrix B = [[2, 0], [0, 2]] as a uniform scaling.
- Compute C = A·B, applying scaling first and then shear.
- Compute D = B·A, applying shear first and then scaling.
- Compare C and D to confirm with your own numbers that matrix multiplication is not commutative.
If you can, sketch both results on a grid and watch how i hat and j hat end up in different places. Share your matrices and your drawings in the comments so we can compare answers.