Convex functions - two questions I have two questions regarding convex functions:

First question: Let f be convex function on closed interval [a,b].
Prove that f has maximum in x=a or x=b.

I understand that $\forall x\in[a,b]: \ \ f''(x)>0$, thus $f'(x)$ is monotonically increasing and the slope of the tangent is increasing. Is there any way to continue from here? I also tried to use the definition of convex function, but it didn't help...

Second question: Let $f:(0,\infty)\to\mathbb{R}$ be convex function and $\lim_{x\to0^{+}}f(x)=0$.
Prove that $g(x)=\frac{f(x)}{x}$ is monotonically increasing in $(o,\infty)$.


Eventually, I solved the second question. Still looking for help with the first one.

Please help, thank you!
 A: Main idea:
Suppose that $f$ attains its maximum at some $x_0\in(a,b)$. The main idea is that the point $[x_0,f(x_0)]\in\text{graph}(f)$ lies under the line segment connecting $[a,f(a)]$ and $[b,f(b)]$ (or, in the worst case, on this line segment). One can easily see that this can happen only in the case of $f(a)=f(x)=f(b)$.
A: Suppose that neither $a$ nor $b$ is a local maximum. Then, there exist $x,y\in(a,b)$ (not necessarily different) such that $f(x)>f(a)$ and $f(y)>f(b)$. This is easily shown to imply that $\max\{f(x),f(y)\}>\max\{f(a),f(b)\}$. Now, since $x,y\in(a,b)$, there exist $\lambda,\mu\in(0,1)$ such that $x=\lambda a+(1-\lambda)b$ and $y=\mu a+(1-\mu)b$. The convexity of $f$ implies that
\begin{align*}
f(x)\leq&\,\lambda f(a)+(1-\lambda)f(b)\leq\lambda\max\{f(a),f(b)\}+(1-\lambda)\max\{f(a),f(b)\}=\max\{f(a),f(b)\},\\
f(y)\leq&\,\mu f(a)+(1-\mu)f(b)\leq\max\{f(a),f(b)\}.
\end{align*}
This, in turn, implies that $\max\{f(x),f(y)\}\leq\max\{f(a),f(b)\}$, which contradicts our earlier result.
A: If you define local maximum by having a neighbourhood around a or b where the function values are strictly lower than f(a) resp. f(b) then your edited question also makes no sense.
A: $f$ is convex then the graph of $f$ is below its chord between $a$ and $b$ :
$$\forall x \in [a, b], f(x) \leq f(a) + \dfrac{f(b) - f(a)}{b - a} (x - a)$$

*

* If $f(b) \geq f(a)$ then :
$$\dfrac{f(b) - f(a)}{b - a} \geq 0$$
so :
$$\forall x \in [a, b], f(x) \leq f(a) + \dfrac{f(b) - f(a)}{b - a} (x - a) \leq f(a) + \dfrac{f(b) - f(a)}{b - a} (b - a) = f(a) + f(b) - f(a) = f(b)$$
$f$ has a maximum in $b$.

* If $f(b) \leq f(a)$ then :
$$\dfrac{f(b) - f(a)}{b - a} \leq 0$$
so :
$$\forall x \in [a, b], f(x) \leq f(a) + \dfrac{f(b) - f(a)}{b - a} (x - a) \leq f(a)$$
$f$ has a global maximum in $a$.

