Let S be a convex subset of a Euclidean vector space Rm. Recall the following definition: a function f : S -> R

is said to be convex if f(x1,...; xm, y) : y >= f(x), x = (x1,...,xm) is a convex set in Rm+1.

Prove that a function f : S -> R is convex if and only if

f(λp + (1+λ)q)<= λf(p + (1-λ)f(q) for all p,q in S and for all λ in [0,1]

(Note: We require the convexity of S simply so that all of the vectors (λp+(1-λ)q) are guaranteed to lie in S. Thus, this requirement should be included in the very definition of convex function.)