# Composition of relations

(Redirected from Relation composition)

In the mathematics of binary relations, the composition relations is a concept of forming a new relation R ; S from two given relations R and S. The composition of relations is called relative multiplication in the calculus of relations. The composition is then the relative product:40 of the factor relations. Composition of functions is a special case of composition of relations.

The words uncle and aunt indicate a compound relation: for a person to be an uncle, he must be a brother of a parent (or a sister for an aunt). In algebraic logic it is said that the relation of Uncle ( xUz ) is the composition of relations "is a brother of" ( xBy ) and "is a parent of" ( yPz ).

$U=BP\quad \equiv \quad xByPz\iff xUz.$ Beginning with Augustus De Morgan, the traditional form of reasoning with by syllogism has been subsumed by relational logical expressions and their composition.

## Definition

If $R\subseteq X\times Y$ and $S\subseteq Y\times Z$ are two binary relations, then their composition $R;S$ is the relation

$R;S=\{(x,z)\in X\times Z\mid \exists y\in Y:(x,y)\in R\land (y,z)\in S\}.$ In other words, $R;S\subseteq X\times Z$ is defined by the rule that says $(x,z)\in R;S$ if and only if there is an element $y\in Y$ such that $x\,R\,y\,S\,z$ (i.e. $(x,y)\in R$ and $(y,z)\in S$ ).:13

### Notational variations

The semicolon as an infix notation for composition of relations dates back to Ernst Schroder's textbook of 1895. Gunther Schmidt has renewed the use of the semicolon, particularly in Relational Mathematics (2011).:40 The use of semicolon coincides with the notation for function composition used (mostly by computer scientists) in category theory, as well as the notation for dynamic conjunction within linguistic dynamic semantics.

A small circle $(R\circ S)$ has been used for the infix notation of composition of relations by John M. Howie in his books considering semigroups of relations. However, the small circle is widely used to represent composition of functions $g(f(x))\ =\ (g\circ f)(x)$ which reverses the text sequence from the operation sequence. The small circle was used in the introductory pages of Graphs and Relations:18 until it was dropped in favor of juxtaposition (no infix notation). Juxtaposition is commonly used in algebra to signify multiplication, so too, it can signify relative multiplication.

Further with the circle notation, subscripts may be used. Some authors prefer to write $\circ _{l}$ and $\circ _{r}$ explicitly when necessary, depending whether the left or the right relation is the first one applied. A further variation encountered in computer science is the Z notation: $\circ$ is used to denote the traditional (right) composition, but ⨾ ; (a fat open semicolon with Unicode code point U+2A3E) denotes left composition.

The binary relations $R\subseteq X\times Y$ are sometimes regarded as the morphisms $R\colon X\to Y$ in a category Rel which has the sets as objects. In Rel, composition of morphisms is exactly composition of relations as defined above. The category Set of sets is a subcategory of Rel that has the same objects but fewer morphisms.

## Properties

• Composition of relations is associative: $R;(S;T)\ =\ (R;S);T.$ • The converse relation of R ; S is (R ; S)T = ST ; RT. This property makes the set of all binary relations on a set a semigroup with involution.
• The composition of (partial) functions (i.e. functional relations) is again a (partial) function.
• If R and S are injective, then R ; S is injective, which conversely implies only the injectivity of S.
• If R and S are surjective, then R ; S is surjective, which conversely implies only the surjectivity of R.
• The set of binary relations on a set X (i.e. relations from X to X) together with (left or right) relation composition forms a monoid with zero, where the identity map on X is the neutral element, and the empty set is the zero element.

## Composition in terms of matrices

Finite binary relations are represented by logical matrices. The entries of these matrices are either zero or one, depending on whether the relation represented is false or true for the row and column corresponding to compared objects. Working with such matrices involves the Boolean arithmetic with 1 + 1 = 1 and 1 × 1 = 1. An entry in the matrix product of two logical matrices will be 1, then, only if the row and column multiplied have a corresponding 1. Thus the logical matrix of a composition of relations can be found by computing the matrix product of the matrices representing the factors of the composition. "Matrices constitute a method for computing the conclusions traditionally drawn by means of hypothetical syllogisms and sorites."

## Heterogeneous relations

