Let $f$ be a real function defined on some interval $I$.
Assuming that $f$ both convex and concave on $I$, i.e, for any $x,y\in I$ one has
$$f(\lambda x+(1-\lambda)y)=\lambda f(x)+(1-\lambda)f(y),\, \, \lambda\in (0,1) .$$
I would like to show that $f$ is of the form $f=ax+b$ for some $a,b$.
I was able to prove it when $f$ is differentiable, using the relation $$f'(x)=f'(y).$$
Anyway, I was not able to provide a general proof (without assuming that $f$ is differentiable, and without assuming that $0\in I$).
Any answer will be will be appreciated.
Edit: It is little bit different from tte other question How to prove convex+concave=affine?. Here $f$ is defined on some interval, so $o$ not necessary in the domain. Please remove the duplicate message if this possible