If $f(x)=ax^2$ for $x\in\mathbb{Q}$ and $f$ is continuous, then is $f(x)=ax^2$ for $x\in\mathbb{R}$?

103 Views Asked by At

As in the title. Let's say that the function $f:\mathbb{R}\rightarrow\mathbb{R}$ is given by $f(x)=ax^2$ for $x\in\mathbb{Q}$. Then, if we also have that $f$ is continuous everywhere, is $f(x)=ax^2$ for $x\in\mathbb{R}$?

It seems quite likely (mostly by intuition) to me, yet I'd gladly see any proof (hints...) of counterexample.

2

There are 2 best solutions below

0
On

The answer is yes. Let $x_0 \in \mathbb R \backslash \mathbb Q$ and take a sequence $(x_n)\subset \mathbb Q$ such that $x_n \to x_0$. By the continuity of $f$, we obtain $f(x_0)=\lim_n f(x_n)=\lim_n ax_n^2=a x_0^2$.

0
On

Yes, the set $\{x\in\mathbb R\colon f(x)=ax^2\}$ is closed (it is the zero set of the continuous function $f(x)-ax^2$) and contains $\mathbb Q$, so it must contain the closure of $\mathbb Q$, which is $\mathbb R$.