3

How would one find a function from $\mathbb N$ to $\mathbb N \times \mathbb N \times \mathbb N$ that is both one-to-one and onto?

Julien
  • 44,791
Nshwnensh
  • 31
  • 1
  • The answer to the question in the title is: yes there is a bijection. It may be difficult to exhibit the bijection by a formula though. Try finding a bijection from $\mathbb{N}$ to $\mathbb{N\times N}$ by writing the elements of the latter in the form of an infinite matrix first. –  Apr 15 '13 at 01:21
  • Right. Just mimic Cantor's enumeration of the rationals. – dezign Apr 15 '13 at 01:23
  • as Shahab's comment suggests, it is very instructive to consider a bijection from $\mathbb{N} \to \mathbb{N} \times \mathbb{N}$ first; it forms an infinite matrix. The bijection to $\mathbb{N} \times \mathbb{N} \times \mathbb{N}$ can then be generalized from the first case with a "3D" matrix. That is the intuition of what's going on here, at any rate. – Coffee_Table Apr 15 '13 at 01:27

6 Answers6

5

Suppose that $f$ is a bijection from $\Bbb N\times \Bbb N$ to $\Bbb N$. Then $g(a,b,c) = f(a,f( b,c))$ is a bijection from $\Bbb N\times \Bbb N\times \Bbb N$ to $\Bbb N$.

So it suffices to find a bijection from $\Bbb N\times \Bbb N$ to $\Bbb N$. Perhaps you already know one.

If not, that question has been answered on this site many times; try here or here for example.

MJD
  • 65,394
  • 39
  • 298
  • 580
4

We don't need any fancy machinery here, we just need to write the elements of $\mathbb{N} \times \mathbb{N} \times \mathbb{N}$ in some order (ensuring they all get written at some point). We can achieve this by the following algorithm:

  • For $B=1,2,3,\ldots$ write all $(a,b,c) \in \mathbb{N} \times \mathbb{N} \times \mathbb{N}$ for which $a \leq B$, $b \leq B$ and $c \leq B$ that haven't been written previously.

There's a finite number of triples written for each $B$, and any triple $(a,b,c) \in \mathbb{N} \times \mathbb{N} \times \mathbb{N}$ gets written when $B=\max(a,b,c)$. Hence, the order in which you write the triples gives a bijection from $\mathbb{N}$ to $\mathbb{N} \times \mathbb{N} \times \mathbb{N}$.

To illustrate (assuming $\mathbb{N}=\{1,2,\ldots\}$), when $B=1$ we write \begin{align*} 1 & & \leftrightarrow & & (1,1,1). \end{align*} When $B=2$ we write \begin{align*} 2 & & \leftrightarrow & & (1,1,2) \\ 3 & & \leftrightarrow & & (1,2,1) \\ 4 & & \leftrightarrow & & (2,1,1) \\ 5 & & \leftrightarrow & & (2,2,1) \\ 6 & & \leftrightarrow & & (2,1,2) \\ 7 & & \leftrightarrow & & (1,2,2) \\ 8 & & \leftrightarrow & & (2,2,2) \\ \end{align*} (or in any other order, it doesn't matter). And so on.

3

An intuitive one, but hard to prove formally: Let $A_nA_{n-1}\ldots A_1A_0$, $B_nB_{n-1}\ldots B_1B_0$, $C_nC_{n-1}\ldots C_1C_0$ be your three natural numbers. Pad them with $0$s at the front until their lengths match. Interleave their digits, including zeros, starting at the end: $$C_nB_nA_n\ldots C_1B_1A_1C_0B_0A_0$$

Alternatively, use the Cantor Pairing function twice, if you want to formally prove it.

Let $n = \pi(a, b)$ be the pairing function. Let $a = \pi^{-1}_1(n)$ return the first entry of the inverse function, and $b = \pi^{-1}_2(n)$ return the second. Your bijection is $n = \pi(\pi(a,b), c)$. The inverse is $(a, b, c) = (\pi^{-1}_1 \circ \pi^{-1}_1)(n), \ (\pi^{-1}_2 \circ \pi^{-1}_1)(n), \ \pi^{-1}_2(n))$

Henry Swanson
  • 12,972
2

Let $n = \sum_{i=0}^\infty a_i 2^i$ be the binary expansion of $n\in\mathbb{N}$, then define $f_j^k(n) = \sum_{i=0}^\infty a_{j+ik} 2^i$.

It is not too hard to verify that $(f_0^k,\ldots,f_{k-1}^k)$ gives a bijection $\mathbb{N}\to\mathbb{N}^k$.

Abel
  • 7,312
2

Their is a bijection from $\mathbb{N}\times\mathbb{N}\to\mathbb{N}-\{0\}$ defined by $$(m,n)\mapsto (2m+1)2^n.$$ The proof is relies on unique factorization. What we can then do is iterate this map. Namely we make a map, $$\mathbb{N}\times\mathbb{N}\times\mathbb{N}\to\mathbb{N}$$ by taking the composite, $$(m,n,k)\mapsto((2m+1)2^n,k)\mapsto (2(2m+1)2^n)+1)2^k.$$ To get the desired bijection, we simply invert this map.

Baby Dragon
  • 2,823
  • 22
  • 32
  • It is a great idea, which I have used myself But adjust your formula. Since $\mathbb N$ does not contain zero, your first factor $2m+1$ is never 1, and neither is your second factor $2^n$. – GEdgar Apr 15 '13 at 20:57
  • @GEdgar I was trying to avoid the fact that $0$ would either never be in the target or be in the target too often. – Baby Dragon Apr 16 '13 at 02:55
  • So (for $\mathbb N$ without $0$) use formula $(2m-1)2^{n-1}$. The first factor is $1,3,5,7,\dots$ the second factor is $2,4,8,16,\dots$. Or... – GEdgar Apr 16 '13 at 13:55
  • ... or (for $\mathbb N$ with $0$) use formula $(2m+1)2^n-1$. – GEdgar Apr 16 '13 at 13:57
1

Always exist. Maybe it is a little far away the question by the Shahab's comment. However I will talk about the cardinality. It may be helpful for you.

As $\mathbb N$ and $\mathbb N \times \mathbb N \times \mathbb N$ has the same cardinality, then there always exists a bijection.

Note that any spaces with same cardinality always has a bijection between them!

Paul
  • 20,553
  • 3
    You might want to go the other way around. Equipotency of sets, $A\sim B$, is defined by the existence of a function $f:A\to B$ where $f$ is a bijection. – Pedro Apr 15 '13 at 20:50