Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A real valued function $f$ defined in $(a,b)$ is said to be convex if $$f(\lambda x+(1-\lambda)y)\le \lambda f(x)+(1-\lambda)f(y)$$ whenever $a < x < b,\; a < y < b,\; 0< \lambda <1$.
Prove that every convex function is continuous.

Usually it uses the fact:
If $a < s < t < u < b$ then $$\frac{f(t)-f(s)}{t-s}\le \frac{f(u)-f(s)}{u-s}\le\frac{f(u)-f(t)}{u-t}.$$

I wonder whether any other version of this proof exists or not?

share|cite|improve this question
All proofs I have seen boil down to something similar. The above fact is useful in that it shows that right- and left-hand derivatives exist at each point, and hence it is locally Lipschitz. This is true in $\mathbb{R}^n$ as well. – copper.hat Dec 14 '12 at 7:39
Your title is a bit misleading. It is not the case that every convex function is continuous. What is true is that every function that is finite and convex on an open interval is continuous on that interval (including $\mathbb{R}^n$). But for instance, a function $f$ defined as $f(x)=-\sqrt{x}$ for $x>0$ and $f(0)=1$ is convex on $[0,1)$, but not continuous. – Michael Grant Aug 15 '14 at 19:33
Furthermore, in convex analysis we frequently refer to so-called "extended valued functions" defined on the extended real line $[-\infty,+\infty]$. Continuing my example above, for instance, we could define $f(x)=+\infty$ for $x<0$. If we define the secant rule above carefully, using sensible conventions for arithmetic on infinities, you will find that it holds for any points $(a,b)\in\mathbb{R}^n$---even $a,b<0$! – Michael Grant Aug 15 '14 at 19:37
Ha ha! I did not notice that this question is almost two years old! Well. I think the clarifications are still important. – Michael Grant Aug 15 '14 at 19:44
What is the "usual proof" that uses that fact? – Soke Mar 8 '15 at 22:01

The pictorial version. (But it is the same as your inequality version, actually.)

Suppose you want to prove continuity at $a$. Choose points $b,c$ on either side. (This fails at an endpoint, in fact the result itself fails at an endpoint.)


By convexity, the $c$ point is above the $a,b$ line, as shown:


Again, the $b$ point is above the $a,c$ line, as shown:


The graph lies inside the red region,


so obviously we have continuity at $a$.

share|cite|improve this answer

I would be careful to rephrase the query as:

Is there an alternative proof of the fact that a real-valued convex function defined on an open interval of the reals is continuous?

Since in general convex functions are not continuous nor are they necessarily continuous when defined on open sets in topological vector spaces.

An alternative might be to identify the point of discontinuity as x. Then there exists a point arbitrarily close to x, denoted x', whose value f(x') is bounded away by a constant from f(x). Depending on how you want your proof structured, you may think it sufficient to note that this implies the epigraph of the function is not closed and therefore the function is not lower semicontinuous. But every convex function on the reals is lower semicontinuous on the relative interior of its effective domain, which equals the domain of definition in this case.

A more general proof of this property is given in "Convexity and Optimization in Banach Spaces." The authors prove the proposition that every proper convex function defined on a finite-dimensional separated topological linear space is continuous on the interior of its effective domain. You can likely see the relevant proof using Amazon's or Google Book's look inside feature.

share|cite|improve this answer
+1 Welcome to Math.SE! Keep coming back. – user53153 Jan 5 '13 at 8:21

This is an exercise in Rudin's Principles of Mathematical Analysis (Chapter 4 Problem 23 in the 3rd edition). The inequalities you quoted in "Usually it uses the fact", which is an alternative definition of convex functions, are part of an exercise in the problem 23.

One can use the inequalities $$\frac{f(t)-f(x)}{t-s}\le \frac{f(u)-f(x)}{u-s}\le\frac{f(u)-f(t)}{u-t}$$ to show that both $ \lim_{h\to 0^+}F_x(h) $ and $ \lim_{h\to 0^-}F_x(h) $ exist, where $$ F_x(h):=\frac{f(x+h)-f(x)}{h} $$ for $x\in(a,b)$. It follows that $\lim_{h\to 0}f(x+h)-f(x)=0$.

Alternatively, let $x\in (a,b)$. Consider $a<x<x_n<y<b$, where $(x_n)$ is such that $x_n\to x$ as $n\to\infty$ and $y\in (a,b)$ is fixed. Then we have $$ x_n=\lambda_n x+(1-\lambda_n)y $$ where $$ \lambda_n=\frac{x_n-y}{x-y}\to 1, $$ as $n\to\infty$ and thus $$ f(x_n)\leq \lambda_nf(x)+(1-\lambda_n)f(y). $$ since $x_n\to x$ and thus $$ \limsup_{n\to\infty} f(x_n)\leq \lim_{n\to\infty} \left(\lambda_nf(x)+(1-\lambda_n)f(y)\right)=f(x).\tag{1} $$ Similarly, one can get $$ \liminf_{n\to\infty} f(x_n)\geq f(x) \tag{2} $$ by considering a sequence $(x_n)$ such that $x_n\to x$ and $a<x_n<x<z<b$. Note that we can write $$ x=\mu_nx_n+(1-\mu_n)z $$ where $$ \mu_n=\frac{x-z}{x_n-z}. $$ Hence $$ f(x)\leq \mu_nf(x_n)+(1-\mu_n)f(z), $$ which implies that $$ \mu_n^{-1}f(x)\leq f(x_n)+(1-\mu_n)\mu_n^{-1}f(z). $$ Taking $\liminf$ on both sides, we get (2).

