Find all continuous functions $f$ : $\mathbb{R} \rightarrow \mathbb{R}$ satisfying: $f(xy)+f(x+y)=f(xy+x)+f(y)\quad\forall x,y \in \mathbb{R}$

Find all continuous functions $f$ : $\mathbb{R} \rightarrow \mathbb{R}$ satisfying: $$f(xy)+f(x+y)=f(xy+x)+f(y)$$ $\forall x,y \in \mathbb{R}$

I have tried that :

$P(y;x)-P(x;y)$: $f(xy+y)+f(x)=f(xy+x)+f(y)$

$P(x;1)$: $f(x)+f(x+1)=f(2x)+f(1)$

$P(x+1;1)$:$f(x+1)+f(x+2)=f(2x+2)+f(1)$ So $f(x+2)-f(x)=f(2x+2)-f(2x) , \forall x \in \mathbb{R}$

let $g(x)=f(x+2)-f(x)$

We have $g(2x)=g(x)=g(\frac{x}{2})=...=g(0)=c$ because $g$ is the continous functions. To here, I have no idea to solve the problem.

-

Let's denote the functional equation by $(*)$. Note that if $f(x)$ satisfies to $(*)$ then so do the functions of the form $af(x)+b$, for any real numbers $a$ and $b$. So we can assume that $f(0)=0$ by changing the function linearly, if needed. Now, as you got, we have $f(x+2)-f(x)=g(x)=g(0)=f(2)-f(0)=f(2)$.

On the other hand, if we take $y=2$ in $(*)$, we'll get $f(2x)+f(x+2)=f(3x)+f(2)$, and if we substitute the value of $f(2)$ from the above equation, we'll get the following

$f(2x)+f(x+2)=f(3x)+f(x+2)-f(x) \implies f(2x)+f(x)=f(3x)$. Now substitute $x+1$ for $x$: $f(3x+3)=f(3(x+1))=f(2(x+1))+f(x+1)=f(2x+2)+f(x+1)=f(2x)+f(2)+f(x+1)=f(2x)+f(x)-f(x)+f(2)+f(x+1)=f(3x)+f(x+1)-f(x)+f(2)$.

So, we'll have $f(x+1)-f(x)+f(2)=f(3x+3)-f(3x)=f(3x+1)+f(2)-f(3x) \implies f(x+1)-f(x)=f(3x+1)-f(3x)$. Therefore, in the same way as you did, we can get $f(x+1)-f(x)=f(1)-f(0)=f(1)$ using the continuity of the function $f$. Using simple induction, we'll get

$(1)\space f(x+n)-f(x)=nf(1)$ for any integer $n$.

In particular, we have $f(n)=nf(1)$ for all $n\in\mathbb Z$.

If we plug in $y=n$ in $(*)$ assuming $n$ is an integer, we get

$f(nx)+f(x+n)=f((n+1)x)+f(n)\implies f((n+1)x)=f(nx)+f(x)$. Therefore we can easily prove by induction that

$(2)\space f(nx)=nf(x)$ for all integer $n$ and real $x$.

Now, there are two cases:

$1. f(1)=0 \implies f(n)=0$ for all integer $n$ from $(1)$. And by $(2)$ we get $0=f(1)=f(m\frac{1}{m})=mf(\frac{1}{m})\implies f(\frac{1}{m})=0$ and therefore, again by $(2)\space f(\frac{n}{m})=0$. As the function is continuous and $0$ on rationals then it is $0$ everywhere.

$2. f(1)\neq0$. In this case we can change the function if needed to make $f(1)=1$ (by multiplying with a number). So, we'll have $f(n)=n$ for all integers, and in the same way as in the previous case, we show that $f(\frac{n}{m})=\frac{n}{m}$. Therefore,the function $f(x)-x$ is $0$ on rationals, so it is $0$ everywhere. That's why we get $f(x)=x$.

By taking the note at the beginning, we proved that all the solutions for this problem will be of the form $f(x)=ax+b$ for some real numbers $a$ and $b$.

-
"$f(nx)+f(x+n)=f((n+1)x)+f(n)\implies f((n+1)x)=f(nx)+f(x)$". Why's $f(x+n)-f(n)=f(x)$? Is there a $f(0)$ or sth. missing? – Shuchang Dec 14 '13 at 7:32
I assumed $f(0)=0$ in the beginning. And from $(1)$ and the fact that $f(n)=nf(1)$ you can derive $f(x+n)=f(x)+f(n)$. – Tigran Hakobyan Dec 14 '13 at 8:24
OIC. What about forsaking the assumption? Because we need find all. – Shuchang Dec 14 '13 at 8:36
We still get all of them. If u look at the end, after getting $f(x)=x$ I concluded that all the solutions will be of for, $f(x)=ax+b$, basically because of the assumptions. For assuming $f(x)=0$, you can consider $f'(x)=f(x)-f(0)$. – Tigran Hakobyan Dec 14 '13 at 9:05
Nice solution @TigranHakobyan! But why do you need the cases where $f(1) = 0$ and $f(1) \neq 0$? Once you know that $f(n) = nf(1)$, you know (by your argument) that $f(r) = rf(1)$ for all $r \in \mathbb{Q}$, and by continuity $f(x) = ax$ for all $x\in \mathbb{R}$; where $a = f(1)$ – Prahlad Vaidyanathan Dec 14 '13 at 13:23