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} $$

\begin{align} 
y &= \frac{x}{x-2}
.
\end{align}
\begin{align} 
y&=\frac{x+2-2}{x+2}
,\\
y&=1-\frac 2{x+2}
,\\
y-1&=-\frac 2{x+2}
,\\
-\frac{y-1}2&=\frac 1{x+2}
,\\
x+2 &=\frac 2{1-y}
,\\
x &=\frac 2{1-y}-2;
,\\
x &=\frac{2\,y}{1-y}
,
\end{align} 
so the answer is indeed
\begin{align} 
f^{-1}(x)=\frac{2x}{1-x}
.
\end{align} 
