Matrix Multiplication Interpretation of Relation Composition

Theorem
Let $A$, $B$ and $C$ be finite non-empty sets that are initial segments of $\mathbb N_{\neq 0}$.

Let $\mathcal R \subseteq B \times A$ and $\mathcal S \subseteq C \times B$ be relations.

Let $\mathbf R$ and $\mathbf S$ be matrices which we define as follows:


 * $[r]_{ij} = \begin{cases}

T & : (i, j) \in \mathcal R \\ F & : (i, j) \notin \mathcal R\\ \end{cases}$


 * $[s]_{ij} = \begin{cases}

T & : (i, j) \in \mathcal S \\ F & : (i, j) \notin \mathcal S\\ \end{cases}$

Then we can interpret the matrix product $\mathbf R \mathbf S$ as the composition $\mathcal S \circ \mathcal R$.

To do so we temporarily consider $\left({\{T, F\}, \land, \lor}\right)$ to be our "ring" on which we are basing matrix multiplication.

Then:


 * $[rs]_{ij} = T \iff (i, j) \in \mathcal S \circ \mathcal R$

Sufficient Condition
Suppose for some $i, j$:


 * $[rs]_{ij} = T$

Then by the definition of $\lor$ there must exist some $k$ for which:


 * $[r]_{ik} \land [s]_{kj} = T$

Which by our definition implies:


 * $(i, k) \in \mathcal R$


 * $(k, j) \in \mathcal S$

Then by the definition of a composite relation:

$(i, j) \in \mathcal R \circ \mathcal S$

Necessary Condition
Suppose for some $i, j$:


 * $(i, j) \in \mathcal S \circ \mathcal R$

Then there exists a $k$ for which:


 * $(i, k) \in \mathcal R$


 * $(k, j) \in \mathcal S$

Hence:


 * $[r]_{ik} = T$


 * $[s]_{kj} = T$

and there exists some $k$ for which:


 * $[r]_{ik} \land [s]_{kj} = T$

Hence by the definition of $\lor$:


 * $[rs]_{ij} = T$

$\blacksquare$

Relation Theory