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?

Start by swapping the variables:
$$y=f(x)=\frac{x+5}{x+k}\implies x=\frac{y+5}{y+k}$$
and solving for $y$ from here:
$$\begin{align*}
x&=\frac{y+5}{y+k}\\[1ex]
xy+kx&=y+5\\[1ex]
xy-y&=5-kx\\[1ex]
y(x-1)&=5-kx\\[1ex]
y&=\frac{5-kx}{x-1}
\end{align*}$$
