# Convex Functions

## Definition of Convexity of a Function

Consider a function *y* = *f* (*x*), which is assumed to be continuous on the interval [*a*, *b*]. The function *y* = *f* (*x*) is called convex downward (or concave upward) if for any two points *x*_{1} and *x*_{2} in [*a*, *b*], the following inequality holds:

If this inequality is strict for any *x*_{1}, *x*_{2} ∈ [*a*, *b*], such that *x*_{1} ≠ *x*_{2}, then the function *f* (*x*) is called strictly convex downward on the interval [*a*, *b*].

Similarly, we define a concave function. A function *f* (*x*) is called convex upward (or concave downward) if for any two points *x*_{1} and *x*_{2} in the interval [*a*, *b*], the following inequality is valid:

If this inequality is strict for any *x*_{1}, *x*_{2} ∈ [*a*, *b*], such that *x*_{1} ≠ *x*_{2}, then the function *f* (*x*) is called strictly convex upward on the interval [*a*, *b*].

## Geometric Interpretation of Convexity

The introduced concept of convexity has a simple geometric interpretation.

If a function is convex downward (Figure \(1\)), the midpoint \(B\) of each chord \({A_1}{A_2}\) lies above the corresponding point \({A_0}\) of the graph of the function or coincides with this point.

Similarly, if a function is convex upward (Figure \(2\)), the midpoint \(B\) of each chord \({A_1}{A_2}\) is located below the corresponding point \({A_0}\) of the graph of the function or coincides with this point.

Convex functions have another obvious property, which is related to the location of the tangent to the graph of the function. The function \(f\left( x \right)\) is convex downward on the interval \(\left[ {a,b} \right]\) if and only if its graph does not lie below the tangent drawn to it at any point \({x_0}\) of the segment \(\left[ {a,b} \right]\) (Figure \(3\)).

Accordingly, the function \(f\left( x \right)\) is convex upward (or concave downward) on the interval \(\left[ {a,b} \right]\) if and only if its graph does not lie above the tangent drawn to it at any point \({x_0}\) of the segment \(\left[ {a,b} \right]\) (Figure \(4\)). These properties represent a theorem and can be proved using the definition of convexity.

## Sufficient Conditions for Convexity/Concavity (Convexity/Concavity Test)

