SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons

Proof Gym PG6 Sets and functions Lesson 3 of 5

ProofLesson PG6.3 in the Proof Gym, stage PG6: Sets and functions. About 30 minutes.

Countable sets

Simulate

Check the claim with numbers

Two finite sets have the same size when a bijection pairs them off (lesson PG6.2). The same idea measures infinite sets. Can the whole numbers Z={…,−2,−1,0,1,2,…}\mathbb{Z} = \{\ldots, -2, -1, 0, 1, 2, \ldots\} be paired off with N={1,2,3,…}\mathbb{N} = \{1, 2, 3, \ldots\}?

Try a list that takes 0 first, then steps out in both directions: 0,1,−1,2,−2,…0, 1, -1, 2, -2, \ldots. As a formula, place nn holds n2\frac{n}{2} for even nn and 1−n2\frac{1 - n}{2} for odd nn.

⌘/Ctrl + Enter runs the cell

The first 11 places hold 0,1,−1,2,−2,…,5,−50, 1, -1, 2, -2, \ldots, 5, -5. The first 2,001 places hold every whole number from −1000-1000 to 1000, each exactly once.

Conjecture

The map f:N→Zf: \mathbb{N} \to \mathbb{Z} with f(n)=n2f(n) = \frac{n}{2} for even nn and f(n)=1−n2f(n) = \frac{1 - n}{2} for odd nn is a bijection. So Z\mathbb{Z} can be listed, like N\mathbb{N}.

The first 2,001 places. The proof must show that every whole number gets exactly one place, however far out.

Countable sets

Take a list s1,s2,s3,…s_1, s_2, s_3, \ldots in which every element of a set SS appears exactly once. It is a bijection from N\mathbb{N} to SS: place nn goes to sns_n.

Rule: Countable

S is countable whenS is finite, or there isa bijection f:N→S\begin{gathered} S \text{ is countable when} \\ S \text{ is finite, or there is} \\ \text{a bijection } f: \mathbb{N} \to S \end{gathered}

A countable set is one whose elements can be listed, each at exactly one place. An infinite countable set is countably infinite: the same size as N\mathbb{N}.

Format 1

Reorder the steps