Combining (1) and (2), we have $$ \lim_{n\to \infty}f(x_n)=f(x) $$ and hence $f$ is continuous at $x\in (a,b)$.

share|cite|improve this answer

You can do a proof by contradiction.

Assume $f\in\mathbb{R}^\mathbb{R}$ is convex, but not continuous at some $x_0\in(a,b)$. This means that: $$ \exists_{\epsilon>0}\forall_{\delta>0}\exists_{x\in(x_0-\delta,x_0+\delta)} : |f(x)-f(x_0)|\ge\epsilon$$ This formula implies that once we fix $\delta$, $f$'s graph has infinitely many points in one of the areas: I, II, III or IV, with $x_0$ as an accumulation point of their $x$ coordinates:

enter image description here

We split our proof into 2 cases:

$(1)$ The area is either I or II. In this case we select some point on the function's graph from that area: $(x_1,f(x_1))$, and draw a line segment from that point to $(x_0,f(x_0))$. We then select another point on the graph from the same area: $(x_2,f(x_2))$, whose $x$ coordinate is closer to $x_0$ than the intersection of our line segment and $y=f(x_0)+\epsilon$ . This contradicts the convexity of $f$, as can be seen in the following image: enter image description here

$(2)$ The area is either III or IV. Assume, without loss of generality, that the area is III. In this case we select some point on the function's graph to the right of $x_0$, say: $(x_1,f(x_1))$. We then draw a ray, which starts at $(x_1,f(x_1))$, and goes through $(x_0,f(x_0))$. We use $x'$ to denote the $x$ coordinate of the intersection of our ray and $y=f(x_0)-\epsilon$. If they do not intersect, we set: $x'=-\infty$. Next, we select another point: $(x_2, f(x_2))$ on $f$'s graph, in area III, with $x'<x_2<x_0$. Finally, we draw a segment between $(x_2, f(x_2))$ and $(x_1, f(x_1))$. This again contradicts convexity, as can be seen in the following image: enter image description here

share|cite|improve this answer

The best alternative proof (in my humble opinion) is a function is convex if and only if its epigraph is a convex set. If a function is NOT continuous then the epigraph can't be convex (obviously... draw a picture); but then by the above, the function can't be convex. This proof used the contrapositive.

share|cite|improve this answer
Consider the extended-valued function from my above comments: $f(x)=+\infty$ if $x<0$, $f(x)=1$ if $x=0$, and $f(x)=-\sqrt{x}$ if $x>0$. The epigraph of this function is a convex set. But $f$ is not continuous! And its epigraph is not a closed set. – Michael Grant Aug 15 '14 at 19:38
Real valued function $\neq$ extended real value function (the former is the setting setting of the question and my answer, the latter is your setting). In any case, your epigraph isn't even convex,... for example you can't realize it as the intersection of epigraphs of real valued functions. If you could, then I'd believe it was convex because the intersection of arbitrary number of convex sets is convex... but your set is definitely not convex – Squirtle Aug 15 '14 at 19:51
Oh, my epigraph is convex all right. It's not closed, but it's convex. Try and prove otherwise: give me two points in the set for whom the secant lies outside of the set. The closure of the set adds the $(x,y)\in[0,0]\times[0,1)$. (Asking me to prove it is the intersection of epigraphs of real valued functions is a circular argument. Besides, the unit disc in $\mathbb{R}^2$ cannot be described as the intersection of epigraphs of convex functions, either. – Michael Grant Aug 15 '14 at 20:07
As for real valued $\neq$ extended real valued: extended real valued functions are simply a short-hand way of expressing real-valued functions that are not defined on the entire real line (or $\mathbb{R}^n$, etc., as appropriate). For instance, consider the classic logarithmic barrier $f(x)=-\log x$, defined on $(0,+\infty)$. Is that not a real-valued function? – Michael Grant Aug 15 '14 at 20:09
Ah! You're right. It is a convex set, because the epigraph to the right of $x=0$ is clearly convex and so now we just have to show that the union of this epigraph with the epigraph when $x\le 0$ is also convex. But epi($f(x):x<0)=\{(x,t):t>f(x)\}=\{(x,t):t>\infty \} = \emptyset$ which makes the desired result vacuously true. The only problem with this example is that we want a function to convex if and only if its epigraph is convex (and we can normally prove this). – Squirtle Aug 16 '14 at 4:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.