Rectangular Arrays of Numbers
A matrix is a rectangular array of numbers in rows and columns; an matrix has rows and columns. Matrices represent linear systems, transformations, and data — one of the central objects of linear algebra.
The operations:
- Addition — two matrices of the same shape add entry by entry.
- Scalar multiplication — multiply every entry by a number.
- Matrix multiplication — the important, non-obvious one. The product is defined only when the number of columns of equals the number of rows of (the inner dimensions match). Entry of is the dot product of row of with column of . An times an matrix gives an result.
Matrix multiplication has crucial quirks:
- It is not commutative — in general , and often only one order is even defined.
- It is associative: .
- The identity matrix (ones on the diagonal, zeros elsewhere) satisfies , playing the role of 1.
- Some square matrices have an inverse with ; those are the invertible (nonsingular) matrices.
The "row-times-column" rule looks strange until you know its purpose: a matrix represents a linear transformation, and matrix multiplication composes transformations. That is why the rule is exactly right, and why order matters — applying then differs from then , just as function composition does.
Common pitfall: assuming matrix multiplication is commutative, or multiplying entry-by-entry like addition. In general (order matters, and often only one order is defined). And the product is not formed by multiplying corresponding entries — each result entry is a dot product of a row and a column, so the inner dimensions must match ('s columns 's rows).
Row i of A sweeping across column j of B, each pair multiplied and summed into the accent (i,j) entry of AB — the row-times-column rule.