Rather than use the #f^(-1)(x)# notation as inverse of #f(x)#,
I find it easier to define another function #g(x)# as the inverse of #f(x)#. This is easier to type and avoid the interpretation #f^(-1)(x)=1/(f(x))#. Fell free to replace all my #g(x)'s with #f^(-1)(x)#.
Let #g(x)# be the inverse of #f(x)#
By definition of inverse:
#color(white)("XXX")f(g(x))=x#
But given #f(x)=(x-1)/(x+2)# it follows that
#color(white)("XXX")f(g(x)) = (g(x)-1)/(g(x)+2)#
Therefore
#color(white)("XXX")(g(x)-1)/(g(x)+2) = x#
#color(white)("XXX")g(x)-1 = g(x)*x + 2x#
#color(white)("XXX")(g(x)-g(x)*x)=2x+1#
#color(white)("XXX")g(x)(1-x) = 2x+1#
#color(white)("XXX")g(x)= (2x+1)/(1-x)#