Consider a heterogeneous relation RA × B. Then using composition of relation R with its converse RT, there are homogeneous relations R RT (on A) and RT R (on B).

If ∀xAb ∈ B aRb (R is a total relation), then ∀x xRRTx so that R RT is a reflexive relation or I ⊆ R RT where I is the identity relation {xIx : xA}. Similarly, if R is a surjective relation then

RT R ⊇ I = {xIx : xB}. In this case RR RT R. The opposite inclusion occurs for a difunctional relation.

The composition ${\bar {R}}^{T}R$ is used to distinguish relations of Ferrer's type, which satisfy $R{\bar {R}}^{T}R=R.$ ### Example Composition of R with RT produces the relation with this graph, Switzerland connected to the other countries (loops not shown).

Let A = { France, Germany, Italy, Switzerland } and B = { French, German, Italian } with the relation R given by aRb when b is a national language of a. The logical matrix for R is given by

${\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\\1&1&1\end{pmatrix}}.$ Using the converse relation RT, two questions can be answered: "Is there a translator?" has answer $R^{T}R=B\times B,$ the universal relation on B. The international question, "Does he speak my language?" is answered by $RR^{T}={\begin{pmatrix}1&0&0&1\\0&1&0&1\\0&0&1&1\\1&1&1&1\end{pmatrix}}.$ This symmetric matrix, representing a homogeneous relation on A, is associated with the star graph S3 augmented by a loop at each node.

## Schröder rules

For a given set V, the collection of all binary relations on V forms a Boolean lattice ordered by inclusion (⊆). Recall that complementation reverses inclusion: $A\subset B\implies B^{\complement }\subseteq A^{\complement }.$ In the calculus of relations it is common to represent the complement of a set by an overbar: ${\bar {A}}=A^{\complement }.$ If S is a binary relation, let $S^{T}$ represent the converse relation, also called the transpose. Then the Schröder rules are

$QR\subseteq S\quad \equiv \quad Q^{T}{\bar {S}}\subseteq {\bar {R}}\quad \equiv \quad {\bar {S}}R^{T}\subseteq {\bar {Q}}.$ Verbally, one equivalence can be obtained from another: select the first or second factor and transpose it; then complement the other two relations and permute them.:15-19

Though this transformation of an inclusion of a composition of relations was detailed by Ernst Schröder, in fact Augustus De Morgan first articulated the transformation as Theorem K in 1860. He wrote

$LM\subseteq N\implies {\bar {N}}M^{T}\subseteq {\bar {L}}.$ With Schröder rules and complementation one can solve for an unknown relation X in relation inclusions such as

$RX\subseteq S\quad {\text{and}}\quad XR\subseteq S.$ For instance, by Schröder rule $RX\subseteq S\implies R^{T}{\bar {S}}\subseteq {\bar {X}},$ and complementation gives $X\subseteq {\overline {R^{T}{\bar {S}}}},$ which is called the right residual of S by R .

## Quotients

Just as composition of relations is a type of multiplication resulting in a product, so some compositions compare to division and produce quotients. Three quotients are exhibited here: left residual, right residual, and symmetric quotient. The left residual of two relations is defined presuming that they have the same domain (source), and the right residual presumes the same codomain (range, target). The symmetric quotient presumes two relations share a domain.

Definitions:

• Left residual: $A\backslash B\ =\ {\overline {A^{T}{\bar {B}}}}$ • Right residual: $D/C\ =\ {\overline {{\bar {D}}C^{T}}}$ • Symmetric quotient: $\operatorname {syq} (E,F)={\overline {E^{T}{\bar {F}}}}\cap {\overline {{\bar {E}}^{T}F}}$ Using Schröder's rules, AXB is equivalent to XA\B. Thus the left residual is the greatest relation satisfying AXB. Similarly, the inclusion YCD is equivalent to YD/C, and the right residual is the greatest relation satisfying YCD.:43-6

## Join: another form of composition

Other forms of composition of relations, which apply to general n-place relations instead of binary relations, are found in the join operation of relational algebra. The usual composition of two binary relations as defined here can be obtained by taking their join, leading to a ternary relation, followed by a projection that removes the middle component. For example, in the query language SQL there is the operation Join (SQL).