Let $f(x)=|x^3|$ on I=$-\infty,+\infty$
Is this convex?
How I did was
f(x) = \begin{cases} x^3, & \text{if $x>=0$ } \\ -x^3, & \text{if $x<0$ } \end{cases}
Then$ f '(x)$ =
\begin{cases}
3x^2, & \text{if $x>=0$ } \\
-3x^2, & \text{if $x<0$ }
\end{cases}
And $f''(x)$ =
\begin{cases}
6x, & \text{if $x>=0$ } \\
-6x, & \text{if $x<0$ }
\end{cases}
So since $f''(x)>=0$ on I=$-\infty,+\infty$ f(x) is convex.
Is this correct? Is there a way I can do it using the definition $f(\lambda x+(1-\lambda y))<=\lambda f(x)+(1-\lambda)f(y)$, $\lambda \in [0,1]$
Yup! This is correct. If $f''(x)>0$, then the function is convex. Notice the converse is true if the function is twice differentiable