# Motivation
It is often helpful to classify stationary points of a function. Suppose we
want to maximise or minimise something, then finding the stationary points
within some bounds and characterising their nature will get us almost all of
the way to the answer - the extrema must be found either at a stationary point
or at the boundary of the interval.
# Description
- if $f$ is increasing on the left interval and decreasing on the right interval, then the stationary point is a local _maximum_.
- if $f$ is decreasing on the left interval and increasing on the right interval, then the stationary point is a local _minimum_.
- if $f$ is increasing on the left interval and the right interval, or if $f$ is decreasing on the left interval and the right interval then the stationary point is a horizontal point of inflection
- if $f$ is stationary on the left interval and the right interval, then the point is a stationary point, but it is none of the above
Every non-constant polynomial function tends to negative or positive infinity
at the extremes. You can find its behaviour at the extremes by finding its
stationary points and the sign of the first derivative on the outer interval.
## Formalizing the above
Suppose we have some stationary point $p$ in the domain of a function $f$ and
$p$ divides the domain of $f$ into two intervals which we will call $L$ and $R$
such that if $D$ is the domain of $f$ then $L$ is the contiguous interval within $D$ closest to $p$ where all points in $L$ are less than $p$ and share a common sign, and likewise $R$ is the contiguous interval within $D$ closest to $p$ where all points in $R$ are greater than $p$ and share a common sign.
- if $f'(x)>0 \;\forall x\in L$ and $f'(x)<0 \;\forall x\in R$ then $p$ is a local maximum.
- if $f'(x)<0 \;\forall x\in L$ and $f'(x)>0 \;\forall x\in R$ then $p$ is a local minimum.
- if $f'(x)>0 \;\forall x\in L$ and $f'(x)>0 \;\forall x\in R$ or $f'(x)<0 \;\forall x\in L$ and $f'(x)<0 \;\forall x\in R$ then $p$ is a horizontal point of inflection.
- if $f'(x)=0 \;\forall x\in \{p\} \cup L \cup R$ then $p$ is a stationary point, but is none of the above. This would happen for if $f$ is constant over the domain $D$ for example.
Characterising the nature of stationary points using the first derivative in this way is known as the _first derivative test_.
## Worked example
Suppose we have
$
\begin{align*}
f(x) &= \frac{x^2}{x+1}\\
\text{So}~f'(x) &= \frac{(x+1)2x-x^2}{(x+1)^2}\\
&= \frac{2x^2+2x-x^2}{(x+1)^2}\\
&= \frac{x^2+2x}{(x+1)^2}\\
&= \frac{x(x+2)}{(x+1)^2}
\end{align*}
$
It can be seen that the zeroes of $f'$ are at $x=0$ and $x=-2$. These are the
stationary points. The normal procedure now is to construct a [[Solving Inequalities Using Descartes' Table of Signs|table of signs]]
for $f'$.
| | $(- \infty,-2)$ | $-2$ | $(-2,-1)$ | $-1$ | $(-1,0)$ | $0$ | $(0, \infty)$ |
| :-----: | :-------------: | :--: | :-------: | :--: | :------: | :-: | :-----------: |
| $x$ | $-$ | $-$ | $-$ | $-$ | $-$ | $0$ | $+$ |
| $x+2$ | $-$ | $0$ | $+$ | $+$ | $+$ | $+$ | $+$ |
| $x+1$ | $-$ | $-$ | $-$ | $0$ | $+$ | $+$ | $+$ |
| $f'(x)$ | $+$ | $0$ | $-$ | $*$ | $-$ | $0$ | $+$ |
### Plot of $f'(x)$
![[First derivative Test Plot 1.png]]
Now we can classify the points. I like to do this by setting out an additional table as follows
| $p$ | $L$ | Sign of $f'$ in $L$ | $R$ | Sign of $f'$ in $R$ | Classification of $x=p$ |
| :--: | :------------: |:-------------------:|:------------:|:-------------------:|:-----------------------:|
| $-2$ | $(-\infty,-2)$ | $+$ | $(-2,-1)$ | $-$ | Local maximum |
| $0$ | $(-1,0)$ | $-$ | $(0,\infty)$ | $+$ | Local minimum |
As you can see, the choice of ranges for $L$ and $R$ is easy, it's just one column to the left and right of the column containing $p$ in each case. Don't be put off by the bit in the definition about "common signs" etc. It just means "choose the next column across in the table of signs".
### Plot of $f(x)$ with stationary points marked
![[First Derivative test plot 2.png]]
This visually confirms the classification from the first derivative test.