if both f and g have inverses then:
(f o g)^-1 = g^-1 o f^-1.
to see this, let's compose g^-1 o f^-1 with f o g:
(g^-1 o f^-1)o(f o g)(x) =
(g^-1 o f^-1)(f(g(x)) =
g^-1(f^-1(f(g(x)))) = g^-1(g(x)) = x
(to "undo" what f does to what g does to x,
undo what what f did to f(g(x))
(this is f^-1(f(g(x))), ok?), and then undo what g did to g(x),
(this is g^-1(g(x)) = x).).
perhaps a picture will make more sense:
x--->g(x) = y---> z = f(y) = f(g(x))
that is what f o g does.
so to undo it, we go backwards:
z-->y-->x
what takes z-->y? that is f^-1
what takes y-->x that is g^-1
do f^-1 first, and then g^-1, is g^-1(f^-1(z)) = g^-1 o f^-1(z)
since this undoes what f o g does, it must be (f o g)^-1.