How to solve without solving by inspection? $\frac{x+5}{x+k}=\frac{-kx+5}{x-1}$ Background: This is from a test review on functions. The original problem was

Find the value of $k$ so that the function $f(x) = \frac{x+5}{x+k}$ will be its own inverse.

I found the answer by inspection, and then tried to solve it through more rigorous means. Continuing from the question title, I cross multiplied and used the quadratic formula on $k.$
$x^2+4x-5=5x+5k-kx^2-k^2x$
$k^2x+k(x^2-5)+(x^2-x-5)=0$
$k = \frac{-x+5\pm\sqrt{x^4-10x^2+25-4x(x^2-x-5)}}{2x}$
$k = \frac{-x+5\pm\sqrt{x^4-4x^3-6x^2+20x+25}}{2x}$
This is where I got stuck. Any ideas?

You want to have $f(f(x))=x$, that becomes
$$
x=\frac{f(x)+5}{f(x)+k}
$$
that is,
$$
xf(x)+kx=f(x)+5
$$
or
$$
f(x)=\frac{-kx+5}{x-1}
$$
Now let's try $f(0)$; according to the definition we have
$$
f(0)=\frac{0+5}{0+k}=\frac{5}{k}
$$
and the condition about the inverse gives
$$
f(0)=\frac{0+5}{0-1}=-5
$$
from which we obtain the necessary condition $k=-1$. Now substitute to check the necessary condition is also sufficient.