Here is the proof that ff is a bijection, with its lines shuffled. Put them in order with the arrows, or drag a line by its handle.

  1. Surjective as well: a whole number k≥1k \ge 1 is f(2k)f(2k), and a whole number k≤0k \le 0 is f(1−2k)f(1 - 2k), where 1−2k1 - 2k is odd and at least 1.
  2. For k≥1k \ge 1, an even n=2kn = 2k gives f(n)=k≥1f(n) = k \ge 1, and an odd n=2k−1n = 2k - 1 gives f(n)=1−k≤0f(n) = 1 - k \le 0.
  3. Both even gives n2=n′2\frac{n}{2} = \frac{n'}{2}, and both odd gives 1−n2=1−n′2\frac{1 - n}{2} = \frac{1 - n'}{2}. Either way n=n′n = n'.
  4. So ff is a bijection from N\mathbb{N} to Z\mathbb{Z}, and Z\mathbb{Z} is countable.
  5. Define f:N→Zf: \mathbb{N} \to \mathbb{Z} by f(n)=n2f(n) = \frac{n}{2} for even nn and f(n)=1−n2f(n) = \frac{1 - n}{2} for odd nn.
  6. Injective: if f(n)=f(n′)f(n) = f(n'), that value is either positive or not, so by the line before, nn and n′n' are both even or both odd.

Z\mathbb{Z} looks twice as big as N\mathbb{N}, yet the two have the same size. Infinite sets behave differently from finite ones, so claims about their sizes need proofs.

Simulate

Listing pairs

The pairs of whole numbers, N×N={(m,n):m,n∈N}\mathbb{N} \times \mathbb{N} = \{(m, n) : m, n \in \mathbb{N}\}, fill an infinite grid. List them along diagonals: (1,1)(1, 1), then (1,2),(2,1)(1, 2), (2, 1), then (1,3),(2,2),(3,1)(1, 3), (2, 2), (3, 1), and so on.

Diagonal dd holds the pairs with m+n−1=dm + n - 1 = d. The cell builds the list for the first 100 diagonals and checks a formula for the place of each pair.

⌘/Ctrl + Enter runs the cell

The first 100 diagonals hold 5,050 different pairs, and the formula gives the place of every one. For example, (3,5)(3, 5) sits at place 24.

The last line compares a row-by-row list, which gives the first million places to row 1. Of the 9 pairs with both entries at most 3, it places only 3. The diagonals place all 9 within the first 13 places.

Conjecture

The diagonal listing is a bijection, so N×N\mathbb{N} \times \mathbb{N} is countable. The pair (m,n)(m, n) has the place

p(m,n)=(d−1) d2+m,where d=m+n−1\begin{gathered} p(m, n) = \frac{(d - 1)\,d}{2} + m, \\ \text{where } d = m + n - 1 \end{gathered}

5,050 pairs on 100 diagonals. The proof shows the formula gives every pair one place, and uses every place once.

Format 2

Fill the gap

The proof, with its key steps left out. Type each missing piece as you would a quick answer, such as d^2 or (d+1)/2, then check.

The diagonals. Diagonal dd holds the pairs (1,d),(2,d−1),…,(d,1)(1, d), (2, d - 1), \ldots, (d, 1), listed in order of mm, so it holds dd pairs. Every pair (m,n)(m, n) lies on exactly one diagonal, d=m+n−1d = m + n - 1, at position mm along it.

Where a diagonal starts. Before diagonal dd come diagonals 1 to d−1d - 1. By the arithmetic series of lesson 1.5.2, they hold 1+2+⋯+(d−1)=1 + 2 + \cdots + (d - 1) = pairs. So the pair at position mm on diagonal dd gets place p(m,n)=(d−1)d2+mp(m, n) = \frac{(d - 1)d}{2} + m.

Where it ends. The last pair of diagonal dd, at position m=dm = d, gets place . So diagonal dd fills the block of places from (d−1)d2+1\frac{(d-1)d}{2} + 1 to d(d+1)2\frac{d(d+1)}{2}, one place per pair.

The next block starts right after, since d(d+1)2\frac{d(d+1)}{2} pairs come before diagonal d+1d + 1. So the blocks fill the places 1,2,3,…1, 2, 3, \ldots in turn, with no gaps and no overlaps.

A bijection. So different pairs get different places, and every place is used: pp is a bijection from N×N\mathbb{N} \times \mathbb{N} to N\mathbb{N}. Its inverse, which lists the pairs, is a bijection from N\mathbb{N} to N×N\mathbb{N} \times \mathbb{N}.

A check. The pair (3,5)(3, 5) is on diagonal d=d = , and gets place , as the simulation found.

How to type answers
  • Powers with ^, brackets round a power that is a sum: r^k, r^(k+1).
  • Fractions with / and brackets: (1-r)/(1+r). Multiply with * or side by side: 2k+1.
  • Press Enter in any box to check them all.

The same list, with repeats such as 24=12\frac{2}{4} = \frac{1}{2} skipped, lists every positive fraction mn\frac{m}{n}. So the positive rational numbers are countable too.

Format 3

Find the error

A first attempt that lists the pairs row by row. In the simulation, a million places of this list held only 3 of the 9 pairs with entries up to 3. Find the faulty line.

Lesson PG6.4 shows that some infinite sets cannot be listed at all, however cleverly.

Summary card

  • A set is countable when it is finite or there is a bijection f:N→Sf: \mathbb{N} \to S: a list with every element at exactly one place.
  • Z\mathbb{Z} is countable: list 0,1,−1,2,−2,…0, 1, -1, 2, -2, \ldots, with f(n)=n2f(n) = \frac{n}{2} for even nn and 1−n2\frac{1 - n}{2} for odd nn.
  • N×N\mathbb{N} \times \mathbb{N} is countable: list by diagonals, with (m,n)(m, n) at place (d−1)d2+m\frac{(d - 1)d}{2} + m, where d=m+n−1d = m + n - 1. So are the positive fractions.
  • A list must reach every element after finitely many places. Listing row by row never leaves row 1.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.