A functional equation in a TST exam

To recap your result: setting $x=y=0$ shows us that \begin{align*} f(f(0))+f(0)&=0\cdot f(0)+f(0) \\ f(f(0))+f(0)&=f(0) \\ f(f(0))&=0. \end{align*} Now from the original equation we set $y=1$ to obtain \begin{align*} f(f(0))+f(x+1)&=f(x)+f(1) \\ f(x+1)&=f(x)+f(1). \end{align*} Let us set $x=0$ in this equation to obtain \begin{align*} f(1)&=f(0)+f(1) \\ 0&=f(0). \end{align*} So the function must go through the origin.

$f(x+1)=f(x)+f(1)$ is a straight-forward recurrence relation. If we assume $f(x)=b\cdot a^x$ and plug in, we obtain \begin{align*} b\cdot a^{x+1}&=b\cdot a^{x}+b\cdot a \\ a^{x+1}&=a^x+a \\ a^{x+1}-a^x-a&=0. \end{align*} This must hold for $x=1,$ which forces $a^2-a-a=0,$ or $a^2-2a=0,$ the solutions of which are $a=0,$ not very exciting, or $a=2,$ which is much more interesting. Indeed, we can handle the $a=0$ case by simply letting $b=0$. So we will say that the solutions are $$f(x)=b\cdot 2^x.$$ We can say something more, though: we proved that the function must go through the origin. In looking at this formula, it is evident that the trivial solution is the only solution of this type, since $2^x\not=0.$ Hence, one answer is that $$\boxed{f(x)=0\quad\forall\,x\in\mathbb{R}.} $$

Another special answer (thanks to mfl in the comments!) we can obtain by inspection: $\boxed{f(x)=x},$ the identity function. To see this, we compute: \begin{align*} f(f(xy-x))+f(x+y)&=yf(x)+f(y) \\ f(xy-x)+x+y&=yx+y \\ xy-x+x+y&=yx+y \\ xy+y&=xy+y, \end{align*} which is true.


If we put $x=0$ then we get $$f(f(0)) = yf(0)\quad \forall y \implies f(0)=0$$

If we put $y= 0$ we get $$ f(f(-x)) =-f(x)\implies \boxed{f(f(x))= -f(-x)}$$

If we put $y=1$ and mark $a=f(1)$ we get $$ f(x+1) = f(x)+a \implies \boxed{f(x+2)= f(x)+2a}$$

If we put $y=2$ and mark $b=f(2)$ we get $$f(f(x)) + f(x+2) =2f(x)+b$$

Plugging in last formula both boxed equations we get:

$$ -f(-x)+f(x)+2a = 2f(x)+b \quad \overset{x=0}{\implies} \quad 2a=b \quad \implies \quad f(-x)=-f(x)$$

So from the first boxed equation we have now $$f(f(x)) = f(x)$$ and the starting equation is now: $$f(xy-x)+f(x+y)= yf(x)+f(y)$$

Plug in to this equation $x=-1$: $$ f(-y+1)+f(-1+y) = yf(-1)+f(y)$$ and if we take into consideration that $f$ is odd we have $\boxed{f(y)= ay}$ for all $y$ and some $a$ which we can get if we plug this function in starting equation.