# Both convex and concave functions

Let $f$ be a function from $\mathbb{R}^n$ to $\mathbb{R}$, which is convex & concave and continuous with $f(0)=0$. How to prove that $f(x)=q\cdot x$ for all $x$ in $\mathbb{R}^n$, for a scalar $q$?

I have shown $f(wx)=wf(x)$ for $w$ in $[0,1]$.

-
$q$ is not a scalar but a vector (we take the inner product with $x$). –  Davide Giraudo Apr 10 '12 at 11:25

We have for all $x,y\in\mathbb R^n$ and $\alpha\in [0,1]$: $f(\alpha x+(1-\alpha) y)=\alpha f(x)+(1-\alpha)f(y)$. In particular, for $y=0$ we get that $f(\alpha x)=\alpha f(x)$ and for $\alpha=\frac 12$ it gives $f(x+y)=f(x)+f(y)$. Let $\{e_j\}_{j=1}^n$ the canonical basis of $\mathbb R^n$. For $x=\sum_{j=1}^nx_je_j$ we have $$f(x)=f\left(\sum_{j=1}^nx_je_j\right)=\sum_{j=1}^nf(x_je_j).$$ The fact that $f(x+y)=f(x)+f(y)$ implies that $f(rx)=rf(x)$ for all $r$ rational so by continuity $f(x_je_j)=x_jf(e_j)$ and finally put $v=(f(e_j))_{j=1}^n$.