I was thinking about how to find the inverse of a composite function.
I referred to several great answers on this site on others' questions and they all pointed out that to take the inverse of a composite function is the same as inversing all the functions that constitute it.
However every question and answer dealt with a certain example to verify this.
However I still couldn't form an intuitive idea in my head about why this could be the case.
It would help if someone explains (Either Diagrammatically or otherwise) the intuition behind this, at least for a 2 function composition $(f\circ g)(x)$.
Inverse means the inverse function.
Let's assume the composition $F=f\circ g$, $F(z)=f(g(z))$, and let's set $y=F(z)$.
$F$ has an inverse iff $F$ is bijective.
If $F$ is bijective, both $f$ and $g$ are bijective. Proving this is a usual exercise for math students.
The following two equations hold for the inverse of a bijective function $f\colon z\mapsto f(z)$:
$$f(f^{-1}(z))=z,\ \ f^{-1}(f(z))=z.$$
That's because the inverse is the right-inverse and the left-inverse.
We have:
$$f(g(z))=y$$
We apply the inverses of $f$ and $g$ from the left.
$$g(z)=f^{-1}(y)$$
$$z=g^{-1}(f^{-1}(y))$$
Means:
$$F^{-1}=g^{-1}\circ f^{-1}.$$
The inverse of a bijective composition is the composition of the inverses of the components in the opposite order.
graphically:
$$z\stackrel{g}{\longrightarrow}g(z)\stackrel{f}{\longrightarrow}f(g(z))$$
$$z\stackrel{g^{-1}}{\longleftarrow}g(z)\stackrel{f^{-1}}{\longleftarrow}f(g(z))$$