If $f(x) = f(y)$ or $f(\frac{x+y}{2}) = f(\sqrt{xy})$, find $f$ 
Assume $f: (0, \infty) \to \mathbb{R}$ is a continuous function such that for any $x,y > 0$, $f(x) = f(y)$ or $f(\frac{x+y}{2}) = f(\sqrt{xy})$. Find $f$.

I would work with each condition separately then combine later. So for $f(\frac{x+y}{2}) = f(\sqrt{xy})$ we see that the argument of each side is part of AM-GM, so that might help. I am wondering though how I might derive anything from the second equation since all I can see is that $f(\frac{x+1}{2}) = f(\sqrt{x})$, which I don't see how helps.
 A: Let we consider an element $(a,b)\in\mathbb{R}^+\times\mathbb{R}^+$: we may say it has type-E if $f(a)=f(b)$ is fulfilled, type-G if $f\left(\frac{a+b}{2}\right)=f(\sqrt{ab})$ is fulfilled, so $E$ and $G$ gives a partition of $\mathbb{R}^+\times\mathbb{R}^+$.
Since $f$ is a continuous function, both $E$ and $G$ (the sets of type-$E$ and type-$G$ elements) are closed set in $\mathbb{R}^+\times\mathbb{R}^+$. By Baire's theorem, $E$ or $G$ contains an open ball, and by projecting such a ball we have that $f(a)=f(b)$ (or $f\left(\frac{a+b}{2}\right)=f(\sqrt{ab})$) holds for every $a,b$ belonging to an open interval $I\subset\mathbb{R}^+$. So we have that $f$ is constant over such interval. Since $f$ is continuous, it is also constant over the closure of $I$. Now we may remove $\pi^{-1}(I)$ (the inverse image of the projection) from $\mathbb{R}^+\times\mathbb{R}^+$ and find another interval over which $f$ is constant. By continuing this way, we get that $f$ is piecewise-constant. But $f$ is continuous, hence it is constant.
