French flag Arrows English flag
Sun Arrows Moon
Return Index

Convexity of a function

We call the convexity of a function \(f\) its general shape, rather bowl-shaped (convex) or rather cellar-shaped (concave).

Convex and concave functions

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.

$$ \forall x \in I, $$
$$ f''(x) \geqslant 0 \ \Longleftrightarrow f \ convex \ on \ I $$
$$ f''(x) \leqslant 0 \ \Longleftrightarrow f \ concave \ on \ I $$

And,

$$ f''(x) \ changes \ sign \ before \ and \ after \ (x=a) \Longleftrightarrow f \ admits \ an \ inflection \ point \ at \ (x=a) $$

Inflection point: change of convexity

The inequality of tangents

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.

Illustration of convexity by any tangent's position
$$\forall (a, x) \in I^2, $$
$$ f \enspace convex \enspace on \enspace I \Longleftrightarrow f(x) \geqslant f'(a)(x - a) + f(a) $$
$$f \enspace concave \enspace on \enspace I \Longleftrightarrow f(x) \leqslant f'(a)(x - a) + f(a) $$

The inequality of convexity

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.

Illustration of convexity by any rope's position
$$ f \enspace convex \enspace on \enspace I \Longleftrightarrow \forall (a,b) \in I^2, \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) $$
$$f \enspace concave \enspace on \enspace I \Longleftrightarrow \forall (a,b) \in I^2, \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) $$


Demonstrations

The sign of the second derivative indicates convexity

Let \(f\) be a function of class \( \mathbb{C}^{2}\) on its definition set and its tangent at a fixed point \(a\).

A function with 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:

$$ T_{a}(x) = f'(a)(x - a) + f(a) $$

So, point \(M_T\) will have the coordinates:

$$ M_T(m ; \ f'(a)(m - a) + f(a)) $$

Let us now consider a new function \(g\), being worth the difference between \(f\) and \(T_a\):

$$ g(x) = f(x) - T_{a}(x) $$
$$ g(x) = f(x)- f(a) - f'(a)(x - a) \qquad(g) $$

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*} $$


  1. Assumption of \( f''(x) > 0\) to the left and right of \(a\)
  2. Let us assume that it is possible to find a positive number \(\eta\) such as:

    $$ 0 < |x-a| < \eta \Longrightarrow f''(x) > 0 \qquad(S_+) $$

    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*} $$

    Function g with its both derivative and second derivative

    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 $$


  3. Assumption of \( f''(x) < 0\) to the left and right of \(a\)
  4. It is possible to make the same demonstration by making the opposite supposition of \((S_+)\), namely:

    $$ 0 < |x-a| < \eta \Longrightarrow f''(x) < 0 \qquad (S_-) $$

    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 $$


  5. Assumption of a different sign for \( f''(x)\) to the left and right of \(a\)
  6. 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''(a) = g'(a) = g(a) = 0 $$
    Function g with its both derivative and second derivative - case with different signs

    \(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.

    Inflection point: change of convexity

    $$f''(x) \ changes \ sign \ before \ and \ after \ (x=a) \Longleftrightarrow f \ admits \ an \ inflection \ point \ at \ (x=a)$$


The inequality of tangents

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.:

$$ g(x) = f(x)- f(a) - f'(a)(x - a) > 0$$

Then,

$$\forall (a, x) \in I^2, $$
$$ f \enspace convex \enspace on \enspace I \Longleftrightarrow f(x) \geqslant f'(a)(x - a) + f(a) $$
$$f \enspace concave \enspace on \enspace I \Longleftrightarrow f(x) \leqslant f'(a)(x - a) + f(a) $$

The inequality of convexity

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:

Inequality of convexity - introduction of lambda

We introduce a real number \(\lambda\), proportion between points \( c \) and \( b \) according to the interval \( [a,b] \):

$$ \lambda = \frac{b-c}{b-a} \qquad (\lambda) $$

Consequently, we will have the other part which will be equal to:

$$ 1 - \lambda = \frac{c-a}{b-a} \qquad (1 - \lambda)$$

In the following figure, we introduce a rope going from \( a \) to \( b\):

Inequality of convexity - rope 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:

  1. For the curve of \( f \)
  2. With the equation \( (\lambda)\), we do have:

    $$ \lambda = \frac{b-c}{b-a} \qquad (\lambda) $$

    By performing a cross product:

    $$ \lambda (b-a) = b-c $$
    $$ c = b - \lambda (b-a) $$
    $$ c = b - \lambda b + \lambda a $$
    $$ c = \lambda a + (1 - \lambda) b $$

    Therefore, \( f(c) \) is worth:

    $$ f(c) = f\bigl (\lambda a + (1 - \lambda) b \bigr )$$
  3. For the rope going from \( a \) to \( b\)
  4. By calculating the slope of the rope:

    $$ \frac{f(b) - f(a)}{b-a} = \frac{y_c - f(a)}{c-a} $$
    $$ (c-a) \frac{f(b) - f(a)}{b-a} = y_c - f(a) $$

    But:

    $$ 1 - \lambda = \frac{c-a}{b-a} \qquad (1 - \lambda)$$

    So, replacing it by its value:

    $$ (1 - \lambda) (f(b) - f(a)) = y_c - f(a) $$
    $$ f(b) -f(a) - \lambda f(b) + \lambda f(a) = y_c - f(a) $$
    $$ y_c = f(b) - \lambda f(b) + \lambda f(a) $$
    $$ y_c = \lambda f(a) + (1 - \lambda) f(b) $$

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\).

$$ f(c) \leqslant 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:

$$\enspace \exists \lambda \in [0,1], \enspace -f\bigl(\lambda a + (1- \lambda)b \bigr) \hspace{0.2em} \leqslant \hspace{0.2em} -\lambda f(a) + ( \lambda - 1)f(b) $$

By multiplying both parts by \( -1 \):

$$f\bigl(\lambda a + (1- \lambda)b \bigr) \hspace{0.2em} \geqslant \hspace{0.2em} \lambda f(a) + ( 1 -\lambda)f(b) $$

$$ 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) $$


Examples


The inequality of convexity

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.

Return Index
Scroll top Go to the top of the page