Solving $f(x+f(y)) = f(x) + y$ I found this problem in an old book of mine. The question asks to find all the functions $f: \mathbb Q \to \mathbb R$ which satisfy $f(x+f(y)) = f(x) + y$ for all rational numbers $x,y$. Also I am unsure what $f: \mathbb Q \to \mathbb R$ means exactly when compared to $f: \mathbb R \to \mathbb R$
I have been experimenting with this problem and the only two functions I could find were $f(x) = x$ or $f(x) = -x$. Although these functions seem to be the only working ones (purely based on guess and check), I cannot seem to find a proof.
 A: As Servaes pointed out in a comment, we see that $f(x)\in \mathbb{Q}$ for all $x$.

*

*Set $x=0$ and you get $f(f(y)) =f(0)+y$ so $f$ is injective.

*Let $y=0$ you get $f(x+f(0))=f(x)$ and since $f$ is injective we have $x+f(0)=x$  so $f(0)=0$ and $f(f(y))=y$ for all $y$.

*Let $y=f(t)$ then $f(x+t) = f(x)+f(t)$, so $f$ is solution of Cauchy FE and thus $f(x)=ax$ for some $a$.

*Plug that in original equation to get $a=\pm 1$.


To solve $f: \mathbb R \to \mathbb R$ you need some aditional asumption for $f$. You can not say $f(x)=ax$ immediately.
A: In general, $f : A \to B$ means that the domain of $f$ is $A$ and that for all $a \in A$, $f(a) \in B$. In this case, $f : \mathbb{Q} \to \mathbb{R}$ means that $f(x)$ only needs to be defined for $x$ a rational number, and $f(x)$ is always a real number.
In this case, because $f(x + f(y))$ is defined for all $y$, it must be the case that $x + f(y) \in \mathbb{Q}$ for all $y$. In particular, $0 + f(y) = f(y) \in \mathbb{Q}$ for all $y$. So we're looking for some $f : \mathbb{Q} \to \mathbb{Q}$ satisfying the above.
Let's start by plugging in $x = 0$. We have $f(f(y)) = f(0) + y$. This tells us that $f$ is injective, since if $f(a) = f(b)$, then $f(0) + a = f(f(a)) = f(f(b)) = f(0) + b$ and hence $a = b$.
Now, let's plug in $y = 0$ into $f(f(y)) = f(0) + y$. This gives us $f(f(0)) = f(0)$. Since $f$ is injective, we have $f(0) = 0$.
So we have $f(f(y)) = y$. Then $f$ is a bijection, and $f$ is its own inverse.
Now let's plug in $y = f(z)$. Then we see that $f(x + z) = f(x + f(f(z))) = f(x) + f(z)$.
Now all functions $f : A \to B$ satisfying $f(x + z) = f(x) + f(z)$ for all $x, z$ are linear whenever $A, B$ are $\mathbb{Q}$-vector spaces. So $f$ must be a linear function.
The only linear functions $\mathbb{Q} \to \mathbb{Q}$ are of the form $f(x) = ax$. For such a function, we must have $f(x + f(y)) = f(x) + y$; that is, we must have $a(x + ay) = ax + y$. So we must have $a^2 = 1$.
So the only functions that could possibly work are $f(x) = x$ and $f(x) = -x$. And these functions do work.
A: There is a small but tricky subtlety to this problem needs to be resolved first, which is the question of whether $f(y)$ can be irrational. This is an issue because if it is irrational, then for any rational $x$, the expression $x + f(y)$ is irrational and so
$f(x + f(y))$ is not defined. Assuming the condition
$$ f(x + f(y)) = f(x) + y $$
really holds for all rational $x, y$, it must therefore be the case that $f(y)$ is always rational.
Then we can proceed by considering particular $x, y$, especially zero. That is, taking $x = 0$, we get
$$ f(0 + f(y)) = f(0) + y $$
which implies that
$$ f(f(y)) = f(0) + y. $$
Similarly, considering $y = 0$ gives
$$ f(x + f(0)) = f(x) . $$
Edit: This is essentially the same steps as Mark's answer which was posted moments before mine, but I figure I'll leave it if only for a slightly different perspective.
