Finding Inverses Using Composition of Functions

To verify that two functions, f(x) and g(x) are inverses, is it absolutely necessary to do BOTH f(g(x)) and g(f(x)) and show that they are both equal to x?

I was pretty sure I was taught that it was necessary to do both, but I've never seen one of the two compositions work out to equal x and the other work out to be something else.

If it IS necessary to do both, can someone provide an f(x) and g(x) where the composition equals x in one "direction" and something else in the other?

Just curious.