In this article, we offer exercises on convex functions. In fact, our objectives are: to be able to show that a function is convex; to exploit the convexity to show inequality; to use the derivatives to show inequality; to exploit the Cauchy-Schwarz inequality to show inequalities.

## What is a convex function?

A function $f:I\mapsto \mathbb{R}$ is convex on the interval $I$ if for any $x,y\in I,$ and $t\in [0,1],$ we have \begin{align*} f(tx+(1-t)y)\le tf(x)+(1-t)f(y).\end{align*} The function $f$ is called strictly convex if \begin{align*} f(tx+(1-t)y)< tf(x)+(1-t)f(y).\end{align*}

Convex functions are important and help to prove some useful inequalities like Holder’s inequality. Also, any convex function is a locally Lipschitz function, so the maximal solution of a Cauchy problem defined by a convex function exists and is unique.

A function $f$ is concave of the interval $I$ if $(-f)$ is a convex function, thus if for any $x,y\in I,$ and $t\in [0,1],$ we have \begin{align*} f(tx+(1-t)y)\ge tf(x)+(1-t)f(y).\end{align*}

There is a deep connection between convex functions and differential functions as shown in the following results:

- If a function $f$ is differentiable on the interval $I$, then $f$ is convex if and only if its derivative function $f’$ is increasing.
- In the case of $f$ twice differentiable, $f$ is a convex function if and only $f”\ge 0$.

## Exercises on convex functions

**Exercise:** Prove that the logarithm function is concave. On the other hand, show that for any $(x_1,x_2,\cdots,x_n)\in (\mathbb{R}^+)^n$, \begin{align*} \sqrt[n]{x_1\cdots x_n}\le \frac{1}{n}(x_1+x_2+\cdots+x_n). \end{align*}

**Solution:** 1) Since the function $x\in (0,+\infty)\mapsto \ln(x)$ is twice differentiable, it suffices to show that $\ln(x)\le 0$ for any $x>0$. In fact, we know that $\ln'(x)=\frac{1}{x}$, hence $\ln”(x)=-\frac{1}{x^2}$ for all $x>0$. This shows that the function $x\in (0,+\infty)\mapsto \ln(x)$ is concave.

2) We have \begin{align*} \sqrt[n]{x_1\cdots x_n}&=\exp\left( \frac{1}{n}(\ln(x_1\cdots x_n)) \right)\cr &=\exp\left( \frac{1}{n}(\ln(x_1)+\cdots +\ln(x_n)) \right) \end{align*} According to the first question the logarithm function is concave. Then \begin{align*} \frac{1}{n}(\ln(x_1)+\cdots +\ln(x_n))\le \ln\left( \frac{1}{n}(x_1+\cdots +x_n)\right). \end{align*} On the other hand, as the exponential function is strictly increasing, it follows that \begin{align*} \sqrt[n]{x_1\cdots x_n}&\le \exp\left( \ln\left( \frac{1}{n}(x_1+\cdots +x_n)\right) \right)\cr &= \frac{1}{n}(x_1+\cdots +x_n). \end{align*}