# A very simple bijection between reals and naturals

Discussion in 'Number Theory' started by Seff, May 7, 2023.

1. ### Seff

Joined:
May 6, 2023
Messages:
11
2
Let the set of natural numbers be denoted by N. Let the set of real numbers between 0 and 1 be denoted by R_01. Let f be a function that maps each natural number n to a real number between 0 and 1, where f(n) is obtained by reversing the digits of n and removing any trailing zeroes. If f(n) has a repeating decimal of the form 0.999..., then increment the digit in the next highest place by 1 and remove the repeating nines. Formally, we can define f as follows:

f: N → R_01

f(n) = 0 if n = 0

f(n) = 0.a1a2a3...an-1an if n > 0, where:

• a1 is the last non-zero digit of n
• a2 is the second-to-last non-zero digit of n
• and so on, until an is the first digit of n.
If f(n) has a repeating decimal of the form 0.999..., then we replace the repeating nines with (a+1) where a is the digit in the next highest place, and remove any trailing zeroes.

To show that f is a bijection between N and R_01, we need to show that it is both injective and surjective.

To show that f is injective, we need to show that if f(m) = f(n) for two natural numbers m and n, then m = n. Suppose f(m) = f(n), where m and n are natural numbers. Then f(m) and f(n) have the same decimal expansion, and so their digits are the same in the same places. This means that m and n have the same digits in the same places when reversed, and so m = n. Therefore, f is injective.

To show that f is surjective, we need to show that for every real number r in R_01, there exists a natural number n such that f(n) = r. Suppose r is a real number in R_01. We can construct a natural number n by taking the decimal expansion of r, reversing it, and adding trailing zeroes if necessary. If the decimal expansion of r ends in repeating nines, we can adjust the digits as described above. Then we have f(n) = r, and so f is surjective.

Therefore, f is a bijection between N and R_01.

Seff, May 7, 2023
2. ### HallsofIvy

Joined:
Nov 6, 2021
Messages:
161
Any integer has a finite number of digits. What do you map a real number that has an infinite number of digits, $\sqrt{2}$ or $\pi$, for example, to?