Finding Inverse of a function