# If g o f = idA and f o g = idB, then g = f^-1 proof?

Hey guys,

I need to prove: Suppose A and B are sets, and f and g are functions with f: A -> B and g: B -> A. If g o f = idA and f o g = idB, then f is invertible and g = f^-1.

So far I have understood why g must be the inverse of f, but I do not know how to prove it.

Thanks!

## Answers and Replies

Take an arbitrary element a in A and b in B and show that they relate via composition of both functions.

Hint: f(a) = b, g(b) = a

Take an arbitrary element a in A and b in B and show that they relate via composition of both functions.

Okay, not really sure how to do that but here's my attempt:

Suppose g o f = idA,
then dom(g o f) = dom(idA) = A
and (g o f)(a) = g(f(a)) = idA(a) = a.

Suppose f o g = idB,
then dom(f o g) = dom(idB) = B
and (f o g)(b) = f(g(b)) = idB(b) = b.

A function is only invertible if it's 1 - 1 and onto. Is this the case? You didn't specify.

A function is only invertible if it's 1 - 1 and onto. Is this the case? You didn't specify.

So what I have is sufficient for g=f^-1? But first I need to show that f^-1 exists?