Is $f(x)=|x|$ a convex function?

Here is an another proof which I find easier to understand as it involves an alternative definition of convexity (which is more intuitive I find...)

Definition of convexity

Let $f$ be a real function defined on a real interval $I$, $f$ is convex on $I$ if and only if:

$$ f(\alpha x + \beta y) \leq \alpha f(x) + \beta f(y)$$

$$ \forall x,y \in I \ : \forall \alpha, \beta \in \mathbb{R}_{\geq 0}, \ \alpha + \beta = 1 \ $$

Proof that $f(x) = |x|$ is convex:

Let $x,y \in R$ and $\alpha, \beta \in R_{\geq0}$ subject to $\alpha + \beta = 1$

\begin{aligned} f(\alpha x + \beta y ) & = |\alpha x + \beta y| &\text{Definition of $f$} \\ & \leq | \alpha x | + | \beta y| &\text{Triangle inequality} \\ & = | \alpha | |x| + |\beta| |y| &\text{Absolute value is multiplicative} \\ & = \alpha f(x) + \beta f(y) &\text{By definition} \end{aligned}

source 1

source 2


According to Wikipedia a convex function is "... if the line segment between any two points on the graph of the function lies above or on the graph"

Also (again Wikipedia), "If f is twice continuously differentiable and the domain is the real line, then we can characterize it as follows - $f$ convex if and only if $f''(x) \geq 0$ for all $x$".

But your function is not twice continuously differentiable.


What is incorrect is your definition of convex functions.

According to the wikipedia page you linked, a function is called convex if $\forall x_1, x_2 \in X, \forall t \in [0, 1]: f(tx_1+(1-t)x_2)\leq t f(x_1)+(1-t)f(x_2).$

This is not equivalent to $f''(x)>0$.

Tags:

Functions