# Are the extrema of this function global or local?

The function $f: \mathbb R \rightarrow \mathbb R$ is given by $$f(x) = \begin{cases} \frac{x^2+5x+7}{x+3} & \mathrm{for} \; x < -3 \\ 0 & \mathrm{for} \; x = -3 \\ \frac{x^2+5x+7}{x+3} & \mathrm{for} \; -3 < x < -2 \\ 1 & \mathrm{for} \; x = -2 \\ -x-e^{-x}+e^2-1 & \mathrm{for} \; x > -2 \end{cases}$$

Find all extrema of the function, and also determine, without the use of a calculator, whether they are global or local.

My Attempt:

The derivative is given by:
$$f'(x) = \begin{cases} \frac{x^2+6x+8}{(x+3)^2} & \mathrm{for} \; x < -3 \\ \mathrm{undefined} & \mathrm{for} \; x = -3 \\ \frac{x^2+6x+8}{(x+3)^2} & \mathrm{for} \; -3 < x < -2 \\ \mathrm{undefined} & \mathrm{for} \; x = -2 \\ -1+e^{-x} & \mathrm{for} \; x > -2 \end{cases}$$

Solve the first one:

\begin{align*} \frac{x^2+6x+8}{x^2+6x+9} &= 0 \\ x^2+6x+8 &= 0 \\ (x+2)(x+4) &= 0 \\ x=-2 &\vee x=-4 \end{align*}

Only $x=-4$ is in the domain. The second derivative is $$f''(x)=\frac{2x+6}{(x+3)^4}$$ Substitute in $x=-4$ to get $f''(x)=-2$, so it is a minimum.

Solve the second one: \begin{align*} -1+e^{-x} &= 0 \\ e^{-x} &= 1 \\ -x&=0 \\ x &= 0 \end{align*}

Which is in the domain. Taking the second derivative gives $-e^{-x}$, and $-e^{-0}=-1$, so it is a minimum.

How to determine whether the minima are global or local?

Hint: to solve the first one multiply both sides by $(x+3)^2$ to get a quadratic equation.