We will compute the derivative and show that it is always
g
′
(
x
)
≥
0
{\displaystyle g'(x)\geq 0}
. The derivative of
g
(
x
)
{\displaystyle g(x)}
is given by the quotient rule to be
g
′
(
x
)
=
x
f
′
(
x
)
−
f
(
x
)
x
2
{\displaystyle g'(x)={\frac {xf'(x)-f(x)}{x^{2}}}}
The denominator is clearly always positive as we know it is the square of some real number
x
>
0
{\displaystyle x>0}
, so in order to show that the entire derivative is always positive we need to show that the numerator is positive.
However,
f
(
x
)
x
≤
f
′
(
x
)
⇔
x
f
′
(
x
)
−
f
(
x
)
≥
0
{\displaystyle {\frac {f(x)}{x}}\leq f'(x)\Leftrightarrow xf'(x)-f(x)\geq 0}
and we know that, by the mean value theorem there is some
c
∈
(
0
,
x
)
{\displaystyle c\in (0,x)}
such that
f
(
x
)
x
=
f
′
(
x
)
{\displaystyle {\frac {f(x)}{x}}=f'(x)}
since
f
(
0
)
=
0
{\displaystyle f(0)=0}
. Since
f
{\displaystyle f}
is monotonically increasing it must be that
f
′
(
x
)
≥
f
(
x
)
x
{\displaystyle f'(x)\geq {\frac {f(x)}{x}}}
.
Thus,
x
f
′
(
x
)
−
f
(
x
)
≥
0
{\displaystyle xf'(x)-f(x)\geq 0}
and so the derivative of
g
{\displaystyle g}
is positive, which implies that
g
{\displaystyle g}
is monotonically increasing.
Since the denominator of
lim
h
→
0
f
(
x
+
h
)
+
f
(
x
−
h
)
−
2
f
(
x
)
h
2
{\displaystyle \lim _{h\to 0}{\frac {f(x+h)+f(x-h)-2f(x)}{h^{2}}}}
goes to zero as
h
→
0
{\displaystyle h\to 0}
we can employ L'Hopital's rule. Using this we get
lim
h
→
0
f
(
x
+
h
)
+
f
(
x
−
h
)
−
2
f
(
x
)
h
2
=
lim
h
→
0
f
′
(
x
+
h
)
−
f
′
(
x
−
h
)
2
h
{\displaystyle \lim _{h\to 0}{\frac {f(x+h)+f(x-h)-2f(x)}{h^{2}}}=\lim _{h\to 0}{\frac {f'(x+h)-f'(x-h)}{2h}}}
Since the denominator is again zero we apply L'Hopital's rule again
=
lim
h
→
0
f
″
(
x
+
h
)
+
f
″
(
x
−
h
)
2
{\displaystyle =\lim _{h\to 0}{\frac {f''(x+h)+f''(x-h)}{2}}}
=
f
″
(
x
)
{\displaystyle =f''(x)}
An example of a function that is not differentiable, but where this limit exists is
f
(
x
)
=
{
0
x
≤
0
x
2
x
>
0
{\displaystyle f(x)=\left\{{\begin{array}{lr}0&x\leq 0\\x^{2}&x>0\end{array}}\right.}
The second derivative of this function does not exist at zero, as
f
′
(
x
)
=
{
0
x
≤
0
2
x
x
>
0
{\displaystyle f'(x)=\left\{{\begin{array}{lr}0&x\leq 0\\2x&x>0\end{array}}\right.}
however we can compute the above limit at zero by
lim
h
→
0
f
(
x
+
h
)
+
f
(
x
−
h
)
−
2
f
(
x
)
h
2
=
lim
h
→
0
h
2
h
2
=
1
{\displaystyle \lim _{h\to 0}{\frac {f(x+h)+f(x-h)-2f(x)}{h^{2}}}=\lim _{h\to 0}{\frac {h^{2}}{h^{2}}}=1}
A function
f
{\displaystyle f}
is said to be convex if
f
(
λ
+
(
1
−
λ
)
y
)
≤
λ
f
(
x
)
+
(
1
−
λ
)
f
(
y
)
{\displaystyle f(\lambda +(1-\lambda )y)\leq \lambda f(x)+(1-\lambda )f(y)}
First we shall prove (
⇒
{\displaystyle \Rightarrow }
) that
f
′
{\displaystyle f'}
monotonically increasing implies
f
{\displaystyle f}
is convex.
Assume
f
′
{\displaystyle f'}
is monotonically increasing. Let
x
<
y
<
z
{\displaystyle x<y<z}
for
x
,
y
,
z
∈
(
a
,
b
)
{\displaystyle x,y,z\in (a,b)}
. The mean value theorem implies that
∃
c
∈
(
x
,
y
)
{\displaystyle \exists c\in (x,y)}
such that
f
′
(
c
)
=
f
(
y
)
−
f
(
x
)
y
−
x
{\displaystyle f'(c)={\frac {f(y)-f(x)}{y-x}}}
. Similarly
∃
d
∈
(
y
,
z
)
{\displaystyle \exists d\in (y,z)}
such that
f
′
(
d
)
=
f
(
z
)
−
f
(
y
)
z
−
y
{\displaystyle f'(d)={\frac {f(z)-f(y)}{z-y}}}
. Thus, since
f
′
{\displaystyle f'}
is assumed to be monotonically increasing we have
f
′
(
c
)
≤
f
′
(
d
)
⇒
f
(
y
)
−
f
(
x
)
y
−
x
≤
f
(
z
)
−
f
(
y
)
z
−
y
{\displaystyle f'(c)\leq f'(d)\Rightarrow {\frac {f(y)-f(x)}{y-x}}\leq {\frac {f(z)-f(y)}{z-y}}}
Because
y
∈
(
x
,
z
)
{\displaystyle y\in (x,z)}
we know that
y
=
λ
x
+
(
1
−
λ
)
z
{\displaystyle y=\lambda x+(1-\lambda )z}
for some
λ
∈
(
0
,
1
)
{\displaystyle \lambda \in (0,1)}
. Moreover, we have
f
(
y
)
−
f
(
x
)
y
−
x
≤
f
(
z
)
−
f
(
y
)
z
−
y
{\displaystyle {\frac {f(y)-f(x)}{y-x}}\leq {\frac {f(z)-f(y)}{z-y}}}
⇒
f
(
λ
x
+
(
1
−
λ
)
z
)
−
f
(
x
)
λ
x
+
(
1
−
λ
)
z
−
x
≤
f
(
z
)
−
f
(
λ
x
+
(
1
−
λ
)
z
)
z
−
λ
x
−
(
1
−
λ
)
z
{\displaystyle \Rightarrow {\frac {f(\lambda x+(1-\lambda )z)-f(x)}{\lambda x+(1-\lambda )z-x}}\leq {\frac {f(z)-f(\lambda x+(1-\lambda )z)}{z-\lambda x-(1-\lambda )z}}}
⇒
f
(
λ
x
+
z
−
z
λ
)
−
f
(
x
)
λ
x
+
z
−
λ
z
−
x
≤
f
(
z
)
−
f
(
λ
x
+
z
−
λ
z
)
z
−
λ
x
−
z
+
λ
z
{\displaystyle \Rightarrow {\frac {f(\lambda x+z-z\lambda )-f(x)}{\lambda x+z-\lambda z-x}}\leq {\frac {f(z)-f(\lambda x+z-\lambda z)}{z-\lambda x-z+\lambda z}}}
⇒
f
(
λ
x
+
z
−
z
λ
)
−
f
(
x
)
λ
x
+
z
−
λ
z
−
x
≤
f
(
z
)
−
f
(
λ
x
+
z
−
λ
z
)
−
λ
x
+
λ
z
{\displaystyle \Rightarrow {\frac {f(\lambda x+z-z\lambda )-f(x)}{\lambda x+z-\lambda z-x}}\leq {\frac {f(z)-f(\lambda x+z-\lambda z)}{-\lambda x+\lambda z}}}
⇒
λ
(
z
−
x
)
(
f
(
λ
x
+
z
−
z
λ
)
−
f
(
x
)
)
≤
(
f
(
z
)
−
f
(
λ
x
+
z
−
λ
z
)
)
(
1
−
λ
)
(
z
−
x
)
{\displaystyle \Rightarrow \lambda (z-x)\left(f(\lambda x+z-z\lambda )-f(x)\right)\leq \left(f(z)-f(\lambda x+z-\lambda z)\right)\left(1-\lambda \right)\left(z-x\right)}
We note here that the direction of the inequality is preserved since we have
x
<
z
{\displaystyle x<z}
and
λ
>
0
{\displaystyle \lambda >0}
and
1
−
λ
>
0
{\displaystyle 1-\lambda >0}
(*)
⇒
λ
(
f
(
λ
x
+
z
−
z
λ
)
−
f
(
x
)
)
≤
(
f
(
z
)
−
f
(
λ
x
+
z
−
λ
z
)
)
(
1
−
λ
)
{\displaystyle \Rightarrow \lambda \left(f(\lambda x+z-z\lambda )-f(x)\right)\leq \left(f(z)-f(\lambda x+z-\lambda z)\right)\left(1-\lambda \right)}
⇒
λ
(
f
(
λ
x
+
z
(
1
−
λ
)
)
−
f
(
x
)
)
≤
(
f
(
z
)
−
f
(
λ
x
+
z
(
1
−
λ
)
)
)
(
1
−
λ
)
{\displaystyle \Rightarrow \lambda \left(f(\lambda x+z(1-\lambda ))-f(x)\right)\leq \left(f(z)-f(\lambda x+z(1-\lambda ))\right)\left(1-\lambda \right)}
⇒
λ
f
(
λ
x
+
z
(
1
−
λ
)
)
−
λ
f
(
x
)
≤
f
(
z
)
−
f
(
λ
x
+
z
(
1
−
λ
)
)
−
λ
f
(
z
)
+
λ
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \Rightarrow \lambda f(\lambda x+z(1-\lambda ))-\lambda f(x)\leq f(z)-f(\lambda x+z(1-\lambda ))-\lambda f(z)+\lambda f(\lambda x+z(1-\lambda ))}
reducing yields
−
λ
f
(
x
)
≤
f
(
z
)
−
f
(
λ
x
+
z
(
1
−
λ
)
)
−
λ
f
(
z
)
{\displaystyle -\lambda f(x)\leq f(z)-f(\lambda x+z(1-\lambda ))-\lambda f(z)}
⇒
−
λ
f
(
x
)
−
f
(
z
)
+
λ
f
(
z
)
≤
−
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \Rightarrow -\lambda f(x)-f(z)+\lambda f(z)\leq -f(\lambda x+z(1-\lambda ))}
⇒
λ
f
(
x
)
+
f
(
z
)
−
λ
f
(
z
)
≥
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \Rightarrow \lambda f(x)+f(z)-\lambda f(z)\geq f(\lambda x+z(1-\lambda ))}
⇒
λ
f
(
x
)
+
f
(
z
)
(
1
−
λ
)
≥
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \Rightarrow \lambda f(x)+f(z)(1-\lambda )\geq f(\lambda x+z(1-\lambda ))}
but since the initial choice of
x
,
y
,
z
{\displaystyle x,y,z}
was arbitrary (up to ordering) this holds for any
x
<
z
{\displaystyle x<z}
. We must still address the case corresponding to
x
>
z
{\displaystyle x>z}
. This is easy though.
For let
x
>
z
{\displaystyle x>z}
. Then by what we have proven already
λ
f
(
z
)
+
f
(
x
)
(
1
−
λ
)
≥
f
(
λ
z
+
x
(
1
−
λ
)
)
{\displaystyle \lambda f(z)+f(x)(1-\lambda )\geq f(\lambda z+x(1-\lambda ))}
now let
α
=
1
−
λ
{\displaystyle \alpha =1-\lambda }
so it follows from the above that
(
1
−
α
)
f
(
z
)
+
f
(
x
)
(
1
−
1
+
α
)
≥
f
(
(
1
−
α
)
z
+
x
(
1
−
1
+
α
)
)
{\displaystyle (1-\alpha )f(z)+f(x)(1-1+\alpha )\geq f((1-\alpha )z+x(1-1+\alpha ))}
⇒
(
1
−
α
)
f
(
z
)
+
α
f
(
x
)
≥
f
(
(
1
−
α
)
z
+
α
x
)
{\displaystyle \Rightarrow (1-\alpha )f(z)+\alpha f(x)\geq f((1-\alpha )z+\alpha x)}
Thus if
f
′
{\displaystyle f'}
is monotonically increasing
λ
f
(
x
)
+
f
(
z
)
(
1
−
λ
)
≥
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \lambda f(x)+f(z)(1-\lambda )\geq f(\lambda x+z(1-\lambda ))}
for
∀
x
,
y
∈
(
a
,
b
)
{\displaystyle \forall x,y\in (a,b)}
,
λ
∈
(
0
,
1
)
{\displaystyle \lambda \in (0,1)}
Now we prove (
⇐
{\displaystyle \Leftarrow }
) that
f
{\displaystyle f}
convex implies
f
′
{\displaystyle f'}
is monotonically increasing.
The proof of this direction follows similarly to the previous. Let's assume
f
{\displaystyle f}
is convex.
Then
λ
f
(
x
)
+
f
(
z
)
(
1
−
λ
)
≥
f
(
λ
x
+
z
(
1
−
λ
)
)
{\displaystyle \lambda f(x)+f(z)(1-\lambda )\geq f(\lambda x+z(1-\lambda ))}
for
x
<
z
{\displaystyle x<z}
(Note: we must have
x
<
z
{\displaystyle x<z}
by (*)) and
x
,
z
∈
(
a
,
b
)
{\displaystyle x,z\in (a,b)}
,
λ
∈
(
0
,
1
)
{\displaystyle \lambda \in (0,1)}
. Following the previous reasoning in reverse we see that
f
(
y
)
−
f
(
x
)
y
−
x
≤
f
(
z
)
−
f
(
y
)
z
−
y
{\displaystyle {\frac {f(y)-f(x)}{y-x}}\leq {\frac {f(z)-f(y)}{z-y}}}
for
∀
y
∈
(
x
,
z
)
{\displaystyle \forall y\in (x,z)}
.
So in the limit
y
→
x
{\displaystyle y\to x}
we have
f
′
(
x
)
≤
f
(
z
)
−
f
(
x
)
z
−
x
{\displaystyle f'(x)\leq {\frac {f(z)-f(x)}{z-x}}}
and in the limit
y
→
z
{\displaystyle y\to z}
we have
f
(
z
)
−
f
(
x
)
z
−
x
≤
f
′
(
z
)
{\displaystyle {\frac {f(z)-f(x)}{z-x}}\leq f'(z)}
thus, combining these statements we have
f
′
(
x
)
≤
f
(
z
)
−
f
(
x
)
z
−
x
≤
f
′
(
z
)
{\displaystyle f'(x)\leq {\frac {f(z)-f(x)}{z-x}}\leq f'(z)}
so
f
′
{\displaystyle f'}
is monotonically increasing as desired.
Now it only remains to prove that (assuming
f
″
(
x
)
{\displaystyle f''(x)}
exists for
x
∈
(
a
,
b
)
{\displaystyle x\in (a,b)}
)
f
{\displaystyle f}
is convex if and only if
f
″
(
x
)
≥
0
{\displaystyle f''(x)\geq 0}
for
∀
x
∈
(
a
,
b
)
{\displaystyle \forall x\in (a,b)}
.
f
{\displaystyle f}
is convex
⇔
{\displaystyle \Leftrightarrow }
f
′
{\displaystyle f'}
is monotonically increasing by the previous proof. Moreover,
f
′
{\displaystyle f'}
is monotonically increasing
⇔
{\displaystyle \Leftrightarrow }
f
″
≥
0
{\displaystyle f''\geq 0}
(proved in class).
So we have shown that (assuming
f
″
(
x
)
{\displaystyle f''(x)}
exists for
x
∈
(
a
,
b
)
{\displaystyle x\in (a,b)}
)
f
{\displaystyle f}
is convex if and only if
f
″
(
x
)
≥
0
{\displaystyle f''(x)\geq 0}
for
∀
x
∈
(
a
,
b
)
{\displaystyle \forall x\in (a,b)}
as desired.