Solution by AIME4096.
We claim that the complete solution set is f(x)≡0,f(x)=x∀x∈R. Both functions clearly satisfy f(x2+f(xy))=f(x)2+yf(x) for all x,y∈R. We now prove that these are the only solutions. Let P(x,y) denote the assertion f(x2+f(xy))=f(x)2+yf(x).
Lemma 1. f(0)=0.
Proof. Assertion P(0,y) gives f(f(0))=f(0)2+yf(0) for every y∈R. Taking y=0 and y=1 gives f(f(0))=f(0)2 and f(f(0))=f(0)2+f(0), respectively. Hence f(0)=0. □
Lemma 2. For every a=0, define the affine map Ta:R2→R2 by Ta(u,v)=(a2+v,f(a)2+af(a)u). If Γ=(z,f(z)):z∈R is the graph of f, then Ta(Γ)⊆Γ.
Proof. Let (z,f(z))∈Γ. Since a=0, put y=az in P(a,y). Then ay=z, so
f(a2+f(z))=f(a)2+af(a)z.
Hence Ta(z,f(z))∈Γ. Therefore Ta(Γ)⊆Γ. □
Lemma 3. If f≡0, then there exists a=0 such that f(a)=0.
Proof. Since f≡0, there exists a∈R with f(a)=0. By Lemma 1, f(0)=0, so necessarily a=0. □
Lemma 4. If f≡0, then f is injective.
Proof. Choose a=0 with f(a)=0 by Lemma 3. Suppose f(u)=f(v). Applying Ta to (u,f(u)) and (v,f(v)) gives two points of Γ whose first coordinates are equal, namely a2+f(u)=a2+f(v). Since Γ is the graph of a function, those two points must have the same second coordinate. Hence
f(a)2+af(a)⋅u=f(a)2+af(a)⋅v.
Since a=0 and f(a)=0, we obtain u=v. Thus f is injective. □
Lemma 5. If f≡0, then f is surjective.
Proof. Choose a=0 with f(a)=0. By Lemma 2, for every z∈R, the point Ta(z,f(z))=(a2+f(z),f(a)2+af(a)z) belongs to Γ. Let r∈R be arbitrary. Since af(a)=0, choose z=f(a)a(r−f(a)2). Then the second coordinate of Ta(z,f(z)) is r. Since the resulting point lies on Γ, its first coordinate, say u, satisfies f(u)=r. Thus every r∈R is attained by f, so f is surjective. □
Lemma 6. If f≡0, then f(−x)=−f(x) for every x=0.
Proof. Fix x=0. Putting y=xt in P(x,y) gives f(x2+f(t))=f(x)2+xtf(x). Putting y=−xt in P(−x,y) gives f(x2+f(t))=f(−x)2−xtf(−x). Therefore
f(x)2−f(−x)2+xt(f(x)+f(−x))=0
for every t∈R. Taking t=0 gives f(x)2=f(−x)2, and then taking t=x gives f(x)+f(−x)=0. Hence f(−x)=−f(x). □
Lemma 7. If f≡0, then 0 is the unique zero of f.
Proof. By Lemma 5, there exists r∈R such that f(r)=0. Assume for the sake of contradiction r=0. Then Lemma 6 gives f(−r)=0. Since f is injective by Lemma 4, we obtain r=−r, hence r=0, a contradiction. Therefore every zero of f is 0. □
Lemma 8. If f≡0, then f(x)>0 whenever x>0, and f(x)<0 whenever x<0.
Proof. Setting assertion P(x,0) and using Lemma 1 gives f(x2)=f(x)2 for every x∈R. If t>0, write t=x2 with x=0. Then f(t)=f(x)2. By Lemma 7, f(x)=0, so f(t)>0. If t<0, then −t>0, so f(−t)>0, and Lemma 6 gives f(t)=−f(−t)<0. □
Lemma 9. If f≡0, then Ta(Γ)=Γ for every a=0.
Proof. By Lemma 7, f(a)=0 for every a=0, so Ta is an invertible affine map. Lemma 2 gives Ta(Γ)⊆Γ. The first coordinate of Ta(z,f(z)) is a2+f(z). Since f is surjective by Lemma 5, this first coordinate assumes every real value. Thus Ta(Γ) contains a point above every real first coordinate. Since Γ contains exactly one point above each first coordinate, we obtain Ta(Γ)=Γ as desired. □
Lemma 10. For every a=0, put ca=af(a). Then ca>0. Moreover, if Sa=Ta2, then, identifying points of R2 with vectors X, we have Sa(X)=caX+Wa, where Wa=(a2+f(a)2,f(a)2+caa2).
Proof. By Lemma 8, a and f(a) have the same sign, so ca>0. A direct computation gives Sa(u,v)=(a2+f(a)2+cau,f(a)2+caa2+cav), which is exactly Sa(X)=caX+Wa. Since Ta(Γ)=Γ by Lemma 9, we also have Sa(Γ)=Γ. □
Lemma 11. Suppose that f≡0 and f=id. Then there exist a,b=0 such that ca=1 and cb=ca.
Proof. If cx=1 for every x=0, then f(x)=x for every x=0, and Lemma 1 gives f(0)=0, so f=id, contrary to hypothesis. Hence there exists a=0 with ca=1. Suppose that cx=ca=:c for every x=0. Then f(x)=cx for every x∈R. Assertion P(x,0) in the original equation gives f(x2)=f(x)2, hence cx2=c2x2 for every x. Taking x=1 gives c=c2. Since c>0 by Lemma 10, we obtain c=1, contradicting ca=1. Therefore some b=0 satisfies cb=ca. □
Lemma 12. Suppose that f≡0 and f=id. Then Γ possesses a nonzero translation symmetry.
Proof. Let a,b be given by Lemma 11, and write c=ca and d=cb. If d=1, then Lemma 10 gives Sb(X)=X+Wb. Since f(b)=b, we have Wb=(2b2,2b2)=(0,0). Thus Sb is a nonzero translation preserving Γ. Assume now that d=1. Since c=1 as well, both Sa and Sb are homotheties. Let Ca and Cb be their respective fixed points. Since Sr(X)=crX+Wr and cr=1, its unique fixed point is Cr=1−cr1Wr. Since f(r)=crr, this becomes
Cr=1−crr2(1+cr2,cr(cr+1)).
We now claim that Ca=Cb. Suppose otherwise for the sake of contradiction. Since a,b=0 and c,d=1, the first coordinates of Ca and Cb are nonzero. Hence equality of the ratios of their second and first coordinates gives 1+c2c(c+1)=1+d2d(d+1). Cross-multiplication yields (c−d)(cd−c−d−1)=0. Since c=d, we obtain cd−c−d−1=0, or equivalently d=c−1c+1. Because c>0 and d>0, this equality forces c>1 and d>1. Substituting d=c−1c+1 gives 1−d1+d2=1−c1+c2. Equality of the first coordinates of Ca and Cb therefore gives a2=b2. Hence b=a or b=−a. By Lemma 6, in either case f(b)=±f(a) with the same sign as b=±a, and consequently bf(b)=af(a). Thus cb=ca, contradicting the choice of a and b. Therefore Ca=Cb.
Now write A=Sa and B=Sb. Since A and B are homotheties centered at Ca and Cb, respectively, we have A(X)=cX+(1−c)Ca and B(X)=dX+(1−d)Cb. Their inverses are
A−1(X)=c1X+(1−c1)Ca and B−1(X)=d1X+(1−d1)Cb.
Consider the commutator K=ABA−1B−1. Since the linear parts of A, B, A−1, and B−1 are c, d, c1, and d1, respectively, the linear part of K is 1. Hence K is a translation. We compute the translation vector directly. Conjugating B by A gives ABA−1(X)=dX+(1−d)A(Cb). Therefore K(X)=ABA−1(B−1(X))=X+(d−1)Cb+(1−d)A(Cb). Since A(Cb)=cCb+(1−c)Ca, we obtain K(X)=X+(d−1)Cb+(1−d)cCb+(1−d)(1−c)Ca, and collecting terms gives K(X)=X+(c−1)(d−1)(Ca−Cb). Thus K is the translation by the vector (c−1)(d−1)(Ca−Cb). This vector is nonzero because c=1, d=1, and Ca=Cb. By Lemma 9, A(Γ)=Γ and B(Γ)=Γ. Hence A−1(Γ)=Γ and B−1(Γ)=Γ, so K(Γ)=Γ. Therefore Γ possesses a nonzero translation symmetry. □
Lemma 13. Any nonzero translation symmetry of Γ has a nonzero horizontal component.
Proof. Suppose translation by (0,k) preserves Γ. Then for every (x,f(x))∈Γ, the point (x,f(x)+k) also belongs to Γ. Since Γ is the graph of a function, there is exactly one point of Γ with first coordinate x. Hence k=0. Therefore every nonzero translation symmetry has a nonzero horizontal component. □
Lemma 14. Suppose that f≡0 and f=id. Then there exists a dense additive subgroup H⊆R and a constant λ∈R such that f(x+t)=f(x)+λt for every x∈R and every t∈H.
Proof. By Lemma 12, choose a nonzero translation symmetry (h,k) of Γ. By Lemma 13, h=0. Let c=ca, where a is the element chosen in Lemma 11. Since c>0 and c=1, Sa is a homothety of ratio c. Conjugating the translation by (h,k) with Sar gives a translation by (crh,crk) for every r∈Z. Therefore every finite composition of these translations is a translation by
(hi∑micri,ki∑micri),
where mi,ri∈Z. Define H0={∑imicri:mi,ri∈Z} and H=hH0. Since c>0 and c=1, either cn→0 as n→+∞ or cn→0 as n→−∞. Hence H0 contains positive elements arbitrarily close to 0. We now claim that H0 is dense in R. Let u∈R and ε>0. Choose δ∈H0 with 0<δ<2ε. Let m∈Z be an integer nearest to δu. Then ∣u−mδ∣≤2δ<ε. Since m⋅δ∈H0, every real number can be approximated arbitrarily closely by elements of H0. Thus H0 is dense in R, and since h=0, H=hH0 is dense in R. Put λ=hk. Every translation constructed above has the form (t,λt) with t∈H. Therefore, for every x∈R and t∈H, the point (x+t,f(x)+λt) belongs to Γ. Hence f(x+t)=f(x)+λt. □
Lemma 15. Under the hypotheses of Lemma 14, there exists λ>0 such that f(x)=λx for every x∈R.
Proof. Fix x>0. By Lemma 8, f(x)>0. Since H is dense, there exist sequences tn,sn∈H such that tn>−x, sn<−x, and tn→−x, sn→−x. Since x+tn>0, Lemma 8 gives f(x+tn)>0. By Lemma 14, f(x)+λtn>0. Likewise, x+sn<0, so f(x+sn)<0, and hence f(x)+λsn<0. If λ<0, then f(x)+λsn→f(x)−λx>0, contradicting f(x)+λsn<0. If λ=0, then f(x)+λsn=f(x)>0, again a contradiction. Hence λ>0. Taking limits in f(x)+λtn>0 gives f(x)−λx≥0, while taking limits in f(x)+λsn<0 gives f(x)−λx≤0. Hence f(x)=λx for every x>0. By Lemma 6, if x<0 then f(x)=−f(−x)=λx, while Lemma 1 gives f(0)=0. Therefore f(x)=λx for every x∈R. □
Lemma 16. Under the hypotheses of Lemma 14, λ=1.
Proof. By Lemma 15, f(x)=λx for every x∈R, with λ>0. Substituting into the original equation gives λ(x2+λxy)=λ2x2+λxy for every x,y∈R. Setting y=0 gives λx2=λ2x2 for every x. Taking x=1 gives λ=λ2. Since λ>0, we obtain λ=1. Hence f=id. □
Therefore, if f≡0, then f is the identity function and we are done. ■