Two Conditions for a Function to be Convex