# Convex functions

Convexity plays an important role not only in mathematics, but also in physics, chemistry, biology and other sciences.

We’ve learned what convex sets are, and now we”ll introduce convex functions.

## Convex and concave function

Definition: Let $I$ be an interval in $\mathbb{R}$.

a) We say that a function $f: I \rightarrow \mathbb{R}$ is convex on interval $I$ if for all $x, y \in I$ and for all $\alpha \in [0, 1]$

$$f(\alpha x + (1 – \alpha) y) \leq \alpha f(x) + (1 – \alpha)f(y).$$

In addition, if for all $x \neq y$ and for all $\alpha \in \left<0, 1\right>$ previous inequality is strict, we say that $f$ is a strictly convex function.

b) If an inequality is reverse, we say that $f$ is a concave function.

If for all $x \neq y$ and for all $\alpha \in \left<0, 1\right>$ that inequality is strict, we say that $f$ is a strictly concave function.

Also, notice that $f$ is concave if function $-f$ is convex.

Furthermore, domain of a convex function must be a convex set.

Moreover, the following characterization of a convex function is valid.

Continuous function $f$ is convex on $[a, b]$ if and only if for all $x, y \in [a, b]$

$$f\left(\frac{x + y}{2}\right) \leq \frac{f(x) + f(y)}{2}.$$

## Examples of convex functions

Example 1:  Function $f: \mathbb{R} \rightarrow \mathbb{R}$, $f(x) = x^2$ is strictly convex on $\mathbb{R}$.

Example 2:  Function $f: \mathbb{R^{+}}\rightarrow \mathbb{R}$, $f(x) = x ln x$ is a convex function.

Example 3:  Function $f: \mathbb{R} \rightarrow \mathbb{R^{+}}$, $f(x) = \vert x \vert$ is a convex function.

## Geometric interpretation of convexity

Let $f: I \rightarrow \mathbb{R}$ be a convex function and $$T_{1} = (x_{1}, f(x_{1})), T_{2} = (x_{2}, f(x_{2})),$$ where $x_{1}, x_{2} \in I, x_{1} < x_{2}$. Furthermore, let $$T_{\alpha} = (\alpha x_{1} + (1 – \alpha)x_{2}, \alpha f(x_{1}) + (1 – \alpha)f(x_{2})), \alpha \in [0, 1]$$ be a point on the line segment $\overline{T_{1}T_{2}}$.

We have $$f(\alpha x_{1}+(1 – \alpha)x_{2}) \leq \alpha f(x_{1})+(1 – \alpha)f(x_{2}).$$

In other words, the line segment between any two points on the graph of the convex function lies above or on the graph. On the other hand, the line segment between any two points on the graph of the concave function lies below the graph.

## Characterizations of convex functions

Sometimes it is difficult to determine by definition whether some function is convex or not. For that reason, we often use characterizations of convex functions.

Theorem:  Let $f: I \rightarrow \mathbb{R}$ be a derivable function on $I$. Function $f$ is convex if and only if its derivative $f’$ is an increasing function.

Corollary: Let $f: I \rightarrow \mathbb{R}$ be two time derivable function on $I$. Function $f$ is convex on interval $I$ if and only if $f”(x) \geq 0$.

Example:  Determine whether these functions are convex:

a) $f(x) = e^x$

b) $f(x) = x^p, x \geq 0$

c) $f(x) = ax + b, a, b \in \mathbb{R}$

Solution:

a) The second derivative of $f(x) = e^x$ is $f”(x) = e^x \geq 0$. In conclusion, it is a convex function.

b) The second derivative of $f(x) = x^p, x \geq 0$ is $f”(x) = p(p – 1)x^{p – 2}$.

$f”(x)$ is non – negative if $p(p – 1) \geq 0$. In other words, it is non – negative if $p \in \left<- \infty, 0\right] \cup \left[1, + \infty \right>$. Furthermore, it is negative if $p(p – 1) < 0$. In other words, it is negative if $p \in \left<0, 1\right>$.

In conclusion, $f$ is convex for $p \leq 0$ or $p \geq 1$ and concave for $0 \leq p \leq 1$.

c) Obviously, the second derivative of given function is $f”(x)\geq 0$. Therefore, $f(x) = ax + b$ is convex function, but also concave.