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.
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$.