TITLE: Is $f(x)=|x|$ a convex function?
QUESTION [8 upvotes]: While reading an article on Convex functions, I came across the following statement: 

The absolute value function $f(x)=|x|$ is convex (as reflected in the triangle inequality), even though it does not have a derivative at the point $x = 0$.

Now we know that $f^{'}(x)=1,\text{ for }x>0$ and $f^{'}(x)=-1,\text{ for }x<0$. Considering all values of $x\neq0$, we can still conclude that $f^{''}(x)=0$ for all $x\neq0$. But a function is said to be convex iff $f^{''}(x)>0$. Where ami I going wrong? Is there another definition for convex functions?

REPLY [12 votes]: 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