For a function to have an inverse, it needs to have one $x$ for every $y$, and vice versa. You can use the horizontal line test to verify that the inverse of a function is valid. If you can draw a horizontal line and it crosses through two points at the same time at any height, the inverse is not a valid function. To get the inverse, you can switch the x and y of a function, and it will mirror the graph over the line $y = x$.