Let f(x) be a real function of a real variable defined in(a,b) and differentiable in the point x_0 in (a,b)
A necessary condition for x_0 to be a local minimum or maximum is that:
f'(x_0) = 0
If f(x) is differentiable in the entire interval, or at least in an interval around x_0, we also have a sufficient condition:
x_0 is a local minimum if f'(x_0) = 0 and there is a number delta such that:
x in (x_0-delta, x_0) => f'(x) <=0
x in (x_0,x_0+delta) => f'(x) >=0
In this case in fact f(x)will be decreasing on the left of x_0 and increasing on the right, so that x_0 is a relative minimum.
Vice versa x_0 is a local maximum if:
x in (x_0-delta, x_0) => f'(x) >=0
x in (x_0,x_0+delta) => f'(x) <=0
In both cases the necessary condition is that the derivative of f(x) changes sign around x_0.
If f(x) also has a second derivative in an interval around x_0 this is equivalent to the conditions:
f'(x_0) = 0" and " f''(x_0) > 0 => x_0 is a local minimum.
f'(x_0) = 0" and " f''(x_0) < 0 => x_0 is a local maximum.
So, to find local maxima and minima the process is:
1) Find the solutions of the equation:
f'(x) = 0
also called critical points.
2) Solve the inequality:
f'(x) <=0
to see if the sign of f'(x) changes around the critical points, or, alternatively:
2') Calculate f''(x) and look at its value in the critical points.
Example:
Let f(x) = 2x^3-3x^2-12x+1
Calculate the derivative:
f'(x) = 6x^2-6x-12
Solve the equation:
f'(x) = 0
6x^2-6x-12 =0
x^2-x-2 =0
x = (1+-sqrt(1+8))/2
so the critical points are:
x_1=-1
x_2 =2
As f'(x) is a second degree polynomial with positive leading coefficients we know that:
f'(x) < 0 for x in (-1,2)
f'(x) > 0 for x in (-oo,-1) uu (2,+oo)
and we can soon determine that x_1 is a local maximum and x_2 a local minimum.
Alternatively we can evaluate the second derivative:
f''(x) = 12x-6
and check that:
f''(x_1) = -12-6 = -18 < 0 => x_1 is a maximum
f''(x_2) = 24-6 = 18 > 0 => x_2 is a minimum