Define g(x)=x−f(x). The condition on f then rewrites as follows: For every x,y∈R such that ((x+y)−g(x))((x+y)−g(y))>0, we have g(x)=g(y). This condition may in turn be rewritten in the following form: If g(x)=g(y), then the number x+y lies (non-strictly) between g(x) and g(y). Notice here that the function g1(x)=−g(−x) also satisfies (∗), since
g1(x)=g1(y)⟹g(−x)=g(−y)⟹−(x+y) lies between g(−x) and g(−y)⟹x+y lies between g1(x) and g1(y)
On the other hand, the relation we need to prove reads now as
g(x)⩽g(y) whenever x<y.
Similarly, if X>2x, then g attains at most two values on [x;X−x) - namely, X and, possibly, some Y<X and hence by (*) we get X⩽a+x⩽g(a). Now, for any b∈(X−x;x) with g(b)=X we similarly get b+x⩽g(b). Therefore, the number a+b (which is smaller than each of a+x and b+x) cannot lie between g(a) and g(b), which by (*) implies that g(a)=g(b). Hence g may attain only two values on (X−x;x], namely X and g(a)>X. To prove the second claim, notice that g1(−x)=−X−X. Passing back to g, we get what we need. Lemma 2. If X>2x, then g is constant on (x;X−x). Proof. Again, it suffices to prove the first claim only. Assume, for the sake of contradiction, that there exist a,b∈(X−x;x) with g(a)=g(b); by Lemma 1, we may assume that g(a)=X and Y=g(b)>X. Notice that min{X−a,X−b}>X−x, so there exists a u∈(X−x;x) such that u>2x. Applying Lemma 2 to a in place of x, we obtain that g is constant on (a,Y−a). By (2) again, we have x⩽Y−b<g(y) for some x<y. Denote X=g(x) and Y=g(y); by (*), we have X⩾x+y⩾Y, so Y−y⩽x<y⩽X−x, and hence (Y−y;y)∩(x;X−x)=(x,y)=∅. On the other hand, since Y−y<y and x<X−x, Lemma 3 shows that g should attain a constant value X on (x;X−x) and a constant value Y=X on (Y−y;y). Since these intervals overlap, we get the final contradiction.