start with your equation.
y=x^2-x-2
switch x and y*, then move all y terms to one side and anything else to the other side.
x=y^2-y-2
x+2=y^2-y
now, solve for y by completing the square.
x+2=(y^2-y+1/4)-1/4 rarr you subtract 1/4 to keep the equation equal
x+2=(y-1/2)^2-1/4 rarr simplify(y^2-y+1/4)
x+9/4=(y-1/2)^2 rarr add 1/4 to both sides to keep it equal
+-sqrt(x+9/4)=y-1/2 rarr remember to ALWAYS have the positive and negative sign when square rooting any terms
y=1/2+-sqrt(x+9/4) rarr add 1/2 to both sides to keep it equal
*You switch x and y because when you find the inverse, you are finding the equation of the graph flipped over the line y=x. This line is also on the graph linked below.
**However, since this function is not one-to-one (each y-value only has one possible x-value), there is technically no real inverse function.
All equations on a graph:
Desmos