How to show $(gf)^{-1} = f^{-1}g^{-1}$? 
Suppose that $f:A\rightarrow B$ and $g:B \rightarrow C$ are both one-to-one and onto. Prove that $gf$ is one-to-one and onto. Prove further that $(gf)^{-1} = f^{-1}g^{-1}$.

I have already proven the first part, but the second part has always puzzled me. I have tried assuming $x \in (gf)^{-1}$ but that doesn't lead to nowhere. Nor does $x \in (gf)^{-1}(t)$ and showing $x = t$. How to prove?
 A: The definition of the inverse is that $h \circ h^{-1} = \operatorname{id}$ and $h^{-1} \circ h = \operatorname{id}$, where $\operatorname{id}$ is the identity function.
Showing that $(gf)^{-1} = f^{-1}g^{-1}$ is equivalent to showing
$$g \circ f \circ f^{-1} \circ g^{-1} = \operatorname{id}$$
$$ f^{-1} \circ g^{-1} \circ g \circ f= \operatorname{id}$$
Can you do this?
A: $\newcommand{\imp}{\quad\Longrightarrow\quad}$
$$
\left(\rm gf\right)^{-1}\left(y\right) = x
\imp
y = \left(\rm gf\right)\left(x\right) = {\rm g}\left({\rm f}\left(x\right)\right)
\imp
{\rm f}\left(x\right)
=
\left(\rm g\right)^{-1}\left(y\right)
$$
$$
\imp
x
=
\left(\rm f\right)^{-1}\left(\left(\rm g\right)^{-1}\left(y\right)\right)
=
\left(\left(\rm f\right)^{-1}\left(\rm g\right)^{-1}\right)\left(y\right)
$$
$$\color{#ff0000}{\large%
\left(\rm gf\right)^{-1}\left(y\right)
= 
\left(\left(\rm f\right)^{-1}\left(\rm g\right)^{-1}\right)\left(y\right)}
$$
A: $(fg) x = f(g(x))$. $(fg)^{-1} (fg) x = (fg)^{-1} f(g(x))$. If you want to get back to $x$, what function do you first have to apply to $f(g(x))$? What function do you have to apply next?