Suppose that the first derivative \(f'\left( x \right)\) of a function \(f\left( x \right)\) exists in a closed interval \(\left[ {a,b} \right],\) and the second derivative \(f^{\prime\prime}\left( x \right)\) exists in an open interval \(\left( {a,b} \right).\) Then the following sufficient conditions for convexity/concavity are valid:

- If \(f^{\prime\prime}\left( x \right) \ge 0\) for all \(x \in \left( {a,b} \right),\) then the function \(f\left( x \right)\) is convex downward (or concave upward) on the interval \(\left[ {a,b} \right];\)
- If \(f^{\prime\prime}\left( x \right) \le 0\) for all \(x \in \left( {a,b} \right),\) then the function \(f\left( x \right)\) is convex upward (or concave downward) on the interval \(\left[ {a,b} \right].\)

In the cases where the second derivative is strictly greater (or less) than zero, we say, respectively, about the strict convexity downward (or strict convexity upward).

We prove the theorem for the case of convexity downward. Let the function \(f\left( x \right)\) have a non-negative second derivative on the interval \(\left( {a,b} \right):\) \(f^{\prime\prime}\left( x \right) \ge 0.\) Let \({x_0}\) be the midpoint of the interval \(\left[ {{x_1},{x_2}} \right].\) Suppose that the length of this interval is equal to \(2h.\) Then the coordinates \({x_1}\) and \({x_2}\) can be written as

Expand the function \(f\left( x \right)\) at \({x_0}\) in the Taylor series with the remainder in the Lagrange form. We obtain the following expressions:

where \({x_0} - h \lt {\xi _1} \lt {x_0},\) \({x_0} \lt {\xi _2} \lt {x_0} + h.\)

Add the two equations:

Since \({\xi _1},{\xi _2} \in \left( {a,b} \right),\) then the second derivatives in the right-hand side are non-negative. Consequently,

or

that is according to the definition, the function \(f\left( x \right)\) is convex downward.

Note that the necessary condition for convexity (for example, the implication when from the convexity downwards it follows that \(f^{\prime\prime}\left( x \right) \ge 0\)) holds only for the non-strict inequality. In the case of strict convexity, the necessary condition is generally not valid. For example, the function \(f\left( x \right) = {x^4}\) is strictly convex downward. However, its second derivative is zero at \(x = 0\), that is the strict inequality \(f^{\prime\prime}\left( x \right) \gt 0\) does not hold in this case.

## Properties of Convex Functions

We list some properties of convex functions assuming that all functions are defined and continuous on the interval \(\left[ {a,b} \right].\)

- If the functions \(f\) and \(g\) are convex downward (upward), then any linear combination \(af + bg\) where \(a\), \(b\) are positive real numbers is also convex downward (upward).
- If the function \(u = g\left( x \right)\) is convex downward, and the function \(y = f\left( u \right)\) is convex downward and non-decreasing, then the composite function \(y = f\left( {g\left( x \right)} \right)\) is also convex downward.
- If the function \(u = g\left( x \right)\) is convex upward, and the function \(y = f\left( u \right)\) is convex downward and non-increasing, then the composite function \(y = f\left( {g\left( x \right)} \right)\) is convex downward.
- Any local maximum of a convex upward function defined on the interval \(\left[ {a,b} \right]\) is also its global maximum on this interval.
- Any local minimum of a convex downward function defined on the interval \(\left[ {a,b} \right]\) is also its global minimum on this interval.

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Sketch schematically the graphs of the functions for all possible combinations of \(y\), \(y'\), \(y^{\prime\prime}\) where each of these values is positive or negative.

### Example 2

Find the values of \(x,\) at which the cubic function \[f\left( x \right) = {x^3} + a{x^2} + bx + c\] is convex downward.

### Example 3

Find the intervals of convexity and concavity of the function \[f\left( x \right) = - {x^3} + 6{x^2} - 2x + 1.\]

### Example 4

Find the intervals of convexity and concavity of the function \[f\left( x \right) = 2{x^3} - 18{x^2}.\]

### Example 5

Find the intervals on which the function \[f\left( x \right) = {x^3} + ax + b\] (where \(a, b\) are any real numbers) is convex upward.

### Example 6

Find the intervals of convexity and concavity of the function \[f\left( x \right) = \sqrt {2 + {x^2}} .\]

### Example 1.

Sketch schematically the graphs of the functions for all possible combinations of \(y\), \(y'\), \(y^{\prime\prime}\) where each of these values is positive or negative.

Solution.

Consider an arbitrary combination of these values, such as the following:

The graph of such a function is located in the upper half-plane, and the function is strictly decreasing (since \(y' \lt 0\)). Given that \(y^{\prime\prime} \gt 0,\) the function is convex downward. Its schematic view is shown in Figure \(5\) in the first column and second row.

It is clear that the total number of possible combinations of the three variables with different signs is \(8.\) The corresponding sketches of the graphs of the functions are shown in Figure \(5.\)

### Example 2.

Find the values of \(x,\) at which the cubic function \[f\left( x \right) = {x^3} + a{x^2} + bx + c\] is convex downward.

Solution.

We compute the second derivative of the given function:

The function is convex upward if \(f^{\prime\prime}\left( x \right) \le 0.\) Find the corresponding values of \(x:\)

As you can see, only the point \(x = \sqrt 2\) falls in the interval \(\left[ {0.5,2} \right].\) Calculate the values of the function at the extremum point \(x = \sqrt 2\) and at the boundary points of the interval:

So the maximum value of the function in this interval is equal to \(4.5\) at the point \(x = 0.5,\) and the minimum value is \(2.83\) at \(x = \sqrt 2.\)

### Example 3.

Find the intervals of convexity and concavity of the function \[f\left( x \right) = - {x^3} + 6{x^2} - 2x + 1.\]

Solution.

Compute the derivatives:

The second derivative is equal to zero at the following point:

The second derivative is positive to the left of this point and negative to the right. Hence, the function is convex downward on \(\left( { -\infty, 2} \right)\) and convex upward on \(\left( {2, +\infty} \right).\)

### Example 4.

Find the intervals of convexity and concavity of the function \[f\left( x \right) = 2{x^3} - 18{x^2}.\]

Solution.

Differentiating this function, we have

We set \(f^{\prime\prime}\left( x \right)\) equal to zero and solve the equation:

The second derivative is negative if \(x \lt 3\) and positive if \(x \gt 3.\) Hence, the function is convex downward on the interval \(\left( {3, +\infty} \right)\) and convex upward on \(\left( {-\infty, 3} \right).\)

### Example 5.

Find the intervals on which the function \[f\left( x \right) = {x^3} + ax + b\] (where \(a, b\) are any real numbers) is convex upward.

Solution.

Take the derivatives:

We see that \(f^{\prime\prime}\left( x \right) \lt 0\) at \(x \lt 0.\) Hence, the function is convex upward on \(\left( { -\infty, 0} \right).\)

### Example 6.

Find the intervals of convexity and concavity of the function \[f\left( x \right) = \sqrt {2 + {x^2}} .\]

Solution.

This function is defined and differentiable for all \(x \in \mathbb{R}.\) Calculate the second derivative:

It can be seen that the second derivative is always positive. Therefore, the function is convex downward for all values of \(x.\)