<s>[INST] Find the range of function We have the function \begin{equation*}f(x)=-\frac{(x-3)^2}{x+1}\end{equation*} 
I want to determine the domain and the range of the function. 
The root of the deniminator is $x=-1$. Therefore, the domain is $D_f=\mathbb{R}\setminus\{-1\}=(-\infty, -1)\cup (-1,+\infty )$. 
Does it holds that \begin{equation*}W_f=f(D_f)=f\left ((-\infty, -1)\cup (-1,+\infty )\right )=f\left ((-\infty , -5)\cup (-5,-1) \cup (-1,3) \cup (3,+\infty)\right )\end{equation*} ? 
If this is correct, then we have to know the monotonicity of $f$ at each of these intervalls. 
We have that at $(-\infty , -5)$ the function is decreasing, at $(-5,-1)$ the function is incresing, at $(-1,3)$ the function is increasing and at (3,+\infty)$ the function is decreasing. 
We have the following:   


*

*\begin{align*}f\left ((-\infty , -5)\right )= \left (16, +\infty\right ) \end{align*} 

*\begin{align*}f\left ((-5,-1)\right )= \left (16, +\infty\right )\end{align*} 

*\begin{align*}f\left ((-1,3)\right )= \left (-\infty, 0\right )\end{align*} 

*\begin{align*}f\left ((3,+\infty)\right ) = \left (-\infty, 0\right )\end{align*}
Therefore the range is
\begin{equation*}W_f= \left (-\infty, 0\right )\cup \left (16, +\infty\right ) \end{equation*}  
$$$$ 
Is everything correct? Or do we have to determine the range in an other way? 
 [/INST] $$-\frac{(x-3)^2}{x+1}=\frac{-x^2+6x-9}{x+1}=\frac{-x^2+6x+7-16}{x+1}=7-x-\frac{16}{x+1}.$$
Thus, for $x<-1$ by AM-GM we obtain
$$f(x)=8-x-1-\frac{16}{x+1}\geq8+2\sqrt{(-x-1)\left(-\frac{16}{x+1}\right)}=16$$
and for $x>-1$ by AM-GM again we obtain:
$$f(x)=8-x-1-\frac{16}{x+1}\leq8-2\sqrt{(x+1)\cdot\frac{16}{x+1}}=0.$$
Since $\lim\limits_{x\rightarrow-1^+}f(x)=-\infty$ and $\lim\limits_{x\rightarrow-1^-}f(x)=+\infty$ and $f$ is a continuous function 
on all interval of the domain, we got the answer:
$$(-\infty,0]\cup[16,+\infty).$$ 
</s>