Question: Let $f:(0,\infty)\to\mathbb{R}$ be a measurable function and $0<\lambda<1.$ Prove that if all $x,y>0,$ $$f(x+y) = \lambda f(x) + (1-\lambda)f(y),$$ then $f$ is a constant function.
My attempt:
Fix $x,y>0.$ Note that $$f(2x)=f(x)$$ and $$f(2y) = f(y).$$ Also, $$f(2x+y) = \lambda f(2x) + (1-\lambda)f(y) = \lambda f(x) + (1-\lambda)f(y) = f(x+y).$$ Also, $$f(2x+y) = f(x+(x+y)) = \lambda f(x) + (1-\lambda)f(x+y).$$ Since $\lambda\neq 0,$ so we have $$f(x) = f(x+y).$$ By symmetry, we also have $$f(y) = f(x+y).$$ So $$f(x)=f(y).$$ So $f$ is a constant function.
Is my attempt correct?
Yes, your proof is correct.
You really do not need this $$f(2x+y) = f(x+(x+y)) = \lambda f(x) + (1-\lambda)f(x+y).$$
because you already have $$f(x)=f(x+y)$$
Use symmetry to to show $$f(y)=f(x+y)$$
Thus f(x)=f(y). I could not find a better way to do it. If we assume differentiability then we can easily show $f'(x)=0.$