The function you show, y = -3x+1/x-5, is -- clearly not what you want.
The function you want is y = (-3x+1)/(x-5), which is
One standard way of finding the inverse of a given function is to switch the x and y and solve for the new y:
[gather all the terms with y on one side]
The inverse is
If you see problems like this often involving inverses of functions like this, note there is a pattern you can use to write the inverse without going through the algebra to find it.
Look at the original function and it inverse:
and
The coefficient of x in the numerator and the constant in the denominator switch places and change sign; the constant in the numerator and the coefficient of x in the denominator remain unchanged.