Solution by TYT, maromex and gghx.
We claim the only solutions are f(x)≡x and f(x)≡0, which obviously work. We now show they are the only solutions. Let P(x,y) denote the assertion that f(x+f(y2))=f(x)+yf(y).
Claim 1. f(−y)=−f(y) for all y=0.
Proof. Comparing P(x,y) and P(x,−y) we get yf(y)=−yf(−y)∀y∈R. So if y=0 then f(−y)=−f(y).
Claim 2. f(0)=0.
Proof. Let a=f(0).
P(0,0)⇒f(a)=a.
P(−a,0)⇒f(−a)=a.
If a=0 then from Claim 1 −a=−f(a)=f(−a)=a so a=0, contradiction. Hence f(0)=a=0.
Claim 3. f is an odd function.
Proof. Immediate consequence of Claim 1 and Claim 2.
Claim 4. f(f(y2))=yf(y) for all y∈R.
Proof. P(0,y) implies f(f(y2))=f(0)+yf(y)=yf(y) for all y∈R.
Claim 5. f(x+f(y))=f(x)+f(f(y)) for all x,y∈R.
Proof. P(x,y) and Claim 4 give
f(x+f(y2))=f(x)+f(f(y2))∀x,y∈R(1).
Replacing x by x−f(y2) in (1) yields
f(x−f(y2))=f(x)−f(f(y2))∀x,y∈R(2).
Since f is odd, −f(y2)=f(−y2) and −f(f(y2))=f(−f(y2))=f(f(−y2)). Therefore (2) implies
f(x+f(−y2))=f(x)+f(f(−y2))∀x,y∈R(3).
From (1) and (3) we conclude f(x+f(y))=f(x)+f(f(y)) for all x,y∈R.
Claim 6. f(1)=0 or f(1)=1.
Proof. Let b=f(1). Putting y=1 in Claim 4 yields f(b)=b. Hence putting y=b in Claim 5 yields f(x+b)=f(x)+b∀x∈R. By induction f(x+nb)=f(x)+nb∀x∈R,∀n∈N. Moreover f(1+b)=f(1)+b=2b and f(1)=f(1−b)+b, i.e f(1−b)=0.
Thus
f(f((1+b)2))=f(f((1−b)2+4b))=f(f((1−b)2)+4b)=f(f((1−b)2))+4b(4).
From Claim 4 we get f(f((1+b)2))=(b+1)f(b+1)=2b(b+1) and f(f((1−b)2))=(1−b)f(1−b)=0. As a result we obtain from (4) that
2b(b+1)=4b,
which means b=0 or b=1.
Let S:={s∈R∣f(x+s)=f(x)+f(s)∀x∈R} then
Claim 7.
1. S is closed under negation, addition and subtraction.
2. f(y)∈S for all y∈R.
3. yf(y)∈S for all y∈R.
4. z2yf(y)−y2zf(z)∈S for all y,z∈R.
Proof.
1. If s,t∈S then f(s+t)=f(s)+f(t) and for all x∈R, f(x+s+t)=f(x+s)+f(t)=f(x)+f(s)+f(t)=f(x)+f(s+t). Hence s+t∈S. Moreover since t∈S we get f(x)=f(x−t)+f(t)∀x∈R so f(x+(−t))=f(x)+f(−t)∀x∈R. This means −t∈S. Thus s−t=s+(−t)∈S.
2. Immediate by Claim 5.
3. From P(x,y) we get yf(y)=f(x+f(y2))−f(x)∈S because f(x),f(x+f(y2))∈S (by item 2) and S is closed under subtraction.
4. From P(0,y+f(z2)) and P(y,z) we obtain
f(f((y+f(z2))2))=[y+f(z2)][f(y)+zf(z)]=yf(y)+yzf(z)+f(y)f(z2)+zf(z)f(z2).
Note that zf(z)f(z2)=f(z2)f(f(z2))∈S. Hence taking out all the terms that are known to be in S we get
yzf(z)+f(y)f(z2)=f(f((y+f(z2))2))−yf(y)−zf(z)f(z2)∈S∀y,z∈R(5).
Replacing y by y2 in (5) gives
y2zf(z)+f(y2)f(z2)∈S∀y,z∈R(6).
Swapping y and z in (6) gives
z2yf(y)+f(z2)f(y2)∈S∀y,z∈R(7).
From (6) and (7)
z2yf(y)−y2zf(z)=[z2yf(y)+f(z2)f(y2)]−[y2zf(z)+f(y2)f(z2)]∈S∀y,z∈R.
Claim 8. If S=R then f(x)=bx∀x∈R where b=f(1)∈{0,1}.
Proof. So f is additive over R. Replacing y by y+1 in Claim 4 we get
f(f((y+1)2))=(y+1)f(y+1)⇒f(f(y2+2y+1))=(y+1)[f(y)+b]⇒f(f(y2))+2f(f(y))+b=(y+1)[f(y)+b]⇒2f(f(y))=by+f(y)∀y∈R(8).
Replacing y by y2 in (8) we get
by2+f(y2)=2f(f(y2))=2yf(y)∀y∈R(9).
Since b∈{0,1},f(by2)=bf(y2)∀y∈R. Thus P(by2,y) implies
f(by2+f(y2))=f(by2)+yf(y)⇒f(2yf(y))=bf(y2)+yf(y)⇒2f(yf(y))=b[2yf(y)−by2]+yf(y)⇒2f(yf(y))=(2b+1)yf(y)−b2y2∀y∈R(10).
For x,y∈R we compute f((x+y)2) in two ways
f((x+y)2)f((x+y)2)=2(x+y)f(x+y)−b(x+y)2=2(x+y)[f(x)+f(y)]−b(x+y)2(11)=f(x2+2xy+y2)=f(x2)+f(y2)+2f(xy)=[2xf(x)−bx2]+[2yf(y)−by2]+2f(xy)(12).
Comparing (11) and (12) we obtain f(xy)+bxy=xf(y)+yf(x)∀x,y∈R. In particular for x=f(y) we get
f(yf(y))+byf(y)=f(y)2+yf(f(y))⇒2(2b+1)yf(y)−b2y2+byf(y)=f(y)2+y⋅2f(y)+by⇒4byf(y)=2f(y)2+(b2+b)y2⇒4byf(y)=2f(y)2+2b2y2(b2=b because b∈{0,1})⇒2[f(y)−by]2=0⇒f(y)=by∀y∈R,
as claimed.
Claim 9. If f(1)=1 then f(x)=x∀x∈R.
Proof. First, f(x+1)=f(x)+f(1)=f(x)+1∀x∈R so 1∈S. Take y∈R. It follows from Claim 7 that (y+1)[f(y)+1]=(y+1)f(y+1)∈S. Thus as S is closed under subtraction, y=(y+1)[f(y)+1]−yf(y)−f(y)−1∈S. We conclude that S=R. Thus by Claim 8, f(x)=xf(1)=x for all x∈R.
Claim 10. If f(1)=0 then f≡0.
Proof. Consider arbitrary u,v=0 such that u2,v2∈S. Applying item 4 of Claim 7 we get, for all y,z∈R
(y+u2)2zf(z)−z2(y+u2)f(y+u2)∈S⇒(y2+2u2y+u4)zf(z)−z2(y+u2)[f(y)+f(y2)]∈S⇒[y2zf(z)−z2yf(y)]+[u4zf(z)−z2u2f(u2)]+2u2yzf(z)−u2z2f(y)−z2yf(u2)∈S.
Since y2zf(z)−z2yf(y)∈S and u4zf(z)−z2u2f(u2)∈S, subtraction shows
2u2yzf(z)−u2z2f(y)−z2yf(u2)∈S∀y,z∈R(13).
Replacing z by vz in (13) yields
2u2vyzf(vz)−u2v2z2f(y)−v2f(u2)z2y∈S∀y,z∈R(14).
Since the roles of u and v are symmetric, swapping u and v in (14) yields
2uv2yzf(uz)−u2v2z2f(y)−u2f(v2)z2y∈S∀y,z∈R(15).
Subtracting the terms in (14) and (15) gives
2uv2yzf(uz)−2u2vyzf(vz)−[u2f(v2)−v2f(u2)]yz2∈S∀y,z∈R,
or zαu,v(z)y∈S∀y,z∈R where αu,v(z):=2uv2f(uz)−2u2vf(vz)−[u2f(v2)−v2f(u2)]z.
If there exists z∗=0 such that z∗αu,v(z∗)=0 then z∗αu,v(z∗)y ranges over R when y varies over R. Thus S=R so by Claim 8, f≡0. But this contradicts z∗αu,v(z∗)=0.
Thus zαu,v(z)=0∀z=0 so αu,v(z)=0∀z=0. Since αu,v(0)=0, we get
2uv2f(uz)−2u2vf(vz)−[u2f(v2)−v2f(u2)]z=0∀z∈R(16).
Replacing z by vz in (16) gives
2uv2f(vuz)−2u2vf(z)−vu2f(v2)−v2f(u2)z=0∀z∈R,
or
f(vuz)−vuf(z)−2uv3u2f(v2)−v2f(u2)z=0∀z∈R,
or, by letting c:=vu=0 and d:=2uv3u2f(v2)−v2f(u2)
f(cz)=cf(z)+dz∀z∈R(17).
Consequently
f(c2z)=cf(cz)+cdz=c[cf(z)+dz]+cdz=c2f(z)+2cdz∀z∈R(18).
P(c2x,cy) together with (18) give
f(c2x+f(c2y2))=f(c2x)+cyf(cy)⇒f(c2x+c2f(y2)+2cdy2)=[c2f(x)+2cdx]+cy[cf(y)+dy]⇒f(c2x+c2f(y2)+2cdy2)=c2[f(x)+yf(y)]+2cdx+cdy2∀x,y∈R(19).
Also
f(c2x+c2f(y2))=c2f(x+f(y2))+2cd[x+f(y2)]=c2[f(x)+yf(y)]+2cdx+2cdf(y2)∀x,y∈R(20).
Subtracting (20) from (19) we get
f(c2x+c2f(y2)+2cdy2)−f(c2x+c2f(y2))=cd[y−f(y2)]∀x,y∈R(21).
Putting x=−f(y2) in (21) gives cd[y−f(y2)]=f(2cdy2) so (21) becomes
f(c2x+c2f(y2)+2cdy2)−f(c2x+c2f(y2))=f(2cdy2)∀x,y∈R(22).
For each fixed y∈R it can be observed that w:=c2x+c2f(y2) ranges over R as x varies over R. Hence (22) implies
f(w+2cdy2)=f(w)+f(2cdy2)∀w∈R
so 2cdy2∈S by the definition of S. Thus
2cdy2∈S∀y∈R.
If d=0 then 2cdy2 ranges over R⩾0 (or R⩽0) when y varies over R. Since S is closed under negation, we conclude that S=R. So again by Claim 8, f≡0. But then d=2uv3u2f(v2)−v2f(u2)=0, a contradiction.
Thus d=0 and so f(cz)=cf(z)∀z∈R. In particular f(c)=cf(1)=0 and f(c2)=cf(c)=0, which means f(v2u2)=0.
Thus for all s,t∈S such that s,t>0
f(ts)=0.
Owing to the facts 0∈S, f(0)=0, f is odd and S is closed under negation we conclude that
f(ts)=0
for all s,t∈S where t=0.
Now suppose that f(y)=0 for some y∈R then from Claim 4
f(y)=f(f(y)f(f(y2)))=0
since f(y),f(f(y2))∈S. But this is a contradiction. So indeed it must be the case that f≡0.