On cardinality of a set of continuous functions What is the cardinality of the set of real valued continuous functions $f$ on $[0,1]$ such that $f(x)$ is rational whenever $x$ is rational?
I know that it's at least infinitely countably many because for any rational $q$, the contant function $f(x)=q$ on $[0,1]$ is in the set in question. Also, other functions like $f(x)=x^n$, for any integer $n$, are in this set.
But, what throws me at this point is my inability to infer whether there are other functions that make the set uncountable. If the case there aren't, how do I prove that it's only countably many?
 A: The cardinality of this set of functions $\mathcal{F}$ is $\mathfrak{c}$, the continuum.

The cardinality of $\mathcal{F}$ is at least $\mathfrak{c}$ because given a real irrational number $\alpha \in (0,1)$ and any real number $\beta$, we can construct a function with the given properties and having $f(\alpha) = \beta$. In particular, if we fix $\alpha = 1/\sqrt{2}$ or your favorite irrational in the interval, this construction will describe as many different functions as there are real values for $\beta$, and $|\mathbb{R}| = \mathfrak{c}$.
Let $0 = a_1 < a_2 < a_3 < \cdots$ be any strictly increasing sequence of rational numbers converging to $\alpha$, and let $1 = b_1 > b_2 > b_3 > \cdots$ be any strictly decreasing sequence of rational numbers converging to $\alpha$. The function $f$ is:
$$ f(x) = \begin{cases}
\frac{\lfloor k \beta \rfloor}{k} + \left(\frac{\lfloor(k+1)\beta\rfloor}{k+1} - \frac{\lfloor k \beta \rfloor}{k}\right) \frac{x-a_k}{a_{k+1}-a_k} & a_k \leq x < a_{k+1} \\
\beta & x = \alpha \\
\frac{\lceil k \beta \rceil}{k} + \left(\frac{\lceil (k+1) \beta \rceil}{k+1} - \frac{\lceil k \beta \rceil}{k}\right) \frac{b_k-x}{b_k-b_{k+1}} & b_{k+1} < x \leq b_k
\end{cases} $$
$f(x)$ takes a rational value at every rational $x$, since all floor ($\lfloor \cdot \rfloor$) and ceiling ($\lceil \cdot \rceil$) function values are integers, $k$ is a positive integer, and all $a_k$ and $b_k$ are rational. $f$ is linear on the intervals $(a_k,a_{k+1})$ and $(b_{k+1},b_k)$, and continuity at the corner points $a_k$ and $b_k$ is easy to show. For continuity at $\alpha$, note that if $a_k \leq x < a_{k+1}$, since $f$ is linear on the interval,
$$ |f(x)-\beta| \leq \max(|f(a_k)-\beta|, |f(a_{k+1})-\beta|) $$
$$ |f(a_k)-\beta| = \left| \frac{\lfloor k \beta \rfloor}{k} - \beta \right| = \frac{k \beta - \lfloor k \beta \rfloor}{k} < \frac{1}{k} $$
$$ |f(x)-\beta| \leq \max \left(\frac{1}{k}, \frac{1}{k+1}\right) = \frac{1}{k} $$
Similarly, $b_{k+1} < x < b_k$ also implies $|f(x)-\beta| \leq \frac{1}{k}$. Since $j > k$ implies $1/j < 1/k$ and $f(\alpha)-\beta = 0$, it's also true that $|f(x)-\beta| \leq \frac{1}{k}$ for all $x \in [a_k,b_k]$. So for any real $\epsilon > 0$, choose positive integer $K > 1/\epsilon$, and  $|x-\alpha| < \min(\alpha-a_K, b_K-\alpha)$ implies $|f(x)-f(\alpha)| \leq 1/K < \epsilon$; $f$ is continuous at $\alpha$.

