Linear Algebra · Topic 02 of 05

Introduction to Matrices — Grids That Encode Linear Structure

A matrix is a rectangular array of numbers, but beneath its grid lies a powerful structure for representing linear systems, transformations, and data. Every operation you perform on a matrix carries precise geometric and algebraic meaning.

Share this page

§ 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.

A (2×3 matrix)
a11a12a13 a21a22a23
Row i, Column j → entry aij

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.

Why Matrices? Matrices compress an entire system of linear equations into a single object. The system 2x + 3y = 5, x − y = 1 becomes the matrix equation Ax = b where A = [[2,3],[1,−1]], x = [x,y]ᵀ, and b = [5,1]ᵀ. All the structure of the system lives in A.

§ 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.

Example 1Identifying entries in a 3×3 matrix

Let A = [[4,−1,2],[0,3,7],[−5,1,0]].

  1. a11 = 4 (row 1, col 1)  ·  a13 = 2 (row 1, col 3)
  2. a21 = 0 (row 2, col 1)  ·  a32 = 1 (row 3, col 2)
  3. The main diagonal entries are a11=4, a22=3, a33=0.
Dimension: 3 × 3 (square matrix)
Example 2Dimensions and equality

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.

A = B requires: same dimensions AND aij = bij for all i, j

§ 03Special Types of Matrices

Certain matrix structures appear so frequently they have dedicated names. Recognising them instantly saves time and unlocks shortcuts.

Square
m = n
Same number of rows and columns. Only square matrices have determinants and can be inverted.
Row Vector
1 × n
A single row. Written as [a b c].
Column Vector
m × 1
A single column. The standard form for solution vectors x in Ax = b.
Zero Matrix
All zeros
Every entry is 0. Plays the role of zero in matrix addition (additive identity).
Identity Matrix I
1s on diagonal
Square matrix with 1s on the main diagonal and 0s elsewhere. AI = IA = A always.
Diagonal
Off-diag = 0
Only the main diagonal entries can be non-zero. Easy to raise to powers: Dⁿ = diag(d₁ⁿ,…,dₙⁿ).
Upper Triangular
0s below diag
All entries below the main diagonal are zero. Row echelon form is upper triangular.
Symmetric
A = Aᵀ
Equal to its own transpose. Every entry aij = aji.
Identity I₃
100 010 001
Upper Triangular
314 027 005
Symmetric
123 256 369

§ 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.

Matrix Addition
[A + B]ij = aij + bij
Add corresponding entries. Matrices must be the same size.
Example 3Add two 2×3 matrices
123456
+
70−12−34
=
822 6210
Each entry added position by position
Scalar Multiplication
[kA]ij = k · aij
Multiply every entry by the scalar k. Any size matrix allowed.
Example 4Scalar multiplication: 3 × A
3 ×
2−104
=
6−3 012
Every entry multiplied by 3

§ 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.

Matrix Multiplication Rule
[AB]ij = Σk aik · bkj
Row i of A dotted with column j of B gives entry (i,j) of AB.
Requires: #columns of A = #rows of B.   Result size: (rows of A) × (cols of B).

Step-by-Step: Computing AB

  1. 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.
  2. For each entry (i,j) in the result: take row i of A and column j of B.
  3. Compute the dot product: multiply corresponding entries and sum.
  4. Place the result in position (i,j) of AB.
Row 2 of A (teal) · Column 3 of B (gold) → entry (2,3) of AB = cr + du
Example 52×2 matrix multiplication

A = [[1,2],[3,4]], B = [[5,6],[7,8]]. Find AB.

  1. [AB]11 = row 1 of A · col 1 of B = (1)(5)+(2)(7) = 5+14 = 19
  2. [AB]12 = row 1 · col 2 = (1)(6)+(2)(8) = 6+16 = 22
  3. [AB]21 = row 2 · col 1 = (3)(5)+(4)(7) = 15+28 = 43
  4. [AB]22 = row 2 · col 2 = (3)(6)+(4)(8) = 18+32 = 50
AB = [[19, 22], [43, 50]]
Example 6Non-square multiplication: (2×3)(3×2) → (2×2)

A = [[1,0,2],[−1,3,1]], B = [[3,1],[0,2],[4,−1]]. Inner dimensions both 3 ✓. Result is 2×2.

  1. [AB]11 = (1)(3)+(0)(0)+(2)(4) = 3+0+8 = 11
  2. [AB]12 = (1)(1)+(0)(2)+(2)(−1) = 1+0−2 = −1
  3. [AB]21 = (−1)(3)+(3)(0)+(1)(4) = −3+0+4 = 1
  4. [AB]22 = (−1)(1)+(3)(2)+(1)(−1) = −1+6−1 = 4
AB = [[11, −1], [1, 4]]
Matrix Multiplication is NOT Commutative In general, AB ≠ BA. Even when both products are defined, they usually give different results. Always check: "left times right" — the order matters. This is one of the most important differences between matrix arithmetic and ordinary number arithmetic.
Example 7AB ≠ BA: showing non-commutativity

A = [[1,2],[0,1]], B = [[1,0],[3,1]].

  1. AB = [[1+6, 0+2],[0+3, 0+1]] = [[7,2],[3,1]]
  2. BA = [[1+0, 2+0],[3+0, 6+1]] = [[1,2],[3,7]]
AB = [[7,2],[3,1]] ≠ BA = [[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.

Transpose Definition
[Aᵀ]ij = aji

The entry in row i, column j of Aᵀ equals the entry in row j, column i of A.

Example 8Transpose of a 2×3 matrix
A (2×3)
123 456
→ Aᵀ =
Aᵀ (3×2)
14 25 36
Rows become columns, columns become rows
Key Transpose Properties (Aᵀ)ᵀ = A  ·  (A+B)ᵀ = Aᵀ+Bᵀ  ·  (kA)ᵀ = kAᵀ  ·  (AB)ᵀ = BᵀAᵀ (order reverses!)  ·  A is symmetric if A = 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.

Example 9Convert a system to matrix form Ax = b

System: 2x + 3y − z = 4, x − y + 2z = −1, 3x + y + z = 7.

A
23−1 1−12 311
x
xyz
=
b
4−17
Three equations compressed into one matrix equation
Example 10Verify a solution to Ax = b

A = [[2,1],[1,3]], b = [5,10]ᵀ. Check whether x = [1,3]ᵀ is a solution.

  1. Ax = [[2,1],[1,3]]·[1,3]ᵀ = [(2)(1)+(1)(3), (1)(1)+(3)(3)]ᵀ = [5,10]ᵀ = b ✓
x = [1, 3]ᵀ is a valid solution

§ 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⁻¹.

2×2 Inverse Shortcut
[[a,b],[c,d]]⁻¹ = (1/(ad−bc)) · [[d,−b],[−c,a]]

Swap the main diagonal, negate the off-diagonal, divide by the determinant.

Example 11Find A⁻¹ for A = [[2, 5], [1, 3]]
  1. det(A) = (2)(3)−(5)(1) = 6−5 = 1.
  2. Swap diagonal, negate off-diagonal: [[3,−5],[−1,2]].
  3. Divide by det = 1: A⁻¹ = [[3,−5],[−1,2]].
  4. Verify: AA⁻¹ = [[2·3+5·(−1), 2·(−5)+5·2],[1·3+3·(−1), 1·(−5)+3·2]] = [[1,0],[0,1]] ✓
A⁻¹ = [[3, −5], [−1, 2]]
Example 12Row reduction to find inverse of 3×3

A = [[1,0,1],[0,2,1],[1,1,2]]. Augment: [A|I] and row reduce.

  1. R3 ← R3 − R1: [A|I] bottom row becomes [0,1,1|−1,0,1]
  2. R3 ← R3 − ½R2: bottom row → [0,0,½|−1,−½,1]
  3. R3 ← 2R3: [0,0,1|−2,−1,2]
  4. R2 ← R2−R3: [0,2,0|2,3,−2] → R2 ← ½R2: [0,1,0|1,3/2,−1]
  5. R1 ← R1−R3: [1,0,0|3,1,−1]
A⁻¹ = [[3,1,−1],[1,1,−1],[−2,−1,2]] (verify: AA⁻¹ = I)

§ 09Laws of Matrix Algebra

PropertyFormulaNote
Associativity of addition(A+B)+C = A+(B+C)Always holds
Commutativity of additionA+B = B+AAlways holds
Associativity of multiplication(AB)C = A(BC)Always holds
DistributivityA(B+C) = AB+ACAlways holds
Non-commutativityAB ≠ BA in generalCritical difference from scalars
Transpose of product(AB)ᵀ = BᵀAᵀOrder reverses
Inverse of product(AB)⁻¹ = B⁻¹A⁻¹Order reverses
Zero product anomalyAB = 0 does NOT require A=0 or B=0Unlike scalar multiplication

§ 10Practice Quiz — Introduction to Matrices

10 questions covering dimensions, entry notation, addition, multiplication, transpose, and special types. Immediate feedback.

Score: 0 / 0
Q1 of 10

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.

Q2 of 10

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.

Q3 of 10

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.

Q4 of 10

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.

Q5 of 10

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.

Q6 of 10

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]].

Q7 of 10

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.

Q8 of 10

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.

Q9 of 10

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.

Q10 of 10

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!

Cookie Settings