A functional equation again!

Determine all functions $$f:\mathbb{R}\rightarrow\mathbb{R}$$ such that $$(x-2)f(y)+f\big(y+2f(x)\big)=f\big(x+yf(x)\big)$$ for all $$x,y\in\mathbb{R}$$.

(Functional equations are on-topic, there are few previous functional equations by other users.)

• To the close voter: yeah nah, this is in no way shape or form a textbook maths problem as opposed to maths puzzle. Jun 3 '20 at 7:45

All such function(s) is(are):

$$f\equiv 0$$ and $$f(x)=x-1$$. These can be easily seen to work via some algebra.

How so?

Suppose $$f(0)=0$$ at first. Putting $$x=0$$ gives $$-2f(y)+f(y)=0$$, so $$f(y)=0$$ for all $$y$$, i.e., $$f$$ is the all-zero function.

The other case is

when $$f(0)\ne 0$$. Now plugging $$y=0$$ gives $$(x-2)f(0)=-f(2f(x))+f(x)$$. Note that if $$f(x_1)=f(x_2)$$, then $$-f(2f(x_1))+f(x_1)=-f(2f(x_2))+f(x_2)$$, so the last relation implies $$(x_1-2)f(0)=(x_2-2)f(0)$$, so $$x_1=x_2$$. This means $$f$$ is injective.

Next, plug in

$$x=2$$ and $$y=0$$, to get $$f(2f(2))=f(2)\implies 2f(2)=2$$ (because of injectivity). Thus $$f(2)=1$$, and by injectivity, $$2$$ is the only number whose image is $$1$$.

We will derive one last thing before the finale.

We claim that the only possible preimage of $$0$$ is $$1$$. Indeed, if $$f(c)=0$$, then putting $$y=2,x=c$$ gives $$(c-2)\cdot 1+1=0$$, which gives $$c=1$$.

Now for the finish. We plug in

$$y=\frac{2f(x)-x}{f(x)-1}$$ (for $$x\ne 2$$). Note that this magical substitution makes $$f(y+2f(x))$$ and $$f(x+yf(x))$$ cancel out, so we are left with (using $$x\ne 2$$)$$(x-2)f\left(\frac{2f(x)-x}{f(x)-1}\right)=0\implies f\left(\frac{2f(x)-x}{f(x)-1}\right)=0.$$But by the last inference, this must mean $$\frac{2f(x)-x}{f(x)-1}=1$$, which can be rearranged to $$f(x)=x-1$$. We derived this assuming $$x\ne 2$$, but this is true for $$x=2$$ as well, so in fact $$f(x)=x-1$$ has to hold for all $$x$$.

• Correct! Quite fast! BTW, someone voted close for my latest two questions! Jun 3 '20 at 5:30
• Typo at the last sentence, it should be "We derived this assuming $x\neq2$" Jun 3 '20 at 10:56
• @justhalf nice catch, fixed! Jun 3 '20 at 11:51