How to know whether a function is convex or non convex

In many algo. sir told that this function is convex or non convex,how just by looking at it we can say whether this is convex or not.
I know what sir in beginning sir told about the convex functions but how to identify them…???

Just by looking at a random function we can’t say whether it is a convex function or not.

A way to check if a function is convex is by checking if it has a positive semidefinite hessian matrix everywhere.

You can check out this paper if you want a mathematical background about convex functions - http://www.math.cmu.edu/~ploh/docs/math/mop2013/convexity-soln.pdf