I am trying to prove the following: If a function $f$ is concave and convex, then it is affine.
Since $f$ is convex we have $f(\lambda x +(1-\lambda)y) \leq \lambda f(x) + (1-\lambda)f(y))$ and $f(\lambda x +(1-\lambda)y) \geq \lambda f(x) + (1-\lambda)f(y)) $. Thus we know $f(\lambda x +(1-\lambda)y) = \lambda f(x) + (1-\lambda)f(y))$. This shows that $f$ is linear and hence it is affine.
Is this proof right? Could anyone tell me if there is another way to prove this? Thanks!