Problems about Countability related to Function Spaces

Suppose we have the following sets, and determine whether they are countably infinite or uncountable .

  1. The set of all functions from $\mathbb{N}$ to $\mathbb{N}$.

  2. The set of all non-increasing functions from $\mathbb{N}$ to $\mathbb{N}$.

  3. The set of all non-decreasing functions from $\mathbb{N}$ to $\mathbb{N}$.

  4. The set of all injective functions from $\mathbb{N}$ to $\mathbb{N}$.

  5. The set of all surjective functions from from $\mathbb{N}$ to $\mathbb{N}$.

  6. The set of all bijection functions from from $\mathbb{N}$ to $\mathbb{N}$.

My thoughts on this:

  1. The first set is uncountable by using diagonalization argument.

  2. I have read something about it saying this is countable since we can see this as a set of finite sequences of natural numbers. But I have hard time following the argument.

  3. The article I read says this is uncountable but I couldn't follow the argument either.

  4. For (4),(5) and (6), I am not even sure how to approach problems like these.

Could someone please explain how to approach this kind of problems in general?

And does it matter when I change all the $\mathbb{N}$ to $\mathbb{R}$?


Another approach to the 6th part.

Let us denote the set of all bijections from $\mathbb N$ to $\mathbb N$ by $\operatorname{Bij}(\mathbb N,\mathbb N)$.

Clearly $$|\operatorname{Bij}(\mathbb N,\mathbb N)| \le \aleph_0^{\aleph_0} = 2^{\aleph_0} = \mathfrak c.$$

Let us try to show the opposite inequality.

For arbitrary function $f\in\operatorname{Bij}(\mathbb N,\mathbb N)$ we define $$\operatorname{Fix}(f)=\{n\in\mathbb N; f(n)=n\}.$$ (That is, $\operatorname{Fix}(f)$ is the set of all fixed points of the map $f$.) Let us try to answer the question, whether for any $A\subseteq\mathbb N$ it is possible to find a bijection ${f_A}:{\mathbb N}\to {\mathbb N}$ such $\operatorname{Fix}(f_A)=A$. Let us consider two cases.

If the complement of the set $A$ is infinite, i.e. $\mathbb N\setminus A=\{b_n; n\in\mathbb N\}$ (and we can assume that the elements $\mathbb N\setminus A$ are written in the increasing order, i.e. $b_1<b_2<\dots<b_n<b_{n+1}<\dots$ ), then we can define a function $f_A$ as follows: $$f_A(x)= \begin{cases} x, & \text{if }x\in A, \\\ b_{2k+1}, &\text{if $x=b_{2k}$ for some $k\in\mathbb N$},\\\ b_{2k}, &\text{if $x=b_{2k+1}$ for some $k\in\mathbb N$}. \end{cases} $$ In the other words, we did not move the elements of $A$ and the elements from the complement were paired and we interchanged it pair. Such map is a bijection from $\mathbb N$ to $\mathbb N$ such that $\operatorname{Fix}(f_A)=A$.

Next we consider the case that $\mathbb N\setminus A$ is finite.

If $\mathbb N\setminus A=\emptyset$, then $f=id_{\mathbb N}$ is a function fulfilling $\operatorname{Fix}(f_A)=\mathbb N=A$.

If the set $\mathbb N\setminus A$ is a singleton $\{a\}$, then is is impossible to find a bijection $f$ such that $\operatorname{Fix}(f)=A=\mathbb N\setminus\{a\}$. No element of $A$ can be mapped on $a$ (since all such elements are fixed). But $a$ cannot be mapped on $a$ since this would mean that $a$ is a fixed point.

But if the set $\mathbb N\setminus A$ has at least two elements, then it is possible to construct such a map. We again assume that the elements $b_k$ are written in the increasing order, i.e. $\mathbb N\setminus A=\{b_0,\dots, b_n\}$ and $b_0<b_1<\dots<b_n$. We put $f_A(x)=x$ for $x\in A$, $f_A(b_k)=b_{k+1}$ for $0\le k<n$ and $f_A(b_n)=b_0$. (I.e. we made a cycle consisting of elements of $\mathbb N\setminus A$.)

This defines a bijection ${f_A}:{\mathbb N}\to{\mathbb N}$ such that $\operatorname{Fix}(f_A)=A$.

The assignment $A\mapsto f_A$ that we described above is a map from the set $\mathcal P({\mathbb N})\setminus\{\mathbb N\setminus\{a\}\in\mathbb N\}$ consisting of all subsets of $\mathbb N$, whose complement is not a singleton, to the set $\operatorname{Bij}(\mathbb N,\mathbb N)$. This map is injective; since from $f_A=f_B$ we get $A=\operatorname{Fix}(f_A)=\operatorname{Fix}(f_B)=B$.

From the set $\mathcal P({\mathbb N})$ with the cardinality $\mathfrak c$ we have omitted a countable set $\{\mathbb N\setminus\{a\}\in\mathbb N\}$. Therefore the cardinality of this difference $\mathcal P({\mathbb N})\setminus\{\mathbb N\setminus\{a\}\in\mathbb N\}$ is again $\mathfrak c$.

So we found an injection from a set of cardinality $\mathfrak c$ to the set $\operatorname{Bij}(\mathbb N,\mathbb N)$. This yields the opposite inequality $$\mathfrak c\le|{\operatorname{Bij}(\mathbb N,\mathbb N)}|$$ and by Cantor-Bernstein theorem we get $|{\operatorname{Bij}(\mathbb N,\mathbb N)}|=\mathfrak c$.


