Functoriality in $f$ of the inverse image $f^{-1}\mathscr{F}$ presheaf Let $f:X\to Y$ and $g:Y\to Z$ be continuous maps between topological spaces and $\mathscr{H}$ be a presheaf on $Z$. For now, lets define the presheaf inverse image $g^{-1}\mathscr{H}$ as
$$\Gamma(V,g^{-1}\mathscr{H}):=\operatorname*{colim}_{g(V)\subset W}\mathscr{H}(W).$$
I want to prove $f^{-1}\circ g^{-1}=(g\circ f)^{-1}$ as functors. In other words, I want to show that $f^{-1}(g^{-1}\mathscr{H})=(g\circ f)^{-1}\mathscr{H}$ and that, if $\varphi:\mathscr{H}_1\to\mathscr{H}_2$ is a morphism of presheaves, $f^{-1}(g^{-1}\varphi)=(g\circ f)^{-1}\varphi$.
As for the first statement, it boils down to proving that
$$\operatorname*{colim}_{g(f(U))\subset W}\mathscr{H}(W)=\operatorname*{colim}_{f(U)\subset V}\operatorname*{colim}_{g(V)\subset W}\mathscr{H}(W).$$
I think this follows from the fact that an open set $W\subset Z$ contains $g(f(U))$ if and only if it contains a subset of the form $g(V)$, where $V\subset Y$ is an open set containing $f(U)$. But it is not clear to me.
As for the second statement, I have no idea about how to prove it.
 A: This is another proof of the isomorphism $(g\circ f)^{-1}=f^{-1}\circ g^{-1}$, hence not really answer of the original question, but this was requested in the comments.
You have an adjunction $\operatorname{Hom}_{PSh(X)}(f^{-1}\mathcal{F},\mathcal{G})=\operatorname{Hom}_{PSh(Y)}(\mathcal{F},f_*\mathcal{G})$ and an isomorphism of functor (in fact a true equality here) $(g\circ f)_*=g_*\circ f_*$. Using this, we have :
$$\begin{align*}
\operatorname{Hom}_{PSh(X)}((g\circ f)^{-1}\mathcal{F},\mathcal{G})&=\operatorname{Hom}_{PSh(Z)}(\mathcal{F},(g\circ f)_*\mathcal{G})\\
&=\operatorname{Hom}_{PSh(Z)}(\mathcal{F},g_*f_*\mathcal{G})\\
&=\operatorname{Hom}_{PSh(Y)}(g^{-1}\mathcal{F},g_*f_*\mathcal{G})\\
&=\operatorname{Hom}_{PSh(X)}(f^{-1}g^{-1}\mathcal{F},\mathcal{G})\\
\end{align*}
$$
This is natural in $\mathcal{F}$ and $\mathcal{G}$, hence by Yoneda, we have an isomorphism $(g\circ f)^{-1}\mathcal{F}\simeq f^{-1}g^{-1}\mathcal{F}$. Since this is natural in $\mathcal{F}$, we have an isomorphism of functors $(g\circ f)^{-1}\simeq f^{-1}g^{-1}$.
A: As you correctly pointed out, the first part is indeed a purely topological problem – given $W \supset (g \circ f)(U)$, $V=g^{-1}(W)$ should work. So this means that your colimits are essentially over the same set of indices so they’re canonically equal.
For the second part, you should just note that if $\phi: \mathcal{F} \rightarrow \mathcal{G}$, then $(g^{-1}\phi)(V) : (g^{-1}\mathcal{F})(V) \rightarrow (g^{-1}\mathcal{G})(V)$ is the colimit of the $\phi(W): \mathcal{F}(W) \rightarrow \mathcal{G}(W)$ over the $W \supset g(V)$. Then it really is (admittedly painful) abstract nonsense.
A: This is not really an answer to my question, which has already great answers but my attempt to proving the adjunction in the case of presheaves, as discussed in the comments.


