In the mathematics of binary relations, the **composition relations** is a concept of forming a new relation *S* ∘ *R* from two given relations *R* and *S*. The composition of relations is called **relative multiplication**^{[1]} in the calculus of relations. The composition is then the **relative product** 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* ).

Beginning with Augustus De Morgan,^{[2]} the traditional form of reasoning with by syllogism has been subsumed by relational logical expressions and their composition.^{[3]}

## Contents

## Definition

If and are two binary relations, then their composition is the relation

In other words, is defined by the rule that says if and only if there is an element such that (i.e. and ).

In particular fields, authors might denote by *R* ∘ *S* what is defined here to be *S* ∘ *R*.
The convention chosen here is such that function composition (with the usual notation) is obtained as a special case, when *R* and *S* are functional relations. Some authors^{[4]} prefer to write and 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: is used to denote the traditional (right) composition, but ⨾ ; (a fat open semicolon with Unicode code point U+2A3E) denotes left composition.^{[5]}^{[6]} This use of semicolon coincides with the notation for function composition used (mostly by computer scientists) in category theory,^{[7]} as well as the notation for dynamic conjunction within linguistic dynamic semantics.^{[8]} The semicolon notation (with this semantic) was introduced by Ernst Schröder in 1895.^{[9]}

The binary relations are sometimes regarded as the morphisms 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. A generalization of this is found in the theory of allegories.

## Properties

- Composition of relations is associative.
- The converse relation of
*S*∘*R*is (*S*∘*R*)^{T}=*R*^{T}∘*S*^{T}. 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*S*∘*R*is injective, which conversely implies only the injectivity of*R*. - If
*R*and*S*are surjective, then*S*∘*R*is surjective, which conversely implies only the surjectivity of*S*. - 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 homogeneous 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."^{[10]}

## Heterogeneous relations

Consider a heterogeneous relation *R* ⊆ *A* × *B*. Then using composition of relation *R* with its converse *R*^{T}, there are homogeneous relations *R R*^{T} (on *A*) and *R*^{T} *R* (on *B*).

If ∀*x* ∈ *A* ∃*b* ∈ B *aRb* (*R* is a total relation), then ∀*x* *xRR*^{T}*x* so that *R R*^{T} is a reflexive relation or I ⊆ *R R*^{T} where I is the identity relation {*x*I*x* : *x* ∈ *A*}. Similarly, if *R* is a surjective relation then

*R*^{T}*R*⊇ I = {*x*I*x*:*x*∈*B*}. In this case*R*⊆*R R*^{T}*R*. The opposite inclusion occurs for a difunctional relation.

The composition is used to distinguish relations of Ferrer's type, which satisfy

### Example

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

- Using the converse relation
*R*^{T}, two questions can be answered: "Is there a translator?" has answer the universal relation on*B*. The international question, "Does he speak my language?" is answered by This symmetric matrix, representing a homogeneous relation on*A*, is associated with the star graph S_{3}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:
In the calculus of relations^{[11]} it is common to represent the complement of a set by an overbar:

If *S* is a binary relation, let represent the converse relation, also called the *transpose*. Then the Schröder rules are

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.^{[12]}

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.^{[3]} He wrote

^{[13]}

With Schröder rules and complementation one can solve for an unknown relation *X* in relation inclusions such as

For instance, by Schröder rule and complementation gives 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:
- Right residual:
- Symmetric quotient:

Using Schröder's rules, *AX* ⊆ *B* is equivalent to *X* ⊆ *A*\*B*. Thus the left residual is the greatest relation satisfying *AX* ⊆ *B*. Similarly, the inclusion *YC* ⊆ *D* is equivalent to *Y* ⊆ *D*/*C*, and the right residual is the greatest relation satisfying *YC* ⊆ *D*.^{[14]}

## 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).

## See also

## Notes

**^**Bjarni Jónssen (1984) "Maximal Algebras of Binary Relations", in*Contributions to Group Theory*, K.I. Appel editor American Mathematical Society ISBN 978-0-8218-5035-0**^**A. De Morgan (1860) "On the Syllogism: IV and on the Logic of Relations"- ^
^{a}^{b}Daniel D. Merrill (1990)*Augustus De Morgan and the Logic of Relations*, page 121, Kluwer Academic ISBN 9789400920477 **^**Kilp, Knauer & Mikhalev, p. 7**^**ISO/IEC 13568:2002(E), p. 23**^**Unicode character: Z Notation relational composition from FileFormat.info**^**Michael Barr & Charles Wells (1998) Category Theory for Computer Scientists, page 6, from McGill University**^**Rick Nouwen and others (2016) Dynamic Semantics §2.2, from Stanford Encyclopedia of Philosophy**^**Paul Taylor (1999).*Practical Foundations of Mathematics*. Cambridge University Press. p. 24. ISBN 978-0-521-63107-5. A free HTML version of the book is available at http://www.cs.man.ac.uk/~pt/Practical_Foundations/**^**Irving Copilowish (December 1948) "Matrix development of the calculus of relations", Journal of Symbolic Logic 13(4): 193–203 Jstor link, quote from page 203**^**Vaughn Pratt The Origins of the Calculus of Relations, from Stanford University**^**Gunther Schmidt & Thomas Ströhlein (1993)*Relations and Graphs*, pages 15 to 19, Springer books**^**De Morgan indicated contraries by lower case, conversion as M^{−1}, and inclusion with )), so his notation was**^**Gunther Schmidt (2011)*Relational Mathematics*, pages 43 to 6, Encyclopedia of Mathematics and its Applications, vol. 132, Cambridge University Press ISBN 978-0-521-76268-7

## References

- M. Kilp, U. Knauer, A.V. Mikhalev (2000)
*Monoids, Acts and Categories with Applications to Wreath Products and Graphs*, De Gruyter Expositions in Mathematics vol. 29, Walter de Gruyter,ISBN 3-11-015248-7.