Skip to content
All apps

Matrix multiplication

About this app

A·B as composition: three columns Original | B·v | A·B·v show how two linear maps are chained — with a swap button for A·B ≠ B·A.

The idea

The product A·B of two matrices describes doing two linear maps one after the other: first B, then A. For every vector, (A·B)·v = A·(B·v), which is why a matrix product is read from right to left. In general the order matters, A·B ≠ B·A: rotating and then shearing gives a different result from shearing and then rotating. The determinant, on the other hand, always satisfies det(A·B) = det(A)·det(B), because the area or volume factors multiply.

What you see

Three panels sit side by side: the original, the intermediate result B·v and the final result A·B·v. Coloured points let you follow the same vectors through all three stages. A and B each have their own input grid with determinant and presets such as rotation, scaling, shear, reflection and projection, in 2D and 3D. A separate panel shows the product matrix A·B with det(A·B) and the rule det(A·B) = det(A)·det(B).

Things to try

Set B to a 90° rotation and A to a shear and look at the result. Then press the swap button in the A·B panel: the picture changes because order matters. Also try pairs where swapping makes no difference, such as two rotations in the plane, or scaling by 2 combined with any matrix. If you choose a projection for B, det(B) = 0, and det(A·B) stays 0 whatever A is.

Frequently asked questions

Why is matrix multiplication not commutative?
Because A·B means “first B, then A”, and the order of geometric transformations matters. A rotation followed by a shear moves points somewhere different from a shear followed by a rotation. There are special cases with A·B = B·A, for example two rotations about the same centre in the plane, or multiples of the identity matrix.
In which order do the matrices act in A·B·v?
From right to left: v is first multiplied by B, and the result is then multiplied by A. This follows from (A·B)·v = A·(B·v), the associative law of matrix multiplication.
Why is det(A·B) equal to det(A)·det(B)?
The determinant is the signed factor by which a map scales areas or volumes. When two maps are applied in sequence, these factors multiply. So if either matrix is singular, the product is singular too.
What does the Matrix Multiplication app show?
It shows the original, B·v and A·B·v in three panels, in 2D or 3D. You set A and B yourself or use presets, see the product matrix with its determinant, and can swap A and B with one button.

Subject: Linear algebra

More from Linear algebra

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps