Solution (source code)

= Solution

The two components of a <disjoint union> are open and closed. Restriction therefore gives an isomorphism
$$
\Omega^p(M)\longrightarrow\Omega^p(U)\oplus\Omega^p(V),\qquad \omega\longmapsto(\omega|_U,\omega|_V).
$$
Its inverse assigns the first form on $U$ and the second on $V$; it is smooth because there are no overlaps on which compatibility must be imposed. The <exterior derivative> is local, so this is an isomorphism of cochain complexes.

A form on $M$ is a <closed differential form> exactly when both restrictions are closed. It is an <exact differential form> exactly when both restrictions are exact: primitives on $U$ and $V$ join into a global primitive. Taking the quotient therefore yields the <de Rham cohomology of a finite disjoint union>:
$$
\boxed{H^p_{\mathrm{dR}}(U\sqcup V)\cong H^p_{\mathrm{dR}}(U)\oplus H^p_{\mathrm{dR}}(V)\qquad(p\ge0).}
$$
The same argument covers degree zero, with the space of degree-minus-one forms taken to be zero.