TITLE: How to check if a function is convex
QUESTION [10 upvotes]: According to a calculus book I have been reading, we call a function $g(x)$ a convex function if 

$$g(\lambda x +(1-\lambda)y) \leq \lambda g(x) +(1-\lambda)g(y)$$, for all $x,y$ and $0<\lambda<1$.

But if I have to check if a given function is convex or not,this definition seems hard and impractical to use. So,my question is, is there any easier way of checking convexity of a function and if there is,then why it is equivalent to this defiinition.
Thanks in advance!

REPLY [6 votes]: Check the Hessian matrix of the function. If the matrix is:

Positive-definite then your function is strictly convex.
Positive semi-definite then your function is convex.

A matrix is positive definite when all the eigenvalues are positive and semi-definite if all the eigenvalues are positive or zero-valued.