Suppose that $f: \mathbb{R}^+ \to \mathbb{R}^+$ is a continuous function such that for all positive real numbers $x,y$ the following is true :
$$(f(x)-f(y)) \left ( f \left ( \frac{x+y}{2} \right ) - f ( \sqrt{xy} ) \right )=0.$$
Is it true that the only solution to this is the constant function ?



For a continuous function $f:\mathbb{R}^{+}\to\mathbb{R}^{+}$ does $(f(x)-f(y)) (f(\frac{x+y}{2}) - f(\sqrt{xy}))=0$ imply that $f$ is constant?
Yes. If $f$ were not constant, then (since ${\bf R}^+$ is connected) it could not be locally constant, thus there exists $x\_0 \in {\bf R}^+$ such that $f$ is not constant in any neighbourhood of $x\_0$. By rescaling (replacing $f(x)$ with $f(x\_0 x)$) we may assume without loss of generality that $x\_0=1$.


For any $y \in {\bf R}^+$, there thus exists $x$ arbitrarily close to $1$ for which $f(x) \neq f(y)$, hence $f((x+y)/2) = f(\sqrt{xy})$. By continuity, this implies that $f((1+y)/2) = f(\sqrt{y})$ for all $y \in {\bf R}^+$. Making the substitution $z := (1+y)/2$, we conclude that $f(z) = f(g(z))$ for all $z > 1/2$, where $g(z) := \sqrt{2z-1}$. The function $g$ attracts $[1, \infty)$ to the fixed point $z=1$, so on iteration and by using the continuity of $f$ we conclude that $f(z)=f(1)$ for all $z >1$. Similarly, $h = g^{-1}$ defined by $h(z) = (z^2 + 1)/2$ attracts $(0, 1]$ to the fixed point $z = 1$, so by the same argument $f(z) = f(1)$ for $z < 1$, making $f$ constant on all of $\bf R^+$.


