# Stuck at showing that $g_*f_* = (gf)_*$

Let $X,Y,Z$ be topological spaces and $f : X \rightarrow Y , g: Y \rightarrow Z$ be continuous functions. Consider $Sh(X) ,Sh(Y),Sh(Z)$ to be the set of sheaves over $X,Y,Z$ respectively.

Now we define the direct image sheaf maps $$f_* : Sh(X) \rightarrow Sh(Y)$$ $$g_* : Sh(Y) \rightarrow Sh(Z)$$

I need to prove that

$$g_*f_* = (gf)_*$$

So I tried following - Let $U \subseteq Y$ be an open subset. Since we know by the definition of direct image that $$f_* A(U) : = A(f^{-1}(U))$$ where $A$ is a sheaf on $X$. So, $$g_*(f_* A(U)) = A(g^{-1}(f^{-1}(U))) = g_*f_*$$

And $$(gf)_*A(U) = A((gf)^{-1}(U)) = A(f^{-1}(g^{-1}(U))) = (gf)_*$$

Here I am unable to justify from above statements that $g_*f_* = (gf)_*$ . I don't see why $g^{-1}(f^{-1}(U)) = f^{-1}(g^{-1}(U))$.

Can someone help me in completing this proof!

You pushforward sheaf structure $A,$ not $A(U).$ So $$[g_*(f_*A)](U)=(f_*A)(g^{-1}(U))=A(f^{-1}g^{-1}(U)).$$