<s>[INST] If $f(x)=\frac {x^ 2 -2x +4}{ x^ 2 +2x+4}$ for $x \in \mathbb{R}$, prove that the range of $f(x)$ is $[1/3, 3]$ One method to solve it would by putting $y = f(x)$ then multiplying the denominator with $y$ hence making a quadratic equation in x then we can just use the inequalities for $x$ being real to prove it.
For an alternative what I did is
$y = \frac{x^2 + 2x + 4}{x^2 - 2x + 4}$
Then$ \frac{1+y}{1-y} =\frac{x^2+4}{2x} $
Therefore$ \frac{1+y}{1-y} = {x/2+2/x}$
If we go further putting rhs range to lhs the answer gets altered . Is this method wrong if so why if not where did the process go wrong.
 [/INST] Function range definition : The set value of the dependent  variable for which a function is defined.
Rewrite the equation given above as :
$$\frac{x^2-2x+4}{x^2+2x+4}=y$$
Multiply both sides by $x^2+2x+4$ :
$$\frac{x^2-2x+4}{x^2+2x+4}\left(x^2+2x+4\right)=y\left(x^2+2x+4\right)$$
Simplify :
$$x^2-2x+4=y\left(x^2+2x+4\right)$$
The range is a set of y for which the discriminant is greater or equal to zero :
$$x^2-2x+4=y\left(x^2+2x+4\right)$$
Expand the $y\left(x^2+2x+4\right)$ :
$$x^2-2x+4=x^2y+2xy+4y$$
Simplify to polynomial of $x$ :
$$\left(1-y\right)x^2-\left(2+2y\right)x+4-4y=0$$
For a quadratic equation of the form $ax^2+bx+c=0$, the discriminant is $b^2-4ac$. For :
$$a=1-y$$
$$b=-2-2y$$
$$c=4-4y$$
This becomes :
$$b^2-4ac$$
$$\left(-2-2y\right)^2-4\left(1-y\right)\left(4-4y\right)$$
Expand and simplify :
$$-12y^2+40y-12$$
Then :
$$-12y^2+40y-12\ge \:0$$
$$-3y^2+10y-3\ge \:0$$
$$-\left(3y-1\right)\left(y-3\right)\ge \:0$$
Multiply both side by $-1$ (reverse the inequality) :
$$\left(-\left(3y-1\right)\left(y-3\right)\right)\left(-1\right)\le \:0\cdot \left(-1\right)$$
Simplify :
$$\left(3y-1\right)\left(y-3\right)\le \:0$$
Identify the intervals and we will get :
$$\frac{1}{3}\le \:y\le \:3$$
$$ $$
Check if the range interval endpoints are included or not.
Take the point of $y=\frac{1}{3}$ and plug it into $\frac{x^2-2x+4}{x^2+2x+4}=y$ and we will get $x=2$.
Thus the solution exists for $y=\frac{1}{3}$. Therefore $y=\frac{1}{3}$ is included in the range.
Take the point of $y=3$ and plug it into $\frac{x^2-2x+4}{x^2+2x+4}=y$ and we will get $x=-2$.
Thus the solution exists for $y=3$. Therefore $y=3$ is included in the range.
$$ $$
Therefore, the range is :
$$\frac{1}{3}\le \:f\left(x\right)\le \:3$$
</s>