How to prove convex+concave=affine?

Suppose $f:\mathbb{R}^n\to \mathbb{R}$ is both convex and concave, how to prove that $f$ is linear? or exactly speaking, $f$ is affine?

I thought for the whole day, but I cannot figure it out.

When I was working on this problem, I met another problem, are all the convex function continuous? If not, is there any counter example?

Actually, I can prove for one dimensional case, in which $f:\mathbb{R}\to \mathbb{R}$. However, I cannot generalize it into n dimensional cases.

By the way, I use definition for convex(concave) like this: $$f(t\vec{x}+(1-t)\vec{y})\leq(or \geq) tf(\vec{x})+(1-t)f(\vec{y}), \forall t\in[0,1].$$

Thank you so much!

Let $g(x) = f(x) - f(0)$. It suffices to show that $g$ (which is also both convex and concave, and satisfies $g(0)=0$) is linear. Next, note that for $t > 1$, $x = (1/t) (tx) + (1 - 1/t) (0)$.

That should give you a good start...

• Thank you so much! That helps a lot! – breezeintopl Feb 2 '12 at 5:25
• I'm done! Thank you sooooooo much! – breezeintopl Feb 2 '12 at 6:05
• @breezeintopl Click the green checkmark near the voting controls. – Glen Wheeler Mar 23 '12 at 9:06
• @ Robert Israel, Hi I got stuck in the same problem. Would you explain more about your answer, I could not get the result or complete the assertion. Thank you – soodehMehboodi Mar 17 '19 at 17:41

I think it becomes more clear when we simply apply the definition of convexity and concavity.

From the convexity of $f$ we have for $x_1, x_2\in \mathbb{R^n}$ and $\lambda \in [0,1]$$f((1-\lambda)x_1 + \lambda x_2) \le (1- \lambda)f(x_1)+\lambda f(x_2)$$ and similarly for concavity we have $$f((1-\lambda)x_1 + \lambda x_2) \ge (1- \lambda)f(x_1)+\lambda f(x_2)$$ Thus it follows that $$f((1-\lambda)x_1 + \lambda x_2) = (1- \lambda)f(x_1)+\lambda f(x_2)$$ We often think of$(1-\lambda)x_1 + \lambda x_2$as a point on the line segment between$x_1$and$x_2$. Similarly from above we can see that$f((1-\lambda)x_1 + \lambda x_2)$lies on the line segment between$f(x_1)$and$f(x_2)$. Since we have chosen$x_1$and$x_2$arbitrarily it starts to become apparent why$f$is affine. If we recall, an affine function takes the form$ax+b$where$a \in \mathbb{R^n}$and$ b \in \mathbb{R}$which is a line. Whether convexity implies continuity depends on the domain (are you on a bounded domain or all of$\mathbb{R}^n$?). Consider, e.g., a smiling frog; the graph of the function is the smile, but at the end points of the smile, it is the eyes. That's a convex but not continuous function. If$f$has a second derivative, then the two requirements imply that$f'' \ge 0$and$f'' \le 0$so that$f'' = 0$which implies that$f\$ is linear.

• what if f is not differentiable ? – David Refaeli May 14 at 12:21
• Then you have to do something else. – marty cohen May 14 at 13:54