# Lecture 3: The Good Bijections and the Bad Bijections

First, a good bijection:

Let's look at another infinite set, the rational numbers, the numbers that can be written as a fraction. We are going to again try to find a bijection between the naturals and the the rationals, that is the numbers that can be writen as fractions, that are greater than `0`.

We are going to start by putting the rationals that are more than zero in an infinite grid, by reducing each rational, so that the numerator and denominator have no common factors, then we will put the rational in the row of the grid that corresponds to the denominator in the reduced form of the fraction. Then we will line up the fractions in order (smallest to biggest) in each row. Now we have a grid that looks something like this:

```
1     2     3    4    5    6    7   ...

1/2  3/2  5/2  7/2  9/2  11/2  13/2 ...

1/3  2/3  4/3  5/3  7/3  8/3   10/3 ...

1/4  3/4  5/4  7/4  9/4  11/4  13/4 ...

1/5  2/5  3/5  4/5  6/5  7/5   8/5  ...

.

.

.

```

We are going to find each of these fractions a buddy in naturals by walking through the grid starting in the upper left hand corner and zig-zagging through the grid, to get one list in order: `1, 2, 1/2, 1/3, 3/2, 3, 4, 5/2, 2/3, 1/4, 1/5, 3/4, 4/3, 7/2, 5, ...`

Now, we match this list up with the list of the naturals in order:

```
1    2   1/2  1/3  3/2    3    4   5/2 ...

|    |    |    |     |    |    |    |  |||

0    1    2    3     4    5    6    7  ...

```

Given a natural, to find its rational buddy, we go to the grid and follow as many places through our zig-zagging line as the natural is away from zero and read off the rational that we find there.

Now lets try the understand another set of numbers that don't have such an obvious bijection with the naturals, but also are certainly not a finite set of numbers that we can obviously count. These are the numbers between 0 and 1 (including 0 and 1), both the rational ones and the irrational ones, the non-repeating, non-terminating decimals. Now, certainly we can find every natural number a buddy in the numbers between `0` and `1`, for example by giving the number `n` the buddy `1/n` (except for `0`, since `1/0` doesn't make any sense, so we can just buddy `0` up with `0`). Now we have a bit of a problem, because we have a lot of numbers left the numbers between `0` and `1`, but no numbers in the naturals left to buddy them with for a bijection. For example, this attempt at a bijection hasn't found a buddy for `2/3` or `3/4`, let alone any of the irrational numbers between `0` and `1`.
We discovered in our last example that it might take some cleverness to come up with a bijection, so just because we haven't found one that works doens't mean that there won't be one out there somewhere in the world that we haven't figured out yet. For example, if we have started out by matching `0` with `0` and `n` with `1/n` in trying to find a bijection between the rationals and the naturals, we would have been in trouble, so we can never be too sure that just because we haven't found a bijection that works doesn't mean that one doesn't exist.