Let S={a∈R∣f(x+a)=f(x)+a∀x∈R}, the original statement is equivalent to xf(x)∈S for all x∈R.
We claim that S={0} or S=R, let’s first consider what happens when S is one of these two sets.
If S={0}, we have, since xf(x)∈S, xf(x)=0 for all x, producing solutions of the form f(x)={0cif x=0if x=0 for a constant c∈R which all satisfy the equation.
If S=R, we have f(x+y)=f(x)+y for all x,y, producing solutions of the form f(x)=x+c for a constant c∈R which all satisfy the equation.
From now assume S is neither of these two sets.
Claim 1:S is an additive subgroup of R, or if a,b∈S then a+b∈S and if a∈S then −a∈S.
The first is true from f(x+a+b)=f(x+a)+b=f(x)+a+b, the second is true from f(x)=f(x−a)+a. (also trivially S is nonempty).
Claim 2:S is a subring (not necessarily with unity) of R, or if a,b∈S then ab∈S.
From xf(x)∈S we have, for a∈S:
(x+a)f(x+a)∈S⇒xf(x)+ax+af(x)+a2∈S,
and, subtracting xf(x), this implies ax+af(x)+a2∈S. So for a,b∈S we have:
This gives 2a2∈S, so 2a(x+f(x))=2(ax+af(x)+a2)−2a2∈S.
Since S is an additive subgroup, any integer multiple of a member is also a member, and in particular, 41f(41)∈S implies f(41)∈S and 2af(41)∈S. Substitute x=41 into 2a(x+f(x)), we get that a∈S implies 2a∈S which completes our proof with 22ab∈S.
Claim 3:S is a subfield of R, or if 0=a∈S then a1∈S.
With the same technique, we have 0=a∈S and xf(x)∈S, so axf(x)∈S for all x∈R. Take x=a1, and then f(a1)∈S which we can plug into 2b(x+f(x))∈S for b∈S to get a2b∈S (since 2bf(a1)∈S). Using a∈S⇒2a∈S, this becomes ab∈S for all 0=a∈S, b∈S. Take a=b to get 1∈S, then take b=1 to get a1∈S as desired.
Claim 4:f(x2)=f(x)2 for all x such that x2∈/S.
From 2a(x+f(x))∈S we get x+f(x)∈S (dividing by 2a for 0=a∈S), and so can write:
x2+f(x2)∈S,x2+f(x)2=(x+f(x))2−2xf(x)∈S
which upon subtraction give f(x2)−f(x)2∈S. On the other hand:
x2f(x2)∈S,x2f(x)2∈S⇒x2f(x2)−x2f(x)2∈S.
Dividing these two for f(x2)−f(x)2=0 gives x2∈S as desired.
Since f(x2+2nx)−x2−2nx is bounded, taking n→∞ zeroes the 2nf(x2+2nx)−x2−2nx and 2nf(x)2−x2 terms, implying the claim.
With the final claim, we have a contradiction: for x∈/S (which exists since S=R) we have f(x)=x. On the other hand, since x+f(x)∈S we derive 2x∈S and so x∈S. Therefore, our aforementioned solutions are indeed the only ones.