The following is a well known assertion in the convex function topic:
If $f:\mathbb{R}\to\mathbb{R}$ is a real function then it is convex and concave function simultaneously if and only if it is an affine function.
I did a proof for it as follows and I think something went wrong. (e.g., in case (2)). Any idea that can help me? Thanks.
Assume that $f$ is both a convex and concave function then we have
$f(\lambda x+(1-\lambda y))=\lambda f(x)+(1-\lambda)f(y)\;;\;\;x,y\in\mathbb{R},\; 0\leq\lambda\leq1.$
So we have :case (1) $0\leq x\leq1$
$f(x)=f(x\times1+(1-x)\times0)=xf(1)+(1-x)(f(0))=x(f(1)-f(0))+f(0)$
Also case (2) $x>1$
$f(\frac{1}{x})=f(\frac{1}{x}\times1+(1-\frac{1}{x})\times0)=\frac{1}{x}f(1)+(1-\frac{1}{x})(f(0))=\frac{1}{x}(f(1)-f(0))+f(0)$
Now to achieve the goal it suffices to put $A=(f(1)-f(0))$ and $B=f(0)$. Then $f(x)=Ax+B$ .