The cardinality of $\mathcal{F}$ is at most $\mathfrak{c}$ because we can define an injection from the set of functions to the set of sequences of rational numbers, which has cardinality $\mathfrak{c}$. This mapping is
$$ \Phi : f \mapsto \left(f(0), f(1), f\!\left(\frac{1}{2}\right), f\!\left(\frac{1}{4}\right), f\!\left(\frac{3}{4}\right), f\!\left(\frac{1}{8}\right), \ldots\right) $$
To show this $\Phi$ is injective, suppose $f_1$ and $f_2$ are continuous functions mapping to the same sequence. That is, $f_1\left(\frac{m}{2^n}\right) = f_2\left(\frac{m}{2^n}\right)$ for numbers of the form $\frac{m}{2^n}$ (with $m,n$ non-negative integers) in the domain. Suppose by way of contradiction that $f_1(x_0) \neq f_2(x_0)$ at any real $x_0 \in (0,1)$. Since each function is continuous, there exist a $\delta_1>0$ and $\delta_2>0$ such that
$$|x-x_0| < \delta_1 \implies |f_1(x)-f_1(x_0)| < \frac{1}{2}|f_1(x_0)-f_2(x_0)|$$
$$|x-x_0| < \delta_2 \implies |f_2(x)-f_2(x_0)| < \frac{1}{2}|f_1(x_0)-f_2(x_0)|$$
Let $\delta = \min(\delta_1, \delta_2)$. Since numbers of the form $\frac{m}{2^n}$ are dense, there is such a number $x_1 = \frac{m}{2^n}$ in the interval $(x_0-\delta, x_0+\delta)$. Then $|x_1-x_0| < \delta_1$ and $|x_1-x_0| < \delta_2$ and $f_1(x_1) = f_2(x_1)$, so combining the continuity statements with the triangle inequality gives
$$ \begin{align*} |f_1(x_0)-f_2(x_0)| &= \big|[f_1(x_0)-f_1(x_1)] - [f_2(x_0)-f_2(x_1)]\big| \\
&\leq |f_1(x_1)-f_1(x_0)| + |f_2(x_1)-f_2(x_0)| \\
&< \frac{1}{2}|f_1(x_0) - f_2(x_0)| + \frac{1}{2}|f_1(x_0)-f_2(x_0)| \\
&= |f_1(x_0)-f_2(x_0)|
\end{align*} $$
Contradiction: it is not possible that $f_1(x_0) \neq f_2(x_0)$. So if continuous functions have the same sequence $\Phi(f_1) = \Phi(f_2)$, the functions are identical; $\Phi$ is injective.
A: Continuous functions on $[0,1]$ are uniquely determined by their values on the countable dense set $D=\mathbb{Q}\cap [0,1]$. That is, if $f$ and $g$ are continuous and if $f(x)=g(x)$ for all $x\in D$, then $f(x)=g(x)$ for all $x\in [0,1]$. Thus, there is an injective function $$\Phi: C([0,1],\mathbb{R}) \to \mathbb{R}^D,$$ where $\mathbb{R}^D$ is the set of all functions $D\to\mathbb{R}$. Finally, $$card(\mathbb{R}) \leq card(C([0,1],\mathbb{R})) \leq card(\mathbb{R}^D) = card(\mathbb{R})^{card(D)} = card(\mathbb{R}).$$
Consequently, $card(\mathbb{R}) = card(C([0,1],\mathbb{R}))$.

Edit: I missed a crucial part of the question at the first look. Let $A\subseteq C([0,1],\mathbb{R})$ be the set of all continuous functions that map rationals to rationals.
Every continuous function defined on $I=[0,1]$ (generally on a compact set $I$) attains its minimum on $I$. It is not difficult to show that for every $a\in\mathbb{R}$, there exists $f\in A$ with minimum value $a$. (Just consider polynomials with rational coefficients, or piecewise linear functions with a single kink.) Thus, there exists a surjective map $\Psi:A\to\mathbb{R}$. Consequently, $$card(\mathbb{R})\leq card(A).$$ Also, from above, $card(A)\leq card(C([0,1],\mathbb{R})) = card(\mathbb{R})$. Together, $card(\mathbb{R}) = card(A)$.
