<s>[INST] Range of $y = \frac{x^2-2x+5}{x^2+2x+5}$? How do I approach this problem? My book gives answer as $[\frac{3-\sqrt{5}}{2},\frac{3+\sqrt{5}}{2}]$. I tried forming an equation in $y$ and putting discriminant greater than or equal to zero but it didn't work. Would someone please help me?
I get $x^2 (y-1) + 2x (y+1) + (5y-5) =0$ and discriminant gives $2y^2 - y + 2 \leq 0$, which has complex roots.
 [/INST] Since 
$$y = \frac{x^2 - 2x + 5}{x^2 + 2x + 5}$$
we obtain 
\begin{align*}
y(x^2 + 2x + 5) & = x^2 - 2x + 5\\
yx^2 + 2yx + 5y & = x^2 - 2x + 5\\
(y - 1)x^2 + (2y + 2)x + 5(y - 1) & = 0\\
(y - 1)x^2 + 2(y + 1)x + 5(y - 1) & = 0
\end{align*}
which is equivalent to your equation $x^2(y - 1) + 2x(y + 1) + (5y - 5) = 0$.  However, you should have obtained the discriminant
\begin{align*}
\Delta & = b^2 - 4ac\\
       & = [2(y + 1)]^2 - 4(y - 1) \cdot 5(y - 1)\\
       & = 4(y^2 + 2y + 1) - 20(y - 1)^2\\
       & = 4y^2 + 8y + 4 - 20(y^2 - 2y + 1)\\
       & = 4y^2 + 8y + 4 - 20y^2 + 40y - 20\\
       & = -16y^2 + 48y - 16
\end{align*}
We want $\delta \geq 0$, so 
\begin{align*}
0 & \leq -16y^2 + 48y - 16\\
16y^2 - 48y + 16 & \leq 0\\
y^2 - 3y + 1 & \leq 0\\
y^2 - 3y & \leq -1\\
y^2 - 3y + \frac{9}{4} & \leq \frac{5}{4}\\
\left(y - \frac{3}{2}\right)^2 & \leq \frac{5}{4}\\
\left|y - \frac{3}{2}\right| & \leq \frac{\sqrt{5}}{2}
\end{align*}
Thus,
$$-\frac{\sqrt{5}}{2} \leq y - \frac{3}{2} \leq \frac{\sqrt{5}}{2} \implies \frac{3 - \sqrt{5}}{2} \leq y \leq \frac{3 + \sqrt{5}}{2}$$
so the range of the function is 
$$\left[\frac{3 - \sqrt{5}}{2}, \frac{3 + \sqrt{5}}{2}\right]$$
</s>