What is a matrix?
Learn more with Tiger
A matrix is a rectangular grid of numbers arranged in rows and columns. Its size is quoted as rows × columns, so a 2 × 3 matrix has two rows and three columns.
Key rule
Addition works entry by entry and needs both matrices to be the same size. Multiplication is different: to multiply A by B the number of columns of A must equal the number of rows of B, and each entry of the product is a row of A combined with a column of B. Matrix multiplication is not commutative, so AB and BA are usually different.
Worked example
Multiplying a 2 × 3 matrix by a 3 × 2 matrix gives a 2 × 2 result, because the inner 3s match and the outer sizes survive. A 2 × 3 times a 2 × 3 is undefined, since 3 does not equal 2.
Check: match inner dimensions before multiplying, and do not assume AB equals BA.