A bijection from the set of real numbers to the set of irrational numbers
A result from set theory tells us that the set of all real numbers $\mathbb{R}$ and the set of all irrational numbers $\mathbb{R} \backslash \mathbb{Q}$ have the same cardinality. So how can we actually construct a bijection between them? This is a question that really puts the reader's imagination to the test. Of course, once the answer is given, it tends to look a lot less mysterious. Below I present an example I constructed myself, from which the reader can see how such a mapping can be built.
To construct such a bijection, a very natural idea is to let all the rational numbers, together with part of the irrational numbers, map among themselves, while the remaining irrational numbers are mapped to themselves (the identity). To build such a bijection, we first need a function whose values are always irrational. It is not hard to find such a function; for instance, we know that:
1. The equation $x^4 + 1 = y^2$ has no rational points other than $x=0,y=\pm 1$, otherwise it would contradict the result of Fermat's Last Theorem $n=4$.
2. The square root of an irrational number is still irrational.
Based on these facts, it is enough to construct a bijection from the positive real numbers $\mathbb{R}^+$ to the positive irrational numbers $\mathbb{R}^+ \backslash \mathbb{Q}^+$, and then, with a slight modification, we can obtain a bijection from $\mathbb{R}$ to $\mathbb{R} \backslash \mathbb{Q}$. more
A bijection from $\mathbb{R}^+$ to $\mathbb{R}^+ \backslash \mathbb{Q}^+$ is as follows:
$$f(x)=\left\{\begin{aligned}&\sqrt{x^4+1},\, x\in \mathbb{Q}^+\\ &\sqrt{x},\, x\in \mathbb{A}\\ &x,\, x\in \mathbb{R}^+ -\mathbb{Q}^+ -\mathbb{A}\end{aligned}\right.$$
where the set $\mathbb{A}$ is the set of the following $a_i\,(i \geq 1)$ (with the initial value ranging over the positive rationals):
$$a_{n+1}=\sqrt{a_n}\ (n\geq 1),\quad a_1=\sqrt{a_0^4+1},\quad a_0\in \mathbb{Q}^+$$
That is, starting from any positive rational number $q$, the set of all irrational numbers constructed from the expression above is $A_{q}$; then letting $q$ range over all positive rationals and taking the union of all the $A_{q}$ gives us $\mathbb{A}$. Although a set built this way looks as though it should have far more elements than the set of rationals, it is in fact equinumerous with the rationals.
That $f(x)$ is a surjection is almost obvious (there are, after all, only these two kinds of irrational numbers). What remains is to show that it is also an injection. Suppose it were not injective; then the "collision" could only occur within the set $\mathbb{A}$, that is, there would exist a positive rational number $x,y$ and positive integers $m,n$ such that
$$(x^4+1)^{\left(\frac{1}{2}\right)^m}=(y^4+1)^{\left(\frac{1}{2}\right)^n}$$
which is to say
$$(x^4+1)^{(2^n)}=(y^4+1)^{(2^m)}$$
Without loss of generality, suppose $n\geq m$; then we have
$$(x^4+1)^{(2^{n-m})}=y^4+1$$
If $n-m$ is not equal to 0, then $a=y,b=(x^4+1)^{(2^{n-m-1})}$ would be a rational solution of $a^4+1=b^2$, a contradiction. Hence $n=m$, and consequently we must have $x=y$. Therefore $f(x)$ is injective.
With a slight modification, we obtain a mapping from the reals to the irrationals:
$$f(x)=\left\{\begin{aligned}&\sqrt{x^4+1},\, x\in \mathbb{Q}^+\\ &\sqrt{x},\, x\in \mathbb{A}\\ &-\sqrt{(x-1)^4+1},\, x\in \mathbb{Q}^-\,\,\text{or}\,\, x=0\\ &-\sqrt{-x},\, x\in \mathbb{B}\\ &x,\, x\in \mathbb{R} -\mathbb{Q} -\mathbb{A}-\mathbb{B}\end{aligned}\right.$$
where the set $\mathbb{A}$ is the set of the following $a_i\,(i \geq 1)$:
$$a_{n+1}=\sqrt{a_n}\ (n\geq 1),\quad a_1=\sqrt{a_0^4+1},\quad a_0\in \mathbb{Q}^+$$
and the set $\mathbb{B}$ is the set of the following $b_i\,(i \geq 1)$:
$$b_{n+1}=-\sqrt{-b_n}\ (n\geq 1),\quad b_1=-\sqrt{(b_0-1)^4+1},\quad b_0\in \mathbb{Q}^-\,\text{or}\, b_0=0 $$
Translated automatically with claude-sonnet-5; all equations are reproduced verbatim from the source. Copyright remains with the original author.