§ 01What is a Matrix?
A matrix is a rectangular arrangement of numbers, symbols, or expressions arranged in rows and columns. It is one of the central objects of linear algebra, compact, structured, and extraordinarily expressive.
We denote a matrix with an uppercase bold letter, such as A, and refer to its individual entries as aij where i is the row index and j is the column index (both starting from 1). A matrix with m rows and n columns is called an m × n matrix and is said to have size or dimension m × n.
Notice the convention: rows first, columns second. A 2×3 matrix has 2 rows and 3 columns. The entry a23 is in the 2nd row and 3rd column. This row-then-column ordering is consistent throughout all matrix operations.
§ 02Notation, Entries, and Dimension
The entry in row i and column j of matrix A is written aij or [A]ij. We say two matrices are equal if and only if they have the same dimensions and every corresponding entry is equal.
Let A = [[4,−1,2],[0,3,7],[−5,1,0]].
- a11 = 4 (row 1, col 1) · a13 = 2 (row 1, col 3)
- a21 = 0 (row 2, col 1) · a32 = 1 (row 3, col 2)
- The main diagonal entries are a11=4, a22=3, a33=0.
A 3×2 matrix and a 2×3 matrix are never equal, even if they contain the same numbers: their dimensions differ. Equality requires both same size AND matching entries.
§ 03Special Types of Matrices
Certain matrix structures appear so frequently they have dedicated names. Recognising them instantly saves time and unlocks shortcuts.
§ 04Matrix Addition and Scalar Multiplication
These two operations are straightforward: they work entry-by-entry. The key constraint for addition is that both matrices must have identical dimensions.
§ 05Matrix Multiplication
Matrix multiplication is the defining operation of linear algebra, and the one that surprises students most. It is not entry-by-entry. Instead, each entry of the product is a dot product of a row from the left matrix with a column from the right matrix.
Requires: #columns of A = #rows of B. Result size: (rows of A) × (cols of B).
Step-by-Step: Computing AB
- Check compatibility: If A is m×n and B is n×p, AB is defined and has size m×p. If the inner dimensions don't match, the product is undefined.
- For each entry (i,j) in the result: take row i of A and column j of B.
- Compute the dot product: multiply corresponding entries and sum.
- Place the result in position (i,j) of AB.
A = [[1,2],[3,4]], B = [[5,6],[7,8]]. Find AB.
- [AB]11 = row 1 of A · col 1 of B = (1)(5)+(2)(7) = 5+14 = 19
- [AB]12 = row 1 · col 2 = (1)(6)+(2)(8) = 6+16 = 22
- [AB]21 = row 2 · col 1 = (3)(5)+(4)(7) = 15+28 = 43
- [AB]22 = row 2 · col 2 = (3)(6)+(4)(8) = 18+32 = 50
A = [[1,0,2],[−1,3,1]], B = [[3,1],[0,2],[4,−1]]. Inner dimensions both 3 ✓. Result is 2×2.
- [AB]11 = (1)(3)+(0)(0)+(2)(4) = 3+0+8 = 11
- [AB]12 = (1)(1)+(0)(2)+(2)(−1) = 1+0−2 = −1
- [AB]21 = (−1)(3)+(3)(0)+(1)(4) = −3+0+4 = 1
- [AB]22 = (−1)(1)+(3)(2)+(1)(−1) = −1+6−1 = 4
A = [[1,2],[0,1]], B = [[1,0],[3,1]].
- AB = [[1+6, 0+2],[0+3, 0+1]] = [[7,2],[3,1]]
- BA = [[1+0, 2+0],[3+0, 6+1]] = [[1,2],[3,7]]
§ 06The Transpose
The transpose of a matrix A, written Aᵀ, is formed by flipping the matrix over its main diagonal: rows become columns and columns become rows. If A is m×n, then Aᵀ is n×m.
The entry in row i, column j of Aᵀ equals the entry in row j, column i of A.
§ 07The Matrix Equation Ax = b
The most important application of matrix multiplication is representing a linear system as a single equation Ax = b, where A is the coefficient matrix, x is the column vector of unknowns, and b is the right-hand side vector.
System: 2x + 3y − z = 4, x − y + 2z = −1, 3x + y + z = 7.
A = [[2,1],[1,3]], b = [5,10]ᵀ. Check whether x = [1,3]ᵀ is a solution.
- Ax = [[2,1],[1,3]]·[1,3]ᵀ = [(2)(1)+(1)(3), (1)(1)+(3)(3)]ᵀ = [5,10]ᵀ = b ✓
§ 08The Matrix Inverse
For a square matrix A, its inverse A⁻¹ (if it exists) satisfies AA⁻¹ = A⁻¹A = I. The inverse exists if and only if det(A) ≠ 0.
To find the inverse systematically, augment A with the identity matrix and row-reduce until A becomes I: the right side simultaneously becomes A⁻¹.
Swap the main diagonal, negate the off-diagonal, divide by the determinant.
- det(A) = (2)(3)−(5)(1) = 6−5 = 1.
- Swap diagonal, negate off-diagonal: [[3,−5],[−1,2]].
- Divide by det = 1: A⁻¹ = [[3,−5],[−1,2]].
- Verify: AA⁻¹ = [[2·3+5·(−1), 2·(−5)+5·2],[1·3+3·(−1), 1·(−5)+3·2]] = [[1,0],[0,1]] ✓
A = [[1,0,1],[0,2,1],[1,1,2]]. Augment: [A|I] and row reduce.
- R3 ← R3 − R1: [A|I] bottom row becomes [0,1,1|−1,0,1]
- R3 ← R3 − ½R2: bottom row → [0,0,½|−1,−½,1]
- R3 ← 2R3: [0,0,1|−2,−1,2]
- R2 ← R2−R3: [0,2,0|2,3,−2] → R2 ← ½R2: [0,1,0|1,3/2,−1]
- R1 ← R1−R3: [1,0,0|3,1,−1]
§ 09Laws of Matrix Algebra
| Property | Formula | Note |
|---|---|---|
| Associativity of addition | (A+B)+C = A+(B+C) | Always holds |
| Commutativity of addition | A+B = B+A | Always holds |
| Associativity of multiplication | (AB)C = A(BC) | Always holds |
| Distributivity | A(B+C) = AB+AC | Always holds |
| Non-commutativity | AB ≠ BA in general | Critical difference from scalars |
| Transpose of product | (AB)ᵀ = BᵀAᵀ | Order reverses |
| Inverse of product | (AB)⁻¹ = B⁻¹A⁻¹ | Order reverses |
| Zero product anomaly | AB = 0 does NOT require A=0 or B=0 | Unlike scalar multiplication |
§ 10Practice Quiz — Introduction to Matrices
10 questions covering dimensions, entry notation, addition, multiplication, transpose, and special types. Immediate feedback.
Matrix A is 3×4 and matrix B is 4×2. What is the size of AB?
AB is (rows of A) × (cols of B) = 3×2. The inner dimensions (4 and 4) must match for the product to be defined; the outer dimensions (3 and 2) give the result size.
For A = [[3,−1],[2,5]], what is the entry a21?
a21 is the entry in row 2, column 1. Reading the matrix: row 2 is [2, 5], so the first entry is 2.
Compute the (1,2) entry of AB where A = [[2,1],[0,3]] and B = [[1,4],[2,0]].
[AB]12 = row 1 of A · col 2 of B = (2)(4)+(1)(0) = 8+0 = 8.
Which statement about matrix multiplication is always TRUE?
Matrix multiplication is associative: (AB)C = A(BC) always. Commutativity fails, zero-product doesn't imply zero factors, and A² is only defined if A is square.
For A = [[1,2,3],[4,5,6]], what is the size of Aᵀ?
A is 2×3. The transpose Aᵀ flips the dimensions: 3×2. Rows become columns and vice versa.
Compute the full product: [[1,0],[0,1]] × [[3,7],[−2,4]]
The first matrix is the 2×2 identity I. Multiplying any matrix by I leaves it unchanged: IA = A. So the result is [[3,7],[−2,4]].
Which matrix type has all entries below the main diagonal equal to zero?
Upper triangular has zeros below the main diagonal (aij = 0 for i > j). Lower triangular has zeros above (i < j). Diagonal has zeros both above and below.
If A = [[2,5],[1,3]], use the 2×2 inverse formula to find the (1,1) entry of A⁻¹.
det = 2·3−5·1 = 1. Formula: (1/det)·[[d,−b],[−c,a]] = [[3,−5],[−1,2]]. Entry (1,1) = 3.
The formula (AB)ᵀ equals:
(AB)ᵀ = BᵀAᵀ. The order reverses when transposing a product, just like (AB)⁻¹ = B⁻¹A⁻¹. This reversal pattern appears throughout matrix algebra.
Compute 2A − B where A = [[3,1],[0,2]] and B = [[1,4],[−2,0]]. What is the (1,2) entry of the result?
2A = [[6,2],[0,4]]. 2A−B = [[6−1, 2−4],[0−(−2), 4−0]] = [[5,−2],[2,4]]. Entry (1,2) = −2.
Quiz complete!