Finding all functions $ f : \mathbb R \to \mathbb R $ satisfying $ f ( x ) f ( y ) + f ( x y ) + f ( x ) + f ( y ) = f ( x + y ) + 2 x y $

Find all functions $ f : \mathbb R \to \mathbb R $ satisfying $$ f ( x ) f ( y ) + f ( x y ) + f ( x ) + f ( y ) = f ( x + y ) + 2 x y $$ for all $ x , y \in \mathbb R $.

I tried the standard way: $ x = 0 $, $ x = y $, $ x = 1 $, $ \dots $, but without any success. I spent quite some time trying to solve it but didn't succeed.

I tried to reduce it to Cauchy's 1-4 equations but didn't succeed. In the course of it, I found interesting works of Aczél, Erdős and even Putnam, but they are not directly related, I guess.

Any idea? I am interested in this problem but I couldn't solve!


"Quick" solution: let $g(x)=x-f(x)$. Then in terms of $g$, the functional equation can be rearranged to $$g(x+y)+g(x)g(y)=(1+x)g(y)+(1+y)g(x)+g(xy).$$ By my answer to this question, the solutions to this functional equation are $g(x)=0$, $g(x)=3x$, and $g(x)=x(x+1)$. We conclude that the solutions for $f$ are $f(x)=x$, $f(x)=-2x$, and $f(x)=-x^2$.


Alternatively, here's a direct solution which I was foolish enough to work out thoroughly before realizing that this equation reduces to one I've solved before. :)

It is easy to verify that $f(x)=x$, $f(x)=-2x$, and $f(x)=-x^2$ are solutions. I claim they are the only solutions.

First, setting $y=0$ gives $f(0)(f(x)+2)=0$ for all $x$, so either $f(x)=-2$ for all $x$ or $f(0)=0$. It is easily verified that $f(x)=-2$ does not work, so we must have $f(0)=0$.

Now let us write $a=f(1)$. Setting $x=y=2$ gives $f(2)^2+2f(2)=8$, so $f(2)=2$ or $f(2)=-4$. Setting $x=y=1$ gives $a^2+3a=f(2)+2$. If $f(2)=2$ we get either $a=1$ or $a=-4$. If $f(2)=-4$ we get either $a=-1$ or $a=-2$.

Setting $y=1$ we have $(a+2)f(x)+a=f(x+1)+2x$ and so $$f(x+1)=(a+2)f(x)-2x+a\tag{*}$$ for all $x$. Note that this recurrence can be used to find $f(x)$ for all integers $x$ from $a$. We now consider the possible values of $a$ one by one.

If $a=-2$, $(*)$ immediately gives $f(x+1)=-2(x+1)$ and so $f(x)=-2x$ for all $x$.

If $a=-4$, then we have $f(2)=2$ and $f(-1)=-1$ and $f(-2)=1/2$ from $(*)$. But then the functional equation fails with $x=2$ and $y=-1$. So this case is impossible.

If $a=-1$, we find that $f(x)=-x^2$ for all integers $x$. The recurrence $(*)$ has the form $$f(x+1)=f(x)-2x-1.$$ Now setting $y=-1$ in the original equation gives $f(-x)-1=f(x-1)-2x$. Replacing $x$ with its negative, we find $$f(-(x+1))=f(x)-2x-1.$$ Comparing the two centered equations above, we see $f(x+1)=f(-(x+1))$ so $f$ is an even function. Now setting $x=y$ and $x=-y$ in the original equation give $$f(x)^2+f(x^2)+2f(x)=f(2x)+2x^2$$ and $$f(x)^2+f(x^2)+2f(x)=-2x^2$$ respectively. Comparing these equations, we get $f(2x)=-4x^2$ and so $f(x)=-x^2$ for all $x$.

Finally, suppose $a=1$. We then have $f(x)=x$ for all integers $x$ and the recurrence $(*)$ is $$f(x+1)=3f(x)-2x+1.$$ Using the recurrence backwards we have $f(x-1)=\frac{f(x)+2x-3}{3}$ and so we get $$f(-x)=\frac{f(x)-4x}{3}.$$ Replacing $x$ with $-x$ we get $$f(x)=\frac{f(-x)+4x}{3}=\frac{\frac{f(x)-4x}{3}+4x}{3}=\frac{f(x)}{9}+\frac{8x}{9}.$$ Solving for $f(x)$ we conclude that $f(x)=x$ for all $x$.