We call the convexity of a function \(f\) its general shape, rather bowl-shaped (convex) or rather cellar-shaped (concave).
We define it more precisely according to the position of its tangents and the chords of the function.
Let \(f\) be a function of class \( \mathbb{C}^{2}\) on its definition set \( D_f \) and any interval \(I\).
The sign of the second derivative indicates convexity
Just as the derivative indicates the direction of variation of a function, the sign of the second derivative indicates convexity.
And,
$$ f''(x) \ changes \ sign \ before \ and \ after \ (x=a) \Longleftrightarrow f \ admits \ an \ inflection \ point \ at \ (x=a) $$
A function \( f \) is said to be convex on an interval \( I \), if any tangent at a point lies below the curve. A contrario, it is concave if any tangent is located above the curve.
A function \( f \) is said to be convex on an interval \( I \), if any rope which connects two points of this interval lies above the curve. A contrario, it is concave if any rope is located below the curve.
Let \(f\) be a function of class \( \mathbb{C}^{2}\) on its definition set and its tangent at a fixed point \(a\).
Let us seek to determine hte position of its tangent according to the nature of \(f\).
Let be two mobile points \(M(x;\ f(x))\) and \(M_T(x; \ T_a(x))\) depending on \(x\), respective images of \(f\) and the one of \(T_a\) at point \(x\).
The tangent equation \(T_a\) is worth:
So, point \(M_T\) will have the coordinates:
Let us now consider a new function \(g\), being worth the difference between \(f\) and \(T_a\):
To determine which of the two is above the other one, we must study the sign of \(g\) at the neighborhood of \((x=a)\), value for which the function g vanishes.
Function \(f\) being derivable twice by hypothesis and \(T_a\) being of class \( \mathbb{C}^{\infty}\), function \(g\) is also derivable twice, and:
$$ \Biggl \{ \begin{align*} g'(x) = f'(x) - f'(a) \qquad(g') \\ g''(x) = f''(x) \hspace{5.2em}(g'') \end{align*} $$
With \((g)\), \((g')\) and \((g''')\), we then have:
$$ (1) \ \Biggl \{ \begin{align*} g(a) = 0 \\ g'(a) = 0 \\ g''(a) = 0 \ \Longleftrightarrow \ f''(a) = 0 \end{align*} $$
Let us assume that it is possible to find a positive number \(\eta\) such as:
Which means that \(f''\) is supposed to be positive for the values to the left and right of \(a\). Except for \(x=a\), as clearly indicated \((S_+)\) because there may be cases where \(f''(a)\) will be infinite or even not defined at all.
This assumption made, we see with \((g'')\) that, this also entails \(g'' > 0\) to the left and right of \(a\) with \(g''(a) = 0\).
Then the derivative \(g'\) will be increasing to the left and right of \(a\), with \(g'(a) = 0\).
We will then have to the left and right of \(a\):
$$ \Biggl \{ \begin{align*} \Bigl[ \ x < a \ \Longleftrightarrow \ g'(x) < 0 \ \Bigr] \ \Longleftrightarrow \ g \ decreasing \ for \ (x < a) \\ \Bigl[ \ x > a \ \Longleftrightarrow \ g'(x) > 0 \ \Bigr] \ \Longleftrightarrow \ g \ increasing \ for \ (x > a) \end{align*} $$
Which leads to \(g\) is decreasing on the left and increasing on the right of \(a\).
But \( g(a) = 0\), so \(g > 0\) left and right in the vicinity of \(a\).
We can conclude that for any interval \(I \):
$$ \forall x \in I, \ f''(x) \geqslant 0 \ \Longleftrightarrow f \ convex \ on \ I $$
It is possible to make the same demonstration by making the opposite supposition of \((S_+)\), namely:
So in this case \(g\) will be increasing to the left and decreasing to the right of \(a\), and we will have in the same way \(g < 0\) left and right in the vicinity of \(a\).
$$ \forall x \in I, \ f''(x) \leqslant 0 \ \Longleftrightarrow f \ concave \ on \ I $$
In the case where \( f''\) would have a different sign to the right and left of \(a\), there are then two cases.
Let us assume a first case, namely that \( f'' < 0\) to the left and \( f'' > 0\) on the right of \(a\). Then,
\(g'\) will be decreasing on the left then increasing on the right, which results in \(g'(x) > 0\).
So \(g\) will always be increasing and as \(g(a) = 0\), we will have \(g < 0\) to the left and \(g > 0\) on the right of \(a\).
We will then have an inflection point at point \(a\); which means \(f\) will change convexity.
$$f''(x) \ changes \ sign \ before \ and \ after \ (x=a) \Longleftrightarrow f \ admits \ an \ inflection \ point \ at \ (x=a)$$
As we have just shown previously that if the function \(f\) is convex, then the curve of the function is always above its tangents, i.e.:
Then,
Let \( f \) be a continuous and convex function on an interval \( I = [a,b] \), and a point \( c \in [a,b] \) of this interval, such as the following figure:
We introduce a real number \(\lambda\), proportion between points \( c \) and \( b \) according to the interval \( [a,b] \):
Consequently, we will have the other part which will be equal to:
In the following figure, we introduce a rope going from \( a \) to \( b\):
We will be able to locate the position of the rope in relation to the curve of \( f \) at point \( c \).
We then have:
With the equation \( (\lambda)\), we do have:
By performing a cross product:
Therefore, \( f(c) \) is worth:
By calculating the slope of the rope:
But:
So, replacing it by its value:
If the function \( f \) is convex, this means that for any point \( c \in [a, b] \), its image will always be below the point of the rope \(y_c\).
And finally,
$$ f \enspace convex \enspace on \enspace [a,b] \Longleftrightarrow \forall (a,b), \enspace \forall \lambda \in [0,1], \enspace f\bigl(\lambda a + (1- \lambda)b \bigr) \hspace{0.2em} \leqslant \hspace{0.2em} \lambda f(a) + (1 - \lambda)f(b) $$
We will say that \( f \) is concave if \( (-f) \) is convexe. Thus:
By multiplying both parts by \( -1 \):
$$ f \enspace concave \enspace on \enspace [a,b] \Longleftrightarrow \forall (a,b), \enspace \forall \lambda \in [0,1], \enspace f\bigl(\lambda a + (1- \lambda)b\bigr) \hspace{0.2em} \geqslant \hspace{0.2em} \lambda f(a) + (1 - \lambda)f(b) $$
Let's determine the convexity of the function \( f : x \longmapsto x^2 \) inside the interval \( [-1,1] \).
We will determine if there is any interval \( \lambda \in [0,1] \) which verifies one or the other convexity inequality.
We calculate in the interval \( [a, b] = [-1,1] \):
So,
We calculate in the interval \( [a, b] = [-1,1] \):
So,
To determine the relative position of these two functions, let's take their difference.
We can directly make a table of signs.
$$ \lambda $$
|
$$ -\infty $$
|
$$ \hspace{3em}$$
|
$$ 0 $$
|
$$ \hspace{3em}$$
|
$$1$$
|
$$ \hspace{3em}$$
|
$$ +\infty $$
|
---|---|---|---|---|---|---|---|
$$ 3 \lambda $$
|
$$ - $$
|
$$ - $$
|
$$ 0 $$
|
$$ + $$
|
$$ + $$
|
$$ + $$
|
$$ + $$
|
$$ \lambda - 1$$
|
$$ - $$
|
$$ - $$
|
$$ - $$
|
$$ - $$
|
$$ 0 $$
|
$$ + $$
|
$$ - $$
|
$$ (g-h)(\lambda) $$
|
$$ + $$
|
$$ + $$
|
$$0 $$
|
$$ - $$
|
$$ 0 $$
|
$$ + $$
|
$$ -$$
|
We definitely have for all \( \lambda \in [0, 1], \enspace (g-h)(\lambda) \leqslant 0\).
It means that:
The ropes are above the curve, the function is convex.