Determining whether two functions are inverses of each other