Construction of a relative cup product $H^p(X, A) \otimes H^q(X, B) \to H^{p + q}(X, A \cup B)$ Let $A$ and $B$ be subspaces of a space $X$. What is the construction of a relative cup product$$H^p(X, A) \otimes H^q(X, B) \to H^{p + q}(X, A \cup B)?$$Here, we take cohomology with coefficients in a commutative ring $R$ and we write $\otimes$ for $\otimes_R$.

The construction is not completely immediate because the map on cochains defining the cup-product $\smile : C^k(X) \otimes C^l(X) \to C^{k+l}(X)$ doesn't directly map $C^k(X,A) \otimes C^l(X,B)$ to $C^{k+l}(X, A \cup B)$. However if you look at the definition:
$$(\varphi \smile \psi)(\sigma) = \varphi(\sigma_{\mid[v_0, \dots, v_k]}) \cdot \psi(\sigma_{\mid[v_k, \dots, v_{k+l}]}),$$
you see that if $\varphi \in C^k(X,A)$ (i.e. $\varphi$ vanishes on simplices fully contained in $A$) and $\psi \in C^l(X,B)$, then $\varphi \smile \psi$ vanishes both on simplices contained in $A$ and on simplices contained in $B$ (because $0 \cdot x = 0 = x \cdot 0$). So $\smile$ restricts to a map
$$\smile : C^k(X,A) \otimes C^l(X,B) \to C^{k+l}(X, A + B) := \hom_R(C_{k+l}(X) / (C_{k+l}(A) + C_{k+l}(B)), R),$$
i.e. $\varphi \smile \psi$ vanishes on simplices that are either fully contained in $A$ or in $B$ (or both), and thus their sums.
Now there is an inclusion map $C^{k+l}(X, A \cup B) \subset C^{k+l}(X, A + B)$ (because if a cochain vanishes on simplices contained in $A \cup B$, it vanishes on simplices contained in $A$ and on simplices contained in $B$). Moreover if both $A$ and $B$ are open, this inclusion map induces an isomorphism in cohomology by the five-lemma (you need to use excision here, for more details cf. Hatcher, Algebraic Topology, p. 209). So the cup-product finally gives a map in cohomology:
$$\smile : H^k(X,A) \otimes H^l(X,B) \to H^{k+l}(X, A \cup B).$$