I'll use this opportunity to mention here a very nice (at least in my opinion) proof that the cardinality of all bijections $\mathbb N\to\mathbb N$ is $\mathfrak c=2^{\aleph_0}$, which is basically the part 6. I making it a community wiki, since the idea is not mine. I believe I've seen this at sci. math but I am not sure about it and I cannot find the link now. (Feel free to add some pointers and links, if you know some.)

HINT: If someone wants to try to develop the idea by himself, the basic idea is Riemann's rearrangement theorem.


Let us denote the set of all bijections from $\mathbb N$ to $\mathbb N$ by $\operatorname{Bij}(\mathbb N,\mathbb N)$.

Clearly $$|\operatorname{Bij}(\mathbb N,\mathbb N)| \le \aleph_0^{\aleph_0} = 2^{\aleph_0} = \mathfrak c.$$

Now we will show the opposite inequality. Let us choose a series $\sum_{n=0}^\infty x_n$, which is convergent but not absolutely convergent (e.g. $\sum_{n=0}^\infty x_n = \sum_{n=0}^\infty (-1)^n\frac1{n+1}$). By Riemann's theorem, for any real number $r$ there exists a permutation $\pi\in \operatorname{Bij}(\mathbb N,\mathbb N)$ such that $\sum_{n=0}^\infty x_{\pi(n)}=r$. If we choose for each $r$ one such permutation, we get an injective map from $\mathbb R$ to $\operatorname{Bij}(\mathbb N,\mathbb N)$. Thus $|\operatorname{Bij}(\mathbb N,\mathbb N)| \ge |\mathbb R| = \mathfrak c = 2^{\aleph_0}$.


This is not a complete answer. [I am taking $\mathbb N$ to include $0$.] I will give you a proof that there are uncountably many bijections from $\mathbb N$ to itself. This obviously subsumes the questions (4)-(6).

Consider functions $f : \mathbb N \to \mathbb N$ of the following special form: For every $k$, the pair of elements $\{ 2k, 2k+1 \}$ is mapped to itself. However, we have two ways of doing this:

  • either: map $2k$ to itself, and similarly for $2k+1$.

  • or: map $2k$ and $2k+1$ to each other.

The key point is that for each $k$, you could pick one of the two possibilities independently. Since there are $2$ options for each $k$, you have $2^{\mathbb N}$ options; i.e., there are uncountably many such functions satisfying this restriction. And each such function is a bijection from $\mathbb N$ to itself.

The above needs a little bit of work to make it completely rigorous. In particular, try to formalise what I mean by "$2^\mathbb N$ possibilities".


For (3), the idea is similar. For each $k$, try mapping $k$ to either $2k$ or $2k+1$. Details are left as an exercise.


For (2), does the following hint help? Every non-increasing function $f : \mathbb N \to \mathbb N$ is eventually constant. So the function is uniquely specified if we describe the finite initial "portion" of the function.

Another approach (due to tb) for (2): If you plot the graph of a non-increasing function, it looks like a staircase that goes down as we move from left to right -- a staircase with finitely many steps because you the function can go down only finitely many times. One can also reconstruct the function if we record the upper right corners of each of those steps. Since the latter corresponds to a finite subset of $\mathbb N \times \mathbb N$ (which is countable), it follows that our set of non-increasing functions is countable as well.


Let $$ \eqalign{ A_1&=\text{the set of all functions from }\Bbb N\text{ to }\Bbb N. \cr A_2&=\text{the set of all non-increasing from }\Bbb N\text{ to }\Bbb N. \cr A_3&=\text{the set of all non-decreasing }\Bbb N\text{ to }\Bbb N. \cr A_4&=\text{the set of all 1-1 functions from}\Bbb N\text{ to }\Bbb N. \cr A_5&=\text{the set of all onto functions from }\Bbb N\text{ to }\Bbb N. \cr A_6&=\text{the set of all bijections from }\Bbb N\text{ to }\Bbb N. \cr } $$

Consider $A_6$:

$A_6$ may be thought of as the set $\bigl\{\,\pi :\pi \text{ is a permutation of } (1,2,3,\ldots)\,\bigr\}$.

For any permutation $\pi$, we may associated a binary sequence $(x_n)$ by setting $$x_n=\begin{cases} 0,& \text{if } \pi_n=n\cr 1,& \text{otherwise} \end{cases}.$$ This induces an onto map from $A_6$ to the set of infinite binary sequences (Edit: not quite, as Martin Sleziak points out in his answer, the binary sequences that have "only one 1" have no element in $A_6$ mapped to them. But, as the set of such sequences is countable, the rest of the argument will go through. Martin also describes nicely how to obtain this map.). Since the latter set is uncountable, so is the former.

So, $A_6$ is uncountable.

From this, it follows that $A_5$, $A_4$, and $A_1$ are uncountable.


Now, consider $A_2$:

If $f$ is a non-increasing function, then $f$ must be eventually constant. Thus, the cardinality $A_2$ would be at most the cardinality of the set $$ \bigcup_{j,m} \bigl\{\,(a_i)_{i=1}^\infty : a_i=m, i\ge j\,\bigr \}. $$ But this latter set is a countable union of countable sets and is, thus, countable.

So, $A_2$ is countable.


Now, consider $A_3$:

The cardinality of the set of non-decreasing functions is at least the cardinality of the set $$ \{\, A\subset\Bbb N : A \text{ is an infinite subset of } \Bbb N\, \}. $$

Since this latter set uncountable, $A_3$ is uncountable.