<s>[INST] How do I get the inverse of this equation? The equation is the following:
$$y = \frac{x}{x-2}$$
What I did is:
$$y = \frac{x}{x-2}$$
$$y \times (x-2) = x$$
$$\frac{x-2}{x} = \frac{1}{y}$$
$$\frac{x}{x}-\frac{2}{x} = \frac{1}{y}$$
$$1-\frac{2}{x} = \frac{1}{y}$$
$$1-\frac{x}{2} = y$$
I've got a lot of doubts about that last step. Besides that, the result according to the textbook is the following:
$$ f^{−1}(x)=-\frac{2x}{x−1} $$
 [/INST] A different approach is to note that
$$
y = \frac{x}{x-2} = \frac{(x-2)+2}{x-2} = 1+\frac{2}{x-2}
$$
Hence, $(x-2)(y-1) = 2$ and $x = \frac{2}{y-1}+2 = \frac{2y}{y-1}$.
</s>