TITLE: Can there be two continuous real-valued functions such that at least one has rational values for all x?
QUESTION [11 upvotes]: Of course, no continuous real valued non-constant function can attain only rational or irrational values, but can there be a pair of nowhere-constant continuous functions f and g such that for all x, at least one of f(x) and g(x) is rational? Or maybe a countable collection of continuous functions, {f1, f2...} such that for all x there is n such that fn(x) is rational?
Thanks

REPLY [21 votes]: Since your functions are locally non-constant, the preimage of any (rational) point is nowhere dense (in $\mathbb{R}$; if a preimage of a point with respect to a continious function is dense on an interval, then the function is constant on this interval). Hence the union of all preimages of all rational points is of Baire category one (in $\mathbb{R}$); so it is not equal to the whole $\mathbb{R}$.

REPLY [16 votes]: If you allow the functions to be constant on some intervals, then there are some easy examples, and Ricky has provided one. 
But if you rule that out, then there can be no examples, even with countably many functions. To see this,
suppose that $f_n$ is a list of countably many continuous functions which are never constant on an interval. Enumerate the pairs $(r,n)$ of
rational numbers $r$ and natural numbers $n$ in a countable list
$\langle (r_0,n_0), (r_1,n_1),\ldots\rangle$. Let $C_0$ be any closed
interval. If the closed interval $C_i$ is defined, consider
the function $f_{n_i}$ and the rational value $r_i$. Since $f_{n_i}$ is not constant value $r_i$ on $C_i$, we may
shrink the interval to $C_{i+1}\subset C_i$ such that
$f_{n_i}$ on $C_{i+1}$ is bounded away from $r_i$. By
compactness, there is some $x\in C_i$ for all $i$. Thus,
$f_n(x)$ is not $r$ for any rational number $r$.

REPLY [7 votes]: f(x) := closest point in [-2,-1] to x

g(x) := closest point in [+1,+2] to x
If x≤0, then g(x) is rational.

If 0≤x, then f(x) is rational.
The question becomes more interesting if you demand that the functions be nowhere locally constant.