Functions satisfying $f(x+f(y))=f(x+a)+y+b$ 
Given fixed rationals $a,b\in\mathbb Q$, find all functions $f:\mathbb Q\to\mathbb Q$ such that $$f(x+f(y))=f(x+a)+y+b.$$

One solution is $f(x)=x+a+b$, and it is easy to check that this is the only solution which is linear. By keeping $x$ fixed and allowing $y$ to vary, we can see that $f$ is surjective. Further, using surjectivity, we can choose $y_0$ such that $f(y_0)=a$: substituting, we see that $y_0=-b$. But I'm not sure how to continue from here.  
 A: Fix $x$, and let $y$ vary, we see the right hand side can assume any value. Therefore, $f(x)$ is surjective. Also it is injective as if $f(u)=f(v)$, then from $f(x+a)+u+b = f(x+f(u)) = f(x+f(v)) = f(x+a) + v + b$, so $u=v$. Let $f(x)=g(x)+a+b$. Then on one hand, $$f(x+f(y)) = g(x+f(y)) + a + b = g(x+g(y)+a+b)+a+b,$$
and on the other hand, $$f(x+a)+y+b=g(x+a)+a+b+y+b.$$
So we have $$g(x+g(y)+a+b) = g(x+a) + y + b.$$
We replace $x+a$ with $x$, and get 
$$g(x+g(y)+b)=g(x)+y+b.$$
We have $g(-b)=-b$ as $f$ is injective and surjective: from surjectiveness there exists $y$ such that $g(y)=-b$, and then $g(x)=g(x+g(y)+b)=g(x)+y+b$. 
Let $x=-b$, we get $$g(g(y))=y.$$
Now let $y=g(z)$, we have  $$g(x+z+b)=g(x)+g(z)+b$$, but we can also write $g(x+z+b)=g((x+z)+0+b)=g(x+z)+g(0)+b$. Therefore, $$g(x+z) =g(x)+g(z)-g(0).$$
Now let $h(x)=g(x)-g(0)$, we get $$h(x+z)=h(x)+h(z), $$
and it is easy to show that $h(x)$ is linear (in $\mathbb Q$). Thus $g(x)$ and $f(x)$ are both linear. That is all we need to get $$f(x)=x+a+b$$ or $$f(x)=-x+a-b.$$ 
