# Proof every convex function is continuous (Problem 10 Convex Functions Spivak)

I am working on exercise 10 of the appendix between chapters 11 and 12 of Spivak's Calculus. The problem is to show that a convex function must be continuous. I would like to check my proof as it is different from the ones I have found so far.

Let $f$ be a function that is convex in $(a,b)$. Let us assume that $f$ is not continuous in the point $a$.

By the definition of convexity, we have: $\dfrac{f(x)-f(a)}{x-a}<\dfrac{f(b)-f(a)}{b-a}$

To remove the inequality let $\dfrac{f(x)-f(a)}{x-a} +h(x) = \dfrac{f(b)-f(a)}{b-a} ~(1)$, where $h(b)=0$ and $h(a)=\dfrac{f(b)-f(a)}{b-a}$

Now let's rearrange equation 1: $f(x)-f(a) = (x-a)\left(\dfrac{f(b)-f(a)}{b-a} - h(x)\right)$

Taking $lim_{x\to a^+}$ on both sides:

$lim_{x\to a^+} (f(x)-f(a)) = lim_{x\to a^+} (x-a)\left(\dfrac{f(b)-f(a)}{b-a} - h(x)\right)= 0$

So $~lim_{x\to a^+} f(x)= f(a)$

Thus $f(x)$ is right continuous on $a$

I can use a similar argument to prove that $f(x)$ is left continuous on $b$

Since $f$ is convex in $(a,b)$, it is also convex in $(a+h,b)$ with $h< b-a$. And by letting $h \to b-a$, I prove right continuity over the whole interval.

Similarly, as $f$ in convex in $(a,b)$, it is also convex in $(a,b-k)$ with $k > b-a$. And by letting $k \to b-a$, the whole interval is left continuous.

As any $x_0 \in (a,b)$ can be uniquely expressed as $x_0= a+h = b-k$ and $f$ is right continuous for $a+h$ and left continuous for $b-k$ then $f$ is continuous in $x_0 \in (a,b)$

While writing the question, I have cleaned the logic from what I had initially drafted, so I am more confident about it. Still I am not sure if this logic is correct, as it is longer than any other answer I have found.

• The proof falls apart at the start. First, you define $h(x) = \frac{f(b) - f(a)}{b-a} - \frac{f(x) - f(a)}{x-a}.$ Then you make a circular argument using $\lim_{x \to a+}(x-a)h(x) = 0$ in proving that $\lim_{x \to a+} (f(x) - f(a))= 0$. – RRL Feb 22 '18 at 20:21
• @RRL I knew something was not right. I began with the assumption that $f(x)\neq f(a)$ so that $h(x)$ is not necessarily defined on $a$. Is the argument circular because $(x-a)*h(x)$ is zero in $a$ regardless of how $h(x)$ is defined? – Amphiaraos Feb 23 '18 at 23:09
• It's circular because $(x-a)h(x) = f(a) - f(x) - (x-a)C$ where $C$ is a constant. You are trying to show that $\lim_{x \to a+} f(x) = f(a)$. You say this follows because $\lim_{x \to a+} (x-a)h(x) = 0$ on the RHS of the equation that follows "Taking $\lim_{x \to a+}$ on both sides ...". So you are using what you are trying to prove. You have not established anything about $h(x)$ yet. – RRL Feb 23 '18 at 23:46
• A convex $f:[0,1]\to \Bbb R$ can be discontinuous. E.g. $f(x)=0$ for $x\in [0,1)$ and $f(1)=1$. So you can't separately show that $f$ is left & right continuous. You have to use the fact that the domain of $f$ is open. – DanielWainfleet Feb 24 '18 at 2:41

If $f$ is convex on $(a,b)$ then it is relatively easy to show that it is bounded on any closed subinterval.

Let $x$ and $y$ be arbitrary points in $(a,b)$. Assume WLOG $x < y$ and choose $\delta > 0$ such that $a < a+ \delta \leqslant x < y \leqslant b- \delta < b$. Since $f$ is bounded on the closed interval $[a+\delta,b- \delta]$ there exist bounds $m$ and $M$ such that $m \leqslant f(z) \leqslant M$ for all $z$ in the interval.

Defining $z = y + \delta$ and $\lambda = \frac{y-x}{y-x + \delta},$ we have $0 < \lambda < 1$ and $y = \lambda z + (1-\lambda)x$. By convexity

$$f(y) \leqslant \lambda f(z) + (1-\lambda)f(x) = f(x) + \lambda(f(z) - f(x)).$$

Hence,

$$f(y) - f(x) \leqslant \lambda(f(z) - f(x)) \leqslant \lambda (M - m) = \frac{y-x}{y-x+\delta} (M-m) \leqslant \frac{M-m}{\delta}|y-x|.$$

Switching variable names $x$ and $y$ we get

$$-[f(y) - f(x)] = f(x) - f(y) \leqslant \frac{M-m}{\delta}|x- y| = \frac{M-m}{\delta}|y- x|,$$

and this implies

$$|f(y) - f(x)| \leqslant \frac{M-m}{\delta} |y-x|.$$

Therefore, $f$ is continuous on $(a,b)$ as well as Lipschitz continuous on any closed subinterval.

• Can you please specify more on why $f$ is continuous on $(a,b)$..? – Moreblue Nov 10 '18 at 18:10
• @Moreblue: Sure. Take a fixed $y \in (a,b)$. All $x$ sufficiently close to $y$ lie in some compact interval $[a+\delta,b-\delta]$ where $|f(x) -f(y)| < \frac{M-m}{\delta}|x-y|$ as shown. The parameters $M$,$m$ and $\delta$ are now fixed for all $x$ in the compact interval. If also $|x-y| < \frac{\epsilon \delta}{M-m}$ then $|f(x) - f(y)| < \epsilon$. So $f$ is continuous at each point $y \in (a,b)$. – RRL Nov 10 '18 at 20:09