I'm trying to solve one of the questions from An Introduction to Functional Analysis by James C. Robinson:
Show that if $f : [a, b] \to \mathbb{R}$ is $C^2$ on $(a, b)$ and $f$ is $C^1$ on $[a, b]$, then $f$ is convex on $[a, b]$ if $f''(x) \geq 0$.
Showing that $f$ is convex would mean that for every $x, y \in [a, b]$ and $\lambda \in [0, 1]$, \begin{equation*} f(\lambda x + (1 - \lambda)y) \leq \lambda f(x) + (1 - \lambda) f(y) \end{equation*}
The way I try to go around this is by using the Mean Value Theorem.
Attempted Proof: Assume that $f$ is $C^1$ on $[a, b]$, i.e. it is continuous on $[a, b]$ and differentiable on $[a, b]$. Then by the Mean Value Theorem, there exists $x \in [a, b]$ such that \begin{equation*} f'(x) = \frac{f(b) - f(a)}{b - a} \end{equation*} Also, because $f$ is $C^2$ on $(a, b)$, and $f'(a)$ and $f'(b)$ exist, then by the Mean Value Theorem also, there exists a $y \in (a, b)$ such that \begin{equation*} f''(y) = \frac{f'(b) - f'(a)}{b - a} \end{equation*} From here, assume that $f''(y) \geq 0$, then we know that $f'(b) \geq f'(a) \geq 0$ for every $a < b$, so then $f'(x) \geq 0$ for every $x \in [a, b]$ and thus, $f(b) \geq f(a)$ for every $a < b$ (???)
I am not sure if this is the correct approach, or if it isn't what could I apply at this point.