Proving that the second derivative of a convex function is nonnegative

Given $f$ is a continuous and using the results from this answer, $f$ can be proven to satisfy: $f(\lambda x_1 + (1-\lambda)x_2) \leq \lambda f(x_1) + (1-\lambda)f(x_2)\ \forall \ \lambda \in [0,1]$

Now, by using Taylor's expansion, $f''(x)$ can be written as: $$ f''(x) = \lim_{h \rightarrow 0} \frac{f(x+h)+f(x-h)-2f(x)}{h^2} $$

$f(\frac{1}{2}(x+h) + \frac{1}{2}(x-h)) \leq \frac{1}{2}f(x+h) + \frac{1}{2}f(x-h) \implies 2f(x) \leq f(x+h)+f(x-h)$ or $f(x+h)+f(x-h)-2f(x) \geq 0$.

Since $h^2 \geq 0$ and $f$ being twice differentiable, $f''(x) \geq 0$ follows.


Here's how I ended up solving it. I made reference to this answer for the general principle, and this answer for the part about proving slopes of lines.

Let $m = \frac{a+b}{2}$. Suppose we draw a line (on a two-dimensional Cartesian grid) from $(a,f(a))$ to $(b,f(b))$. Then the point $(m,f(m))$ lies on or below this line because $f$ is midpoint convex: the height of the line at $m$ is given $\frac{f(a)+f(b)}{2}$, which is $ \geq f(m)$ by definition.

Since $(m,f(m))$ lies on or below this line, it follows that the slope of the line from $(a,f(a))$ to $(m,f(m))$ is less than or equal to the slope of the line from $(m,f(m))$ to $(b,f(b))$. We briefly show this:

We want to show that $\frac{f(b)-f(m)}{b-m} \geq \frac{f(m)-f(a)}{m-a}$. Remark that $b-m = \frac{b-a}{2} = m - a$, so the inequality simplifies to $f(b)-f(m) \geq f(m)-f(a)$, which is true since $f(m) \leq \frac{f(m)+f(a)}{2}$.

Having shown that the slope of $((a,f(a)),(m,(f(m))$ is less than or equal to the slope of $((m,f(m)),(b,(f(b))$, we apply the MVT to both of these two lines: $$\exists c \in (a,m) \text{ s.t. } \frac{f(m)-f(a)}{m-a} = f'(c)$$ $$\exists d \in (m,b) \text{ s.t. } \frac{f(b)-f(m)}{b-m} = f'(d)$$ And knowing that the slope of the line joining $((a,f(a)),(m,f(m)))$ is less than or equal to that of the slope of the line joining $((m,f(m)),(b,f(b)))$, we have that $f'(c) \leq f'(d)$. We then apply the MVT once more:

$$\exists z \in (c,d) \text{ s.t. } \frac{f'(d)-f'(c)}{d-c} = f''(z)$$

So $f'(d)-f'(c) = f''(z)(d-c)$. We know that $f'(d) \geq f'(c)$, so $f'(d)-f'(c) \geq 0$. We also know that $d-c > 0$ because $c \in (a,m)$ and $d \in (m,b)$, where $a < b$. So our statement reduces to this inequality: $$f''(z) \geq 0$$ As desired.


I would set up a proof by contradiction. Assuming a single point where $f''(x) < 0$, you can use the continuity of $f''(x)$ to find an interval $[a,b]$, where $f''(x) < 0$ throughout. The intuition is then clear, in the sense that if you draw a concave down segment, then any secant line lies below your curve. I will leave it to you to fill in the details from there.