Relative Homotopy is Equivalence Relation

Theorem
Let $X$ and $Y$ be topological spaces.

Let $K \subseteq X$ be a (possibly empty) subset of $X$.

Let $\mathcal C(X,Y)$ be the set of all continuous mappings from $X$ to $Y$.

Define a relation $\sim$ on $\mathcal C(X,Y)$ by $f \sim g$ if $f$ and $g$ are homotopic relative to $K$.

Then $\sim$ is an equivalence relation.

Proof
We examine each condition for equivalence.

Reflexivity
For any function $f:X \to Y$, define $H:X\times [0,1] \to Y$ as $H(x,t)=f(x)$.

This yields a homotopy between $f$ and itself.

Thus $\sim$ is a reflexive relation.

Symmetry
Given a homotopy:
 * $H: X \times [0,1] \to Y$ from $f(x)=H(x,0)$ to $g(x)=H(x,1)$

the function:
 * $G(x,t)=H(x,1-t)$

is a homotopy from $g$ to $f$.

Thus $\sim$ is a symmetric relation.

Transitivity
Suppose that $f \sim g$ and $g \sim h$.

Let $F,G: X \times [0,1] \to Y$ be the homotopies between $f$ and $g$, $g$ and $h$ respectively.

Define $H : X \times [0,1] \to Y$ by
 * $H(t,x) = F(2t,x)$, $0 \leq t \leq 1/2$
 * $H(t,x) = G(2t - 1,x)$, $1/2 \leq t \leq 1$

then $H$ is a homotopy between $f$ and $h$.

Thus $\sim$ is a transitive relation.