Let P(x,y) denote plugging x and y into the original equation. We have
P(0,1)P(1,1)P(1,f(1)):f(0)=0,:f(f(1))=f(1),:f(f(f(1)))=(1−f(1))f(f(1))+f(1)2f(f(1)).
By combining the second and the third equality we get
f(1)=(1−f(1))⋅f(1)+f(1)3,i.e.f(1)2=f(1)3.
From this we have two options: f(1)=1 or f(1)=0.
If f(1)=1, we get
P(x,1):f(x)=x2,
so f(x)=x2 should hold for all real x. By plugging this into the original equation we can conclude that this is not possible. Hence, f(1)=0 must hold.
Let c be an arbitrary root of the function f. We have
P(x,c):0=(1−c)f(xc).
Therefore, if c=1, f(cx)=0 must hold for all x∈R. If c=0 this implies that f(x)=0 for all x∈R. We check directly that f≡0 is indeed a possible solution of the original equation.
Now assume that f is not identically equal to 0. Calculations above show in that case 0 and 1 are the only roots of the function f. Now we have
P(1,y):f(f(y))=(1−y)f(y)+y2f(y)=(1−y+y2)f(y),(1)
and for x=0
P(x1,x):f(xf(x))=f(x),(2)
since f(1)=0.
Let y1,y2∈R∖{0,1} be such that f(y1)=f(y2)=0. Then from (1) it follows that
1−y1+y12=1−y2+y22,i.e.(y1−y2)(y1+y2−1)=0.
We conclude that
f(y1)=f(y2)⟹y1=y2 or y1+y2=1.(3)
By combining (2) and (3) we get that for all x=0,1 we have
xf(x)=x or xf(x)+x=1,
i.e.
f(x)=x2 or f(x)=x−x2.
Let x∈R∖{0,1} be such that f(x)=x2. By plugging y=x into (1) we get
f(x2)=(1−x+x2)x2.
Now we have two cases: f(x2)=x4 and f(x2)=x2−x4. In the first case, we get x4=(1−x+x2)x2, from which we can easily conclude that x=0 or x=1. Since we assumed x∈/{0,1}, this is not possible. In the second case, we get x2−x4=(1−x+x2)x2, from which we can conclude x=0 or x=21. Again, we can dismiss x=0, and for x=21 we can note that f(21)=(21)2=41=21−(21)2. This shows that f(x)=x−x2 holds for all x=0,1. Since this formula holds for x=0,1 as well, we can conclude that
f(x)=x−x2,∀x∈R.
By plugging this directly into the original equation, we can confirm that this is indeed a solution. Therefore, the only solutions of the original equation are f=0,∀x∈R and f(x)=x−x2,∀x∈R.