Abstract functions, composition, identity & inverses.
Reflexive, symmetric, antisymmetric, transitive. Matrices & digraphs.
Equivalence classes, partitions. Order relations.
A sequence is simply a function a : ℕ → ℝ — the same functions you studied in Week 6, but now the input is always a natural number (an index), and the output is the n-th term.
Today we also learn mathematical induction — the main proof tool for statements about all natural numbers.
Which of these look like a pattern you could continue?
| List | Next term? | Pattern? |
|---|---|---|
| 2, 4, 6, 8, 10, … | 12 | Add 2 each time |
| 1, 3, 9, 27, 81, … | 243 | Multiply by 3 each time |
| 1, 1, 2, 3, 5, 8, 13, … | 21 | Sum of previous two |
| 1, 4, 9, 16, 25, … | 36 | Perfect squares |
Each list has a rule that generates the next number. A sequence is just an infinite list generated by such a rule.
We label each position with an index: the 1st term is a1, the 2nd is a2, and so on.
Take the even numbers: 2, 4, 6, 8, 10, …
The subscript n is the index (position). The value an is the n-th term.
| n | an = 2n | Value |
|---|---|---|
| 1 | 2 × 1 | 2 ✔ |
| 2 | 2 × 2 | 4 ✔ |
| 3 | 2 × 3 | 6 ✔ |
| 100 | 2 × 100 | 200 |
✔ We can find the 100th term instantly — no counting!
Let's use: 3, 7, 11, 15, 19, … (add 4 each time, starting at 3)
| n | 4n − 1 | |
|---|---|---|
| 1 | 4(1)−1 = 3 | ✔ |
| 2 | 4(2)−1 = 7 | ✔ |
| 3 | 4(3)−1 = 11 | ✔ |
Advantage: Jump straight to any term. a50 = 4(50)−1 = 199.
| Step | Calculation | Value |
|---|---|---|
| a1 | given | 3 |
| a2 | 3 + 4 | 7 |
| a3 | 7 + 4 | 11 |
Advantage: Makes the rule crystal clear — add 4 each time.
Let's trace through together. Sequence: a1 = 1, an = 2 × an−1
Rule: each term is double the previous term.
| n | Calculation | Value an | What we just did |
|---|---|---|---|
| 1 | given | 1 | Base case — start here |
| 2 | 2 × a1 = 2 × 1 | 2 | Apply rule once |
| 3 | 2 × a2 = 2 × 2 | 4 | Apply rule again |
| 4 | 2 × a3 = 2 × 4 | 8 | Apply rule again |
| 5 | 2 × a4 = 2 × 8 | 16 | Apply rule again |
1, 2, 4, 8, 16, … — these are powers of 2!
Can you guess the closed form? → an = 2n−1
To use the recursive rule, you must know the previous term. You can't find a100 without computing all 99 terms before it — that's why a closed form is so valuable.
A sequence is a function a : ℕ → ℝ. We write an (or a(n)) for the value at index n.
| an | First terms |
|---|---|
| 2n | 2, 4, 6, 8, … |
| n² | 1, 4, 9, 16, … |
| 3n | 3, 9, 27, 81, … |
| 2n−1 | 1, 3, 5, 7, … |
Arithmetic:
a1=5, an=an−1+3
→ 5, 8, 11, 14, …
Geometric:
a1=2, an=5·an−1
→ 2, 10, 50, 250, …
Does n start at 0 or 1?
an = 2n−1, n≥1 → 1, 3, 5, …
an = 2n−1, n≥0 → −1, 1, 3, …
Always state where n starts!
Imagine: each new rabbit pair = all pairs from two months ago + all pairs from last month.
Let's build it together, one step at a time:
| n | Calculation | Fn |
|---|---|---|
| 1 | given | 1 |
| 2 | given | 1 |
| 3 | F2 + F1 = 1 + 1 | 2 |
| 4 | F3 + F2 = 2 + 1 | 3 |
| 5 | F4 + F3 = 3 + 2 | 5 |
| 6 | F5 + F4 = 5 + 3 | 8 |
| 7 | F6 + F5 = 8 + 5 | 13 |
Because Fn needs the two terms before it. Without both F1 and F2, we can't start the chain. Try to compute F3 with only F1 — you can't!
Imagine someone claims: "The sum 1+2+3+…+n always equals n(n+1)/2."
| n | Actual sum | n(n+1)/2 | |
|---|---|---|---|
| 1 | 1 | 1 | ✔ |
| 2 | 1+2=3 | 3 | ✔ |
| 3 | 1+2+3=6 | 6 | ✔ |
| 4 | 1+2+3+4=10 | 10 | ✔ |
| 5 | 1+…+5=15 | 15 | ✔ |
There are infinitely many natural numbers. Checking 5 cases (or even 5 million) tells us nothing about n = 1,000,000 or n = 10100.
Line up infinitely many dominoes. If:
then all dominoes fall — even the millionth!
We want to prove: "Statement P(n) is true for every natural number n."
Step 1 Base case
Show that P(1) is true.
(Push the first domino.)
Step 2 Inductive step
Show: if P(k) is true, then P(k+1) must also be true.
(Each domino knocks the next.)
Step 1 gives us P(1). Step 2 (applied to k=1) gives P(2). Step 2 again (k=2) gives P(3). Step 2 again (k=3) gives P(4). We can reach any n. This is the power of induction.
In Step 2, when we say "assume P(k) is true" — that assumption is called the Induction Hypothesis (IH). We then use it to derive that P(k+1) must also be true.
If (1) P(1) is true, and (2) for all k≥1, P(k) ⇒ P(k+1), then P(n) is true for all n≥1.
Every induction proof follows the same 5-step structure:
Never assume what you're trying to prove! In the inductive step, you assume P(k) (about k), and prove P(k+1) (about k+1). These are different statements.
Theorem: For all n≥1, 1 + 2 + 3 + ··· + n = n(n+1)/2.
The IH tells us the sum of the first k terms. We need the sum of the first k+1 terms.
The difference is just one extra term: (k+1).
So:
(sum to k+1) = (sum to k) + (k+1)
= k(k+1)/2 + (k+1)
← this is where we use the IH!
We have (from IH): 1+2+…+k = k(k+1)/2
We want: 1+2+…+k+(k+1) = (k+1)(k+2)/2
We wrote the sum of k+1 terms as (sum of k terms) + one extra term, then applied the IH. This pattern — split off the last term, apply IH — works in almost every induction proof on sums.
Theorem: For all n≥0, 3 divides (n³ − n).
| n | n³−n | Divisible by 3? |
|---|---|---|
| 0 | 0 | Yes (0 = 3×0) ✔ |
| 1 | 0 | Yes (0 = 3×0) ✔ |
| 2 | 6 | Yes (6 = 3×2) ✔ |
| 3 | 24 | Yes (24 = 3×8) ✔ |
Looks true — but we need a proof for ALL n.
Problem: Fibonacci needs the two previous terms — ordinary IH only gives you one. What do we do?
IH: Assume P(k) is true.
You only get P(k) — the single previous case.
IH: Assume P(1), P(2), …, P(k) are ALL true.
You get every previous case — use whichever you need.
Base cases (n=1,2):
F1=1 < 21=2 ✔
F2=1 < 22=4 ✔
IH (strong): Assume Fj < 2j for all j ≤ k.
Step:
We used the IH for both Fk and Fk−1.
Consider a loop that adds up 1+2+…+n:
s = 0 i = 1 while i <= n: s = s + i i = i + 1 # goal: s == n*(n+1)/2
| i | s after step |
|---|---|
| 1 | 0+1=1 |
| 2 | 1+2=3 |
| 3 | 3+3=6 |
| 4 | 6+4=10 = 4×5/2 ✔ |
After k iterations of the loop, s = k(k+1)/2.
Suppose we have: a0=1, an=3an−1
| n | an |
|---|---|
| 0 | 1 |
| 1 | 3 |
| 2 | 9 |
| 3 | 27 = 33 |
Clearly: an = 3n. The trick: try an = rn.
For an = c1an−1 + c2an−2:
r²−c1r−c2=0an=Ar1n+Br2nThis gives exact integers despite the √5!
7.A Loop invariants
Prove correctness of while loops using induction on the iteration count.
7.B Linear recurrence
Convert recursive definitions to closed forms via characteristic equations.
Counting: product rule, permutations, combinations, binomial theorem.
Covers Weeks 5–7. Induction proofs take practice — start early! Optional questions on 7.A and 7.B are good project material.