Solution by AIME4096.
We claim that the complete solution set is the following. For a solution f:R→R, define
H=⟨f(y)2:y∈R⟩,
the additive subgroup of R generated by all numbers f(y)2. Then f is characterized by the two properties
f(x+h)=f(x)+h∀x∈R, h∈H,
and
f(x)2∈H∀x∈R.
Equivalently, f(x)−x is constant on every coset of H. Thus, if C is a coset of H, there is a constant cC∈R such that
f(x)=x+cC∀x∈C,
and necessarily
(x+cC)2∈H∀x∈C.
Conversely, every function satisfying these conditions is a solution. We now show that the functions that satisfy these conditions are our only solutions.
Let P(x,y) denote the assertion f(x+f(y)2)=f(x)+f(y)2. Suppose throughout the first part that P(x,y) holds for all x,y∈R.
Lemma 1. For every x,y∈R, f(x−f(y)2)=f(x)−f(y)2.
Proof. Note that the assertion P(x−f(y)2,y) yields
f(x)=f(x−f(y)2)+f(y)2,
where subtracting f(y)2 from both sides gives
f(x−f(y)2)=f(x)−f(y)2.
This proves the lemma. □
Lemma 2. For every x,y∈R and every n∈Z, f(x+nf(y)2)=f(x)+nf(y)2.
Proof. We proceed separately according to the sign of n. For n=0, f(x)=f(x)+0, so the statement is immediate. For n>0, we use induction on n. The case n=1 is exactly P(x,y). Assume for some n≥1 that
f(x+nf(y)2)=f(x)+nf(y)2.
Applying P(x+nf(y)2,y), we obtain
f(x+(n+1)f(y)2)=f(x+nf(y)2+f(y)2)=f(x+nf(y)2)+f(y)2=f(x)+nf(y)2+f(y)2=f(x)+(n+1)f(y)2..
Hence the statement holds for every n≥0. For n<0, write n=−m with m>0. Lemma 1 gives the case n=−1, and repeating the same argument gives
f(x−mf(y)2)=f(x)−mf(y)2.
Therefore our lemma is proven for all n∈Z. □
Lemma 3. Let H=⟨f(y)2:y∈R⟩. Then f(x+h)=f(x)+h for every x∈R and every h∈H.
Proof. By definition of the additive subgroup generated by the set {f(y)2:y∈R}, every h∈H has the form h=∑i=1nmif(yi)2 for some n∈N, some m1,…,mn∈Z, and some y1,…,yn∈R. We prove the required identity by repeatedly applying Lemma 2. First,
f(x+m1f(y1)2)=f(x)+m1f(y1)2.
Now apply Lemma 2 again, this time with the starting point x+m1f(y1)2. Such yields
f(x+m1f(y1)2+m2f(y2)2)=f(x+m1f(y1)2)+m2f(y2)2=f(x)+m1f(y1)2+m2f(y2)2..
Continuing in this manner through all n terms gives
f(x+h)=f(x+i=1∑nmif(yi)2)=f(x)+i=1∑nmif(yi)2=f(x)+h..
This proves our lemma. □
Lemma 4. The function g(x)=f(x)−x is constant on every coset of H.
Proof. Let x∈R and h∈H. By Lemma 3, f(x+h)=f(x)+h.
Therefore
g(x+h)=f(x+h)−(x+h)=f(x)+h−x−h=f(x)−x=g(x)..
Now suppose x1,x2 belong to the same coset of H. Then x2−x1∈H, so g(x2)=g(x1+(x2−x1))=g(x1). Thus our lemma is proven. □
Lemma 5. For every coset C∈R/H, there exists a constant cC∈R such that f(x)=x+cC for every x∈C. Moreover, (x+cC)2∈H for every x∈C.
Proof. By Lemma 4, g(x)=f(x)−x is constant on C. Let this constant be cC. Then f(x)=x+cC. It remains to prove the second assertion. By the definition of H, every generator f(z)2,z∈R belongs to H. Taking z=x∈C, we obtain f(x)2∈H, where since f(x)=x+cC, this becomes (x+cC)2∈H. Thus the lemma follows. □
At this point, we have proved that every solution must have the claimed form. It remains to prove that every function of the claimed form actually works.
Fix arbitrary x,y∈R. Taking h−f(y)2 in the identity f(x+h)=f(x)+h gives f(x+f(y)2)=f(x)+f(y)2. Thus P(x,y) holds. Since x and y were arbitrary, the original functional equation holds for all x,y∈R and we are done. ■