Lemma 20.28.2. Let $f : X \to Y$ and $g : Y \to Z$ be morphisms of ringed spaces. Then $Rg_* \circ Rf_* = R(g \circ f)_*$ as functors $D(\mathcal{O}_ X) \to D(\mathcal{O}_ Z)$.

Proof. By Lemma 20.28.1 we see that $Rg_* \circ Rf_*$ is adjoint to $Lf^* \circ Lg^*$. We have $Lf^* \circ Lg^* = L(g \circ f)^*$ by Lemma 20.27.2 and hence by uniqueness of adjoint functors we have $Rg_* \circ Rf_* = R(g \circ f)_*$. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).