Is continuity necessary to establish $f(x+r) =f(x) +f(r), r\in\Bbb Q \Rightarrow f(x+y) =f(x) +f(y) $ Let $f:\mathbb{R} \to \mathbb{R} $ be a function such that $f(x+r) =f(x) +f(r) $,$\forall x\in \mathbb{R} $ and $\forall r \in \mathbb{Q} $. I know that if $f$ were continuous, then we would have $f(x+y) =f(x) +f(y) $, $\forall x, y \in \mathbb{R} $ using the fact that the rational numbers are dense in the reals. Could the same thing be established without $f$'s continuity? I think it could not, but I can't find a counterexample. 
 A: No, continuity of $f$ is necessary here. Consider the following function:
$$f(x)=\begin{cases}0 & \text{if $x$ is rational,}\\
1 & \text{if $x$ is irrational.}\end{cases}$$
Clearly for any rational $r$, we have $x$ rational iff $x+r$ is rational, so $f(x+r)=f(x)=f(x)+0=f(x+r)$, but $f(\sqrt{2}+\sqrt{2})=1\neq 2=f(\sqrt{2})+f(\sqrt{2})$.
A: The value of $f$ on $\mathbb Q$ can be uniquely determined by the value of $f(1)$. That's because we can easily see that
$$
f(n)=nf(1);\\
f\left(\frac{1}{q}\right)=\frac{1}{q}f(1)
$$
for $n,q\in \mathbb Z^+$.
However, the value of $f(1)$ cannot determine anything further, because the two identities above are as far as the condition $f(x+r)=f(x)+f(r)$ can go. For example, $f(\sqrt 2)$ cannot be determined from $f(1)$ because $\sqrt 2$ is irrational.
We can define $f(\sqrt 2)$. Then $f(a+\sqrt{2})$ where $a,b\in \mathbb Q$ is also defined.
So far $f(\sqrt 3)$ is still undefined. We can take $f(\sqrt 3)$ to be any value. Then $f(a+\sqrt{3})$ is defined, but not $f(2\sqrt{3})=f(\sqrt{3}+\sqrt{3})$, since one of the terms inside the bracket must be rational. You can continue to define as you like. 
Generally, you can divide $\mathbb R$ into many equivalence classes. The equivalence relation is defined as follows: $r_1 \sim r_2$ iff $r_2-r_1\in\mathbb Q$.
Let's choose one representative from each equvilance class. Let those representatives be $\{r_\lambda\}, \lambda\in\Lambda$. For all possible set of real numbers $\{b_\lambda\}$, you can define $f(r_\lambda)=b_\lambda$. Define $f(r)$ for rational $r$ as above, and for any $x\in \mathbb R$, there exist $\lambda\in\Lambda$ such that $x=r_\lambda+a, a\in \mathbb Q$. We define $f(x)=b_\lambda+f(a)$.
Now we can easily show that $f$ is the function you require. Since you can simply take any values on each equivalence class, the function is very likely to be not additive. for example, if you let $f(\sqrt2)=1,f(\sqrt 3)=1,f(\sqrt 2+\sqrt 3)=1$, then $f(\sqrt2)+f(\sqrt3)\neq f(\sqrt 2+\sqrt 3)$
