Definition · Size and equalityAn m × n matrix has m rows and n columns. Two matrices are equal when they have the same size and agree in every position. There is no notion of two matrices of different sizes being equal.
Definition · Sum and scalar multipleFor matrices of the same size, A + B is the matrix whose entry in each position is the sum of the entries of A and B in that position. For a number k, the matrix kA has every entry of A multiplied by k.
A number acting on a matrix this way is called a scalar, to distinguish it from a 1 × 1 matrix, which is a different object.
A = 2 −1 0 B = 1 6 −2
4 3 5 0 −3 1
A + B = 3 5 −2 3A = 6 −3 0
4 0 6 12 9 15
Addition inherits everything from the numbers, position by position: A + B = B + A, (A + B) + C = A + (B + C), the zero matrix of the right size adds nothing, and A + (−A) is that zero matrix. Nothing here requires attention.
The product
Definition · Matrix productLet A be m × n and B be n × p. The product AB is the m × p matrix whose entry in row i, column j is a₁b₁ + a₂b₂ + … + aₙbₙ, where a₁, …, aₙ is row i of A and b₁, …, bₙ is column j of B.
If the row length of A is not the column height of B, the product does not exist. It is not zero and it is not approximately anything: there is no such matrix.
The shape rule is easier to use than to state. Write the two sizes side by side, (m × n)(n × p). If the inner pair match, they cancel and the outer pair give the size of the answer. If they do not match, stop.
C = 1 2 0 D = 2 1
3 −1 4 0 −3
5 2
C is 2 × 3, D is 3 × 2 → CD is 2 × 2
row 1, col 1 : 1(2) + 2(0) + 0(5) = 2
row 1, col 2 : 1(1) + 2(−3) + 0(2) = −5
row 2, col 1 : 3(2) + (−1)(0) + 4(5) = 26
row 2, col 2 : 3(1) + (−1)(−3) + 4(2) = 14
CD = 2 −5 DC exists too, and is 3 × 3
26 14
The definition looks arbitrary until a system is written with it. Take the coefficient matrix of the system in “Systems in Three Variables”, a column of the three unknowns, and a column of the three constants. The product of the first two is a column whose entries are the left-hand sides of the three equations, so the whole system is the single statement Ax = b.
1 1 1 x 6
2 −1 3 y = 9
−1 2 4 z 15
at (1, 2, 3): 1(1) + 1(2) + 1(3) = 6 ✓
2(1) − 1(2) + 3(3) = 9 ✓
−1(1) + 2(2) + 4(3) = 15 ✓
Even when both products exist, order must be preserved: AB and BA can have different sizes or different entries. The arithmetic lesson here is deliberately narrow — decide existence, state the output size, and build each entry from the named row and column. “Inverse Matrices” introduces the identity and inverse when a system needs a matrix operation to be undone.