# Conditions of Concavity (Convexity) of the Function

Often it is very hard to prove convexity (or concavity) of function through definition.

We need more powerful methods.

Fact 1. Suppose that function y=f(x) is defined and continuous on interval X, and has finite derivative f'(x) inside it. Function y=f(x) is concave upward (downward) on X if and only if derivative f'(x) is non-decreasing (non-increasing). Function is strictly concave upward (downward) on X if and only if derivative f'(x) is increasing (decreasing).

Geometrically this fact means the following: since derivative is slope of tangent line, then for concave upward function slopes of tangent line should increase and for concave downward function they should decrease.

On practice however, following fact is used, which is based on fact 1.

Fact 2. Suppose that function y=f(x) is defined and continuous together with its derivative f'(x) on interval X, and has finite second derivative f''(x) inside it. Function y=f(x) is concave upward (downward) on X if and only if derivative f''(x)>=0 (f''(x)<=0). Function is strictly concave upward (downward) on X if and only if f''(x)>0 (f''(x)<0).

Example 1. Function y=x^2 is strictly concave upward because f''(x)=2>0 for all x.

Example 2. Function y=e^x is strictly concave upward because f''(x)=e^x>0 for all x.

Example 3. Function y=ln(x) is strictly concave downward on (0,oo) because f''(x)=-1/x^2<0 for all x, but function is defined only for x>0.

Example 4. Function f(x)=xln(x) is concave upward because f'(x)=ln(x)+1 and f''(x)=1/x>0 for x>0 and function is defined for x>0.

Example 5. Find where function y=x^4-4x^3 is concave upward and downward.

Let's find second derivative.

f'(x)=4x^3-12x^2 and f''(x)=12x^2-24x=12x(x-2).

We use method of intervals to find where f''(x)>0 and where is f''(x)<0.

So f''(x)=0 when x=0 and x=2.

These two values divide number line into three intervals:

First interval is (-oo,0): here x<0 and x-2<0 so f''(x)>0.

Second interval is (0,2): here x>0 and x-2<0 so f''(x)<0.

Third interval is (2,oo): here x>0 and x-2>0 so f''(x)>0.

Thus, function is concave upward on (-oo,0)uu(2,oo) and concave downward on (0,2).

Example 6. Discuss concavity of the function f(x)=x^2e^(-x).

Let's find second derivative.

f'(x)=2xe^(-x)-x^2e^(-x) and f''(x)=2e^(-x)-2xe^(-x)-2xe^(-x)+x^2e^(-x)=e^(-x)(x^2-4x+2).

Since e^(-x)>0 for all x then it doesn't influence sign of derivative, so we ignore it.

To find where (x^2-4x+2)=(x-2-sqrt(2))(x-2+sqrt(2)) is positive and where it is negative we use method of intervals.

So f''(x)=0 when x=2-sqrt(2) and x=2+sqrt(2).

These two values divide number line into three intervals:

First interval is (-oo,2-sqrt(2)): here x-2-sqrt(2)<0 and x-2+sqrt(2)<0 so f''(x)>0.

Second interval is (2-sqrt(2),2+sqrt(2)): here x-2-sqrt(2)<0 and x-2+sqrt(2)>0 so f''(x)<0.

Third interval is (2+sqrt(2),oo): here x-2-sqrt(2)>0 and x-2+sqrt(2)>0 so f''(x)>0.

Thus, function is concave upward on (-oo,2-sqrt(2))uu(2+sqrt(2),oo) and concave downward on (2-sqrt(2),2+sqrt(2)).

At last let's formulate another geometric property of concave upward function.

Fact 3. Suppose function y=f(x) is defined and continuous on interval X and has finite derivative f'(x) inside it. Function y=f(x) is concave upward (downward) if all values of function on interval X lie above (below) any tangent line (or on it).