# First Derivative Test

We know that if point is extremum then it is stationary point. So, we need to find all stationary points and test them. But how?

For this we use following test.

**First Derivative Test.** Suppose that `c` is a stationary point of a continuous function `y=f(x)`.

- if `f'(x)` changes sign from negative to positive at `c`, then `f(x)` has minimum at `c`.
- if `f'(x)` changes sign from positive to negative at `c`, then `f(x)` has maximum at `c`.
- if `f'(x)` doesn't change sign at `c`, (in other words derivative is either positive or negative on both sides of `c`) then `f(x)` has neither minimum nor maximum at `c`.

From geometrical point of view first derivative test is very clear. If function is increasing `(f'(x)>0)` to point `c` and then decreasing (`f(x)<0`), then there is maximum at `c`. Similarly for minimum. From the other side if function is increasing (decreasing) before and after point `c` then clearly there is no maximum or minimum.

Now it is clear why `f(x)=x^3` doesn't have extremum at `x=0`. Because `f'(x)=3x^2` doesn't change sign at `x=0`.

**Example 1.** Find and classify extrema of `f(x)=3x^4-4x^3-12x^2+1`.

`f'(x)=12x^3-12x^2-24x=12x(x^2-x-2)=12x(x-2)(x+1)`.

So, the critical points are `x=0`, `x=2` and `x=-1`.

To find type of stationary point (maximum minimum or neither) we need to find sign of derivative. We again use method of intervals: divide real line into intervals whose endpoints are stationary points: `(-oo,-1),(-1,0),(0,2),(2,oo)`.

First interval is `(-oo,-1)`: here `x+1<0`, `x<0` and `x-2<0` therefore `f'(x)<0`.

Second interval is `(-1,0)`: here `x+1>0`, `x<0` and `x-2<0` therefore `f'(x)>0`.

Third interval is `(0,2)`: here `x+1>0`, `x>0` and `x-2<0` therefore `f'(x)<0`.

Fourth interval is `(2,oo)`: here `x+1>0`, `x>0` and `x-2>0` therefore `f'(x)>0`.

Now, examine critical points:

`x=-1`; derivative changes sign from negative to positive therefore `x=-1` is minimum.

`x=0`; derivative changes sign from positive to negative therefore `x=0` is maximum.

`x=2`; derivative changes sign from negative to positive therefore `x=2` is minimum.

**Example 2.** Find maxima and minima of `f(x)=(x+2)^2(x-1)^3`.

Deivative of function is defined and exist for all `x`:

`f'(x)=2(x+2)(x-1)^3+3(x+2)^2(x-1)^2=(x+2)(x-1)^2(2x-2+3x+6)=`

`=(x+2)(x-1)^2(5x-4)=5(x+2)(x-1)^2(x-4/5)`.

So, the stationary points (roots of derivative) are `x=-2`, `x=1` and `x=4/5`.

We again use method of intervals: divide real line into intervals whose endpoints are stationary points: `(-oo,-2),(-2,4/5),(4/5,1),(1,oo)`.

First interval is `(-oo,-2)`: here `x+2<0`, `(x-1)^2>0` and `x-4/5<0` therefore `f'(x)>0`.

Second interval is `(-2,4/5)`: here `x+2>0`, `(x-1)^2>0` and `x-4/5<0` therefore `f'(x)<0`.

Third interval is `(4/5,1)`: here `x+2>0`, `(x-1)^2>0` and `x-4/5>0` therefore `f'(x)>0`.

Fourth interval is `(1,oo)`: here `x+2>0`, `(x-1)^2>0` and `x-4/5>0` therefore `f'(x)>0`.

Now, examine critical points:

`x=-2`; derivative changes sign from positive to negative therefore `x=-2` is maximum.

`x=4/5`; derivative changes sign from negative to positive therefore `x=4/5` is minimum.

`x=2`; derivative doesn't change sign (it is positive on both sides of `x=2`) therefore `x=2` is neither minimum nor maximum.

Now, we can easily calculate maximum and minimum values: `f(-2)=0`, `f(-4/5)=-8.4`.

**Example 3.** Find extrema of the function `y=sin^3(x)+cos^3(x)`.

Since function is periodic with period `2pi` we will consider only interval `[0,2pi]`.

Derivative is `f'(x)=3sin^2(x)cos(x)+3cos^2(x)(-sin(x))=3sin(x)cos(x)(sin(x)-cos(x))`.

On interval `[0,2pi]` `sin(x)=0` when `x=0,pi,2pi`, `cos(x)=0` when `x=pi/2,(3pi)/2`.

To solve equation `sin(x)-cos(x)=0` we divide both sides by `cos(x)` (`cos(x)!=0` because we already considered that case): `tan(x)=1` or `x=pi/4,(5pi)/4`.

So, stationary points are `x=0,pi/4,pi/2,pi,(5pi)/4,(3pi)/2,2pi`.

Using method of intervals we see that stationary points by turns attain maximum and minimum of function.

Maxima: `f(0)=f(pi/2)=f(2pi)=1`, `f((5pi)/4)=-sqrt(2)/2`. Note that `0,pi/2,2pi` are global maxima while `(5pi)/4` is local.

Minima: `f(pi/4)=sqrt(2)/2`, `f(pi)=f((3pi)/2)=-1`. Note that `pi,(3pi)/2` are global minima while `pi/4` is local.