# Fermat's Theorem

Knowing derivative of function `f(x)` allows us to make some conclusions about behaviour of function `y=f(x)`.

**Fermat's Theorem**. Suppose function `y=f(x)` is defined on interval `[a,b]` and at some point `c in (a,b)` takes maximum (minimum) value. If exist finite derivative `f'(c)` then `f'(c)=0`.

Note, that converse of Fermat's Theorem is not true, that is, if `f'(c)=0` then `f` doesn't necessarily have maximum or minimum at `c`.

For example, consider function `f(x)=x^3` then `f'(x)=3x^2` and `f'(x)=0` when `x=0`, but `x=0` is neither maximum nor minimum. It is just a point where tangent line is horizontal and intersects graph.

Note that there may be maximum (or minimum) where `f'(c)` does not exist. For instance, the function `f(x)=|x|` has its minimum value at 0, but the value cannot be found by setting `f'(x)=0` because `f'(0)` does not exist.

Geometric interpretation of Fermat's theorem is fairly simple. Theorem states that if at point `c` there is maximum or minimum then tangent line at that point is horizontal, i.e. its slope equals 0.

Also, we require point `c` to be inner point of interval `[a,b]`. If point `c` is endpoint (either `a` or `b`) then Fermat's theorem doesn't hold.