Since both of them are uncountable sets, we should be able to construct such a map. Am I correct?
If so, then what is the map?
Since both of them are uncountable sets, we should be able to construct such a map. Am I correct?
If so, then what is the map?
Both sets $[0,1]$ and $[0,1]\setminus\mathbb Q$ have the same cardinality $\mathfrak c=2^{\aleph_0}$, so there is a bijection between them.
If you want write down some explicit bijection, you can use basically the standard Hilbert's hotel argument which shows that if $|A|\ge\aleph_0$ then $|A|+\aleph_0=|A|$.
So let us try to describe some bijection $f \colon [0,1] \to [0,1]\setminus\mathbb Q$.
Then you can define $f$ as:
Let me add links to some posts where a very similar ideas can be used to construct a bijection between two given sets:
Define $f : [0,1] \to \mathbb{R}$ as follow : if $x \in \mathbb{Q}$, then $f(x) = \pi + x$. If $x$ is irrational, then $f(x) = x$. This function is injective. It is not a bijection.
You can construct such a function in the following steps (it's certainly by far not the only way):
Map the closed interval $[0,1]$ to the open interval $(0,1)$ by the function $$f(x) = \begin{cases} \frac{1}{4} & x = 0\\ \frac{1}{4(n+1)} & x = \frac{1}{4n}, n\in\mathbb Z^+\\ \frac{3}{4} & x = 1\\ 1-\frac{1}{4(n+1)} & x = 1 - \frac{1}{4n}, n\in\mathbb Z^+\\ x & \text{otherwise} \end{cases}$$
Map the interval $(0,1)$ to $\mathbb R$ by the function $$g(x) = \ln(-\ln x)$$
Map $\mathbb R$ to the set of irrational numbers by the function $$h(x) = \begin{cases} x\pi^{n+1} & x = q\pi^n, q\in\mathbb Q, n \in \mathbb N_0\\ x & \text{otherwise} \end{cases}$$
Then the function $F = h\circ g\circ f$ is a bijection from $[0,1]$ to the set of irrational real numbers.
Here I've used the notations $\mathbb Z^+ = \{1,2,3,\ldots\}$ the set of positive integers, and $\mathbb N_0 = \{0,1,2,3,\ldots\}$ the set of positive integers (natural numbers, including $0$).
Let $p_0 = 0$ and $p_n$ be the $n$-th prime for any $n \in \mathbb{N}^+$.
Let $f:\mathbb{R}\to\mathbb{R}$ such that:
$f(x) = \cases{ r+\sqrt{p_{n+1}} & \text{if $x = r+\sqrt{p_n}$ for some $n \in \mathbb{N}$ and $r \in \mathbb{Q}$} \\ x & \text{otherwise} }$.
To prove that this function is well-defined, we just need to check that it is impossible to have $a+\sqrt{p_m} = b+\sqrt{p_n}$ for distinct $m,n \in \mathbb{N}^+$ and $a,b \in \mathbb{Q}$, which is clearly the case otherwise $(a-b)^2 = (\sqrt{p_m}-\sqrt{p_n})^2$ $= p_m+p_n-\sqrt{p_mp_n} \notin \mathbb{Q}.$
I leave you to prove that it is a bijection from $\mathbb{R}$ to $\mathbb{R} \setminus \mathbb{Q}$. Then you can compose it with a bijection from $[0,1]$ to $\mathbb{R}$.
Yes, the irrationals and the set [0,1] have the same cardinality. Using cardinal arithmetic:
$$\text{card}([0,1]) = \text{card}(\mathbb{R}) = \text{card}(\mathbb{Q} + (\mathbb{R} \setminus \mathbb{Q}) ) = \text{card}(\mathbb{Q}) + \text{card}(\mathbb{R} \setminus \mathbb{Q} ) = \text{card}(\mathbb{R} \setminus \mathbb{Q} )$$
I cannot recall an explicit construction of such a bijection, however.
Let me prove a more general theorem that may be instructive: $\def\nn{\mathbb{N}}$ $\def\power{\mathcal{P}}$
Given any infinite set $S$, there is a bijection from $\power(S)$ to $\power(S) \setminus \{ \{x\} : x \in S \}$.
One could use the full theory of cardinals and cardinal arithmetic, but the proof of that needs the axiom of choice (AC) and hence is necessarily non-constructive. But it is possible to prove an explicit bijection in this case, using only the axiom of countable choice and avoiding AC, as follows:
Let $(a_n)_{n\in\nn}$ be a sequence of distinct elements in $S$, since $S$ is infinite, and let $A = \{ a_n : n \in \nn \}$.
Let $f(X) = \cases{ \{ a_i : i \in [k..m+1] \} & \text{if $X = \{ a_i : i \in [k..m] \}$ for some $k,m \in \nn$ with $k \le m$} \\ \{s,a_0\} & \text{if $X = \{s\}$ for some $s \in S \setminus A$} \\ \{s,a_{m+1}\} & \text{if $X = \{s,a_m\}$ for some $s \in S \setminus A$ and $m \in \nn$} \\ X & \text{otherwise} }$
[For convenience I used "$[k..m]$" to denote "$\{k,k+1,k+2,...,m\}$".]
It can be checked that $f$ is a desired bijection.
As a consequence we will obtain:
There is a bijection between $\power(S) \cup T$ and $\power(S)$ for any disjoint infinite $S,T$ such that there is a bijection between $S$ and $T$.
This corresponds to a special case of cardinal addition, namely $\#(\power(S))+\#(S)=\#(\power(S))$ for infinite $S$, which is enough for a lot of mathematics.
Note
The fact that a countably infinite sequence exists within any infinite set can be proven by considering a sequence of finite subsets with increasing sizes. Each exists and by countable choice we get this sequence. The union of the subsets is countably infinite and we can extract the desired sequence from it by the axiom of induction.
a
s from infiniteness of S, without AC??
$\endgroup$
Let $x=0.x_1x_2\dots$ be the base $10$ representation (choosing the ones ending in repeating $9$s rather than repeating zeros.)
Let $p=0.y_1y_2\cdots$ be any (fixed) irrational number in $(0,1)$.
Then $f(x)=0.x_1y_1x_2y_2\dots$ is a $1-1$ function which maps $[0,1]$ to the irrationals, and it is continuous at every number that is not of the form $\frac{n}{10^k}$.
(This map is not, of course, onto.)
There are lots of good answers already, but I thought I might add one more using a flexible method that shows up a lot in descriptive set theory.
Note that $\mathbb{R} \setminus \mathbb{Q}$ is the intersection of countably many dense open sets $(G_n : n \in \mathbb{N})$; just take $G_n = \mathbb{R} \setminus \{q_i\}$ for some enumeration $(q_i : i \in \mathbb{N})$ of the rationals.
Note also that there is an injection from $[0,1]$ to the Cantor space $2^\mathbb{N}$ given by binary expansions. If there is a choice between a binary expansion that is eventually zeroes and another that is eventually ones, take the one that is eventually zeroes. (This injection is not continuous.)
So it suffices to prove the following general fact:
Let $(G_n : n \in \mathbb{N})$ be a sequence of dense open subsets of $\mathbb{R}$. Then there is an injection from $2^\mathbb{N}$ to $\bigcap_{n \in \mathbb{N}} G_n$. (As we will see, there is a continuous injection.)
By recursion, we can define for each finite sequence $s$ of natural numbers a closed interval $I_s$ satisfying the following properties:
$I_s$ has length between zero and $2^{-n}$ where $n$ is the length of the finite sequence $s$,
$I_t \subset I_s$ whenever $t$ extends $s$,
$I_s \cap I_t = \emptyset$ whenever $s$ and $t$ are incompatible, and
$I_s \subset G_n$ where $n$ is the length of $s$.
This binary tree of intervals is called a Cantor scheme. If desired, we can define $I_s$ explicitly as $[q_i,q_j]$ where $(i,j)$ is the lexicographically least pair of natural numbers making this interval obey the rules.
Every element $(d_i : i \in \mathbb{N})$ of the Cantor space $2^\mathbb{N}$ determines a branch in this binary tree. Our continuous injection is obtained by mapping $(d_i : i \in \mathbb{N})$ to the unique point in the intersection of the corresponding sequence of closed intervals $$I_{d_0} \supset I_{d_0,d_1} \supset I_{d_0,d_1,d_2} \supset \cdots.$$