I am trying to compute the upper and lower bounds of $f(x) = \frac{2x-1}{x+2}$ for $x\in[-1,2]$.
My first though was to compute the range of the numerator and denominator and then take the intersection for the final result. So given $f(x) = \frac{2x-1}{x+2} = \frac{g(x)}{h(x)}$ for $x\in[-1,2]$ we may have.
- For $g(x)$ we have $-1\leq x \leq 2 \iff -3 \leq g(x) \leq 3$
- For $h(x)$ we have $-1\leq x \leq 2 \iff 1 \leq x+2 \leq 4 \iff 1 \geq \frac{1}{x+2} \geq \frac{1}{4} \iff \frac{1}{4} \leq g(x) \leq 1$.
Thus, $\frac{1}{4} \leq f(x) \leq 1$. However, following a different approach, we may compute $x=f^{-1}(y)$ and using $x\in[-1,2]$ we may conclude that $f(x)\in [-3, 2) \cup (2,\frac{3}{4}]$ and for $x\in[-1,2]$.
We have concluded in two different results. I know that the second one is correct but why following the first approach was incorrect. Could you please explain?
Thank you.
$$\frac{2x-1}{x+2}=\frac{2x+4-5}{x+2}=2-\frac{5}{x+2}.$$ Thus, since $-1\leq x\leq2$, we obtain: $$2-\frac{5}{-1+2}\leq2-\frac{5}{x+2}\leq2-\frac{5}{2+2}$$ or $$-3\leq\frac{2x-1}{x+2}\leq\frac{3}{4}$$