# Constructing a continuous function with values in a family of dense subsets

Suppose that for every $x\in[0,1]$, $A_x$ is a dense subset of $\mathbb{R}$. Assume the axiom of choice holds.

Is there a way to construct a continuous function $f$ over $[0,1]$ so that for all $x$, $f(x)\in A_x$?

My first instinct was to pick any $f(0)$ and $f(1)$, and then define intermediate values by induction on $n$ so that $$\left|f\left((2k+1)2^{-n}\right) - \frac{f\left(k2^{-n+1}\right)+f\left((k+1)2^{-n+1}\right)}{2}\right| < (2+\epsilon)^{-n}$$ $$f\left((2k+1)2^{-n}\right) \in A_{(2k+1)2^{-n}}$$ which can then be uniquely extended by continuity to $[0,1]$, but unfortunately this extended function does not satisfy $f(x)\in A_x$ in the general case.

-
You define $f(x)$ by continuity whenever $x$ is not a dyadic rational, but why should such $x$ then satisfy $f(x)\in A_x$? –  Noah Stein Mar 17 '12 at 2:24
You can't even get away with a Borel function. There are continuum-many Borel functions; enumerate them as $f_x$ for $x \in [0,1]$. Then put $A_x = \mathbb{R} \setminus \{f_x(x)\}$. –  user83827 Mar 17 '12 at 2:39
Is this a homework? –  Makoto Kato Nov 27 '13 at 22:31
This is generally not possible. Take $A_x=\mathbb Q$ for all $x\ne 1/2$ and $A_{1/2}=\mathbb R\setminus\mathbb Q$. A continuous function would have to take on irrational values to get from one rational to another; thus $f$ is a constant rational on both sides of $1/2$ and can't be completed to a continuous function at $1/2$.