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?

[I realized after posting that this observation is included in a previous answer.] The line $y=\lim_{x\to\infty}f(x)=1$ is a horizontal asymptote of the graph of $y=f(x)=\frac{x+5}{x+k}$. Therefore $x=1$ is a vertical asymptote of the graph of $y=f^{-1}(x)=f(x)$, which can only happen if $k=-1$. A bit of algebra verifies that the one possible answer, $f(x)= \frac{x+5}{x-1}$, is in fact its own inverse.
