# Condition of Monotony of the Function

Now let's formulate conditions when function will be monotonic, i.e. increasing, decreasing, non-decreasing, non-increasing.

**Fact 1**. Suppose function `y=f(x)` is defined and continuous on interval `X` and has finite derivative `f'(x)` on it. Then function is non-decreasing (non-increasing) on `X` if and only if `f'(x)>=0` (`f'(x)<=0`) for all `x` in `X`.

This fact doesn't exclude the possibility that functon will be constant on some intervals.

Next fact will exclude this posibility.

**Fact 2**. Suppose function `y=f(x)` is defined and continuous on interval `X` and has finite derivative `f'(x)` on it. Then function is increasing (decreasing) on `X` if and only if `f'(x)>=0` (`f'(x)<=0`) for all `x` in `X` and `f'(x)` is not 0 on any subinterval of `X`.

Notice that the only difference between Fact 1 and Fact 2 is phrase: "`f'(x)` is not 0 on any subinterval of `X`". Adding this condition guarantees that function is not constant on some subinterval of `X`.

Connection between sign of derivative and direction of change of function is geometrically obvious. Recall that derivative is slope of tangent line. Function is increasing when slope of tangent line is positive, and decreasing if slope of tangent line is negative.

However, at some points tangent line can be horizontal, i.e. derivative of increasing (decreasing) function can equal 0 at some points.

For example, consider function `y=x^3`. It is increasing, but `f'(x)=3x^2` equals 0 when `x=0`.

Another example is increasing function `f(x)=x-sin(x)`. Its derivative `f'(x)=1-cos(x)` is non-negative and equals 0 when `x=2pik, k in Z`.

As we saw function will be still increasing (decreasing) even if its derivative is non-negative (non-positive) and equals 0 at some points.

But if derivative is non-negative (or non-positive) on `X` and equals 0 on some subinterval of `X` then function will be non-decreasing (non-increasing).

**Example 1**. Find where function `f(x)=x^3+15/2x^2+12x+5` is increasing and decreasing.

`f'(x)=3x^2+15x+12=3(x^2+5x+4)=3(x+4)(x+1)`. We need to know where `f'(x)>0` and where `f'(x)<0`.

For this we use method of intervals.

To do this divide real line into intervals whose endpoints are values where `f'(x)=0`: -4 and -1.

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

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

Third interval is `(-1,oo)`: here `x+4>0` and `x+1>0` so `f'(x)>0`.

Therefore function is increasing on `(-oo,-4)uu(-1,oo)` and decreasing on `(-4,-1)`.

**Example 2**. Find intervals of monotony of function `f(x)=(x+2)/(x^2-3)`.

Using Quotient Rule we obtain that `f'(x)=((x+2)'(x^2-3)-(x+2)(x^2-3)')/((x^2-3)^2)=(x^2-3-2x^2-4x)/(x^2-3)^2=-(x^2+4x+3)/(x^2-3)^2=-((x+1)(x+3))/(x^2-3)^2`.

Again we use method of intervals.

Note, that denominator is always non-negative and thus doesn't influence sign of derivative, so ignore it.

Divide real line into intervals whose endpoints are values where `f'(x)=0`: -3 and -1.

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

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

Third interval is `(-1,oo)`: here `x+3>0` and `x+1>0` so `f'(x)=-(x+1)(x+3)<0`.

Therefore function is increasing on `(-3,-1)` and decreasing on `(-oo,-3)uu(-1,oo)`.

**Example 3**. Find where function `f(x)=1/4 x^4-1/3x^3+2` is increasing and where is decreasing.

We have that `f'(x)=x^3-x^2=x^2(x-1)`.

`x^2` is always non-negative and doesn't influence sign of derivative. So, function is increasing when `x>1` and decreasing when `x<1`.