<s>[INST] 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?
 [/INST] You are close but you went in the wrong direction.  Rearrange equation 2 as follows
$x^2(k+1) + x(k^2-1) -5k - 5 = 0$
Now factor out an $k+1$ and you get $(k+1)(x^2+x(k-1) - 5) = 0$.
Now this equation must be zero for any $x$ you pick so no value of $k$ will do that except $k=-1$
</s>