Hubbry Logo
Composition of relationsComposition of relationsMain
Open search
Composition of relations
Community hub
Composition of relations
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something
Composition of relations
Composition of relations
from Wikipedia

In the mathematics of binary relations, the composition of relations is the forming of a new binary relation R ; S from two given binary relations R and S. In the calculus of relations, the composition of relations is called relative multiplication,[1] and its result is called a relative product.[2]: 40  Function composition is the special case of composition of relations where all relations involved are functions.

The word uncle indicates a compound relation: for a person to be an uncle, he must be the brother of a parent. In algebraic logic it is said that the relation of Uncle () is the composition of relations "is a brother of" () and "is a parent of" ().

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

Definition

[edit]

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 (that is, and ).[5]: 13 

Notational variations

[edit]

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

A small circle has been used for the infix notation of composition of relations by John M. Howie in his books considering semigroups of relations.[10] However, the small circle is widely used to represent composition of functions , which reverses the text sequence from the operation sequence. The small circle was used in the introductory pages of Graphs and Relations[5]: 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[11] 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, while left composition is denoted by a fat semicolon. The unicode symbols are ⨾ and ⨟.[12][13]

Mathematical generalizations

[edit]

Binary relations are morphisms in the category . In Rel the objects are sets, the morphisms are binary relations and the composition of morphisms is exactly composition of relations as defined above. The category Set of sets and functions is a subcategory of where the maps are functions .

Given a regular category , its category of internal relations has the same objects as , but now the morphisms are given by subobjects in .[14] Formally, these are jointly monic spans between and . Categories of internal relations are allegories. In particular . Given a field (or more generally a principal ideal domain), the category of relations internal to matrices over , has morphisms the linear subspaces . The category of linear relations over the finite field is isomorphic to the phase-free qubit ZX-calculus modulo scalars.

Properties

[edit]
  • Composition of relations is associative:
  • The converse relation of is This property makes the set of all binary relations on a set a semigroup with involution.
  • The composition of (partial) functions (that is, functional relations) is again a (partial) function.
  • If and are injective, then is injective, which conversely implies only the injectivity of
  • If and are surjective, then is surjective, which conversely implies only the surjectivity of
  • The set of binary relations on a set (that is, relations from to ) together with (left or right) relation composition forms a monoid with zero, where the identity map on is the neutral element, and the empty set is the zero element.

Composition in terms of matrices

[edit]

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 and 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."[15]

Heterogeneous relations

[edit]

Consider a heterogeneous relation that is, where and are distinct sets. Then using composition of relation with its converse there are homogeneous relations (on ) and (on ).

If for all there exists some such that (that is, is a (left-)total relation), then for all so that is a reflexive relation or where I is the identity relation Similarly, if is a surjective relation then In this case The opposite inclusion occurs for a difunctional relation.

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

Example

[edit]

Let { France, Germany, Italy, Switzerland } and { French, German, Italian } with the relation given by when is a national language of Since both and is finite, can be represented by a logical matrix, assuming rows (top to bottom) and columns (left to right) are ordered alphabetically:

The converse relation corresponds to the transposed matrix, and the relation composition corresponds to the matrix product when summation is implemented by logical disjunction. It turns out that the matrix contains a 1 at every position, while the reversed matrix product computes as: This matrix is symmetric, and represents a homogeneous relation on

Correspondingly, is the universal relation on hence any two languages share a nation where they both are spoken (in fact: Switzerland). Vice versa, the question whether two given nations share a language can be answered using

Schröder rules

[edit]

For a given set the collection of all binary relations on forms a Boolean lattice ordered by inclusion Recall that complementation reverses inclusion: In the calculus of relations[16] it is common to represent the complement of a set by an overbar:

If 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.[5]: 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.[4] He wrote[17]

With Schröder rules and complementation one can solve for an unknown relation in relation inclusions such as For instance, by Schröder rule and complementation gives which is called the left residual of by .

Quotients

[edit]

Just as composition of relations is a type of multiplication resulting in a product, so some operations 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 and a codomain.

Definitions:

  • Left residual:
  • Right residual:
  • Symmetric quotient:

Using Schröder's rules, is equivalent to Thus the left residual is the greatest relation satisfying Similarly, the inclusion is equivalent to and the right residual is the greatest relation satisfying [2]: 43–6 

One can practice the logic of residuals with Sudoku.[further explanation needed]

Join: another form of composition

[edit]

A fork operator has been introduced to fuse two relations and into The construction depends on projections and understood as relations, meaning that there are converse relations and Then the fork of and is given by[18]

Another form of composition of relations, which applies to general -place relations for is 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

[edit]

Notes

[edit]

References

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
In mathematics, particularly in and , the composition of binary relations is a fundamental operation that combines two relations defined on sets to produce a new relation. Specifically, if RR is a from a set AA to a set BB (i.e., RA×BR \subseteq A \times B) and SS is a from BB to a set CC (i.e., SB×CS \subseteq B \times C), then the composition SRS \circ R (or sometimes denoted R;SR ; S) is the from AA to CC defined by (a,c)SR(a, c) \in S \circ R if and only if there exists some bBb \in B such that (a,b)R(a, b) \in R and (b,c)S(b, c) \in S. This operation generalizes the composition of functions, as any function can be viewed as a special type of relation, and it extends the concept by allowing intermediate elements without requiring uniqueness or totality. The composition of relations exhibits several key properties that mirror those of function composition but apply more broadly. Notably, it is associative: for relations R:ABR: A \to B, S:BCS: B \to C, and T:CDT: C \to D, the equality T(SR)=(TS)RT \circ (S \circ R) = (T \circ S) \circ R holds, meaning parentheses can be omitted in chains of compositions without ambiguity. Unlike function composition, relation composition does not require invertibility, but it interacts meaningfully with other relation operations like union, , and converse; for example, the converse of a composition satisfies (SR)1=R1S1(S \circ R)^{-1} = R^{-1} \circ S^{-1}. These properties make composition a cornerstone in and , where relations can be seen as morphisms between sets. Beyond , the composition of relations finds practical applications in and . In relational databases, composing relations corresponds to the natural join operation, enabling queries that chain conditions across multiple tables. It also underpins , where relations represent edges, and composition models paths of length two or more. The formal study of the calculus of binary relations originated in the 19th century, introduced by in 1860 and further developed by and Ernst Schröder.

Fundamentals

Definition

In , given RX×YR \subseteq X \times Y and SY×ZS \subseteq Y \times Z, their composition, often denoted SRS \circ R, is the SRX×ZS \circ R \subseteq X \times Z defined as the set of all ordered pairs (x,z)(x, z) such that there exists some yYy \in Y satisfying (x,y)R(x, y) \in R and (y,z)S(y, z) \in S. This construction captures the transitive linkage between elements of XX and ZZ through intermediate elements in YY, formalized via over YY. When RR and SS are functional relations—meaning each element in the domain maps to exactly one element in the —the composition SRS \circ R reduces precisely to the standard composition of functions, where (SR)(x)=S(R(x))(S \circ R)(x) = S(R(x)) for xXx \in X. The concept of relation composition, introduced by in 1860 and developed by , was systematized by Ernst Schröder in the 1890s, particularly in his work on the calculus of relations within the algebra of logic.

Notation and Variations

The composition of two binary relations RX×YR \subseteq X \times Y and SY×ZS \subseteq Y \times Z is commonly denoted in modern mathematical literature as SRS \circ R, where the circle symbol \circ indicates the relational product, with RR applied first followed by SS. This notation aligns with the standard convention for , emphasizing the sequential application from right to left. An alternative infix notation uses juxtaposition, writing RSRS for the same operation, particularly in contexts where the relations are treated as elements of a under composition; however, this form requires care to distinguish it from other binary operations on relations. Historically, the semicolon notation R;SR ; S—again with RR first—was introduced by Ernst Schröder in his 1895 treatise on the algebra and logic of relative theory, where it served as the infix operator for the relative product of relatives (binary relations). adopted and formalized this semicolon notation in his 1941 axiomatic treatment of the calculus of relations, defining xR;Syx \, R ; S \, y to hold if there exists zz such that xRzx \, R \, z and zSyz \, S \, y, and using it throughout his development of relation algebras. In domain-specific formalisms, variations reflect syntactic or applicative needs. The , a language for software, employs the ;; for forward relational composition (with right-to-left application, as in R;SR ; S), but also supports the dedicated Unicode symbol \twoheadrightarrow (U+2A3E) to explicitly denote relational composition in typeset documents. In , foundational to database query languages, direct composition of relations is not a primitive but is realized through the natural join operator \bowtie, which combines tuples from two relations on matching attributes, effectively computing the relational product under equality conditions. A key concern with juxtaposition RSRS is its potential , as it may be misinterpreted as the union RSR \cup S or, less commonly, the R×SR \times S in texts where these operations lack explicit symbols; authors often mitigate this by reserving juxtaposition strictly for composition or qualifying it contextually.

Properties and Generalizations

Algebraic Properties

Relation composition exhibits several fundamental algebraic properties that mirror those of binary operations in . Foremost among these is associativity: for binary relations RX×YR \subseteq X \times Y, SY×ZS \subseteq Y \times Z, and TZ×WT \subseteq Z \times W, the composition satisfies (RS)T=R(ST)(R \circ S) \circ T = R \circ (S \circ T). This property allows for unambiguous iteration of compositions without parentheses, facilitating the definition of powers of relations, such as transitive closures. The operation also possesses an . For a set XX, the identity relation IX={(x,x)xX}X×XI_X = \{(x, x) \mid x \in X\} \subseteq X \times X acts as a two-sided unit under composition: if RX×YR \subseteq X \times Y, then RIX=RR \circ I_X = R and IYR=RI_Y \circ R = R. This neutral behavior ensures that adjoining the identity does not alter the relation, analogous to the role of the in . In addition, the empty relation \emptyset functions as an absorbing zero element. For any relation RR compatible with \emptyset, the compositions R=R \circ \emptyset = \emptyset and R=\emptyset \circ R = \emptyset. This absorption property highlights how the absence of connecting elements in one relation renders the overall composition void, underscoring the set-theoretic foundations of the operation. These properties collectively endow the collection of all binary relations on a fixed set XX, denoted Rel(X)\mathrm{Rel}(X), with a monoid structure under composition. Specifically, (Rel(X),,IX)(\mathrm{Rel}(X), \circ, I_X) forms a monoid, where associativity ensures well-defined multiple compositions and IXI_X provides the required unit. This algebraic framework is central to relation algebra and enables the study of relations as elements in a semigroup with identity. Composition further interacts compatibly with the converse operation on relations. The converse of a relation RX×YR \subseteq X \times Y is RT={(y,x)(x,y)R}Y×XR^T = \{(y, x) \mid (x, y) \in R\} \subseteq Y \times X, which reverses the direction of the relation. For compatible relations RR and SS, the key identity holds: (RS)T=STRT(R \circ S)^T = S^T \circ R^T. This reversal property preserves the chaining while flipping the order, proving useful in analyzing symmetries and inverses in relational systems.

Mathematical Generalizations

In , the composition of relations generalizes to the category Rel, where objects are sets and morphisms are binary relations between them, with composition defined by the standard relational product: for relations RA×BR \subseteq A \times B and SB×CS \subseteq B \times C, the composite SR={(a,c)bB:(a,b)R(b,c)S}S \circ R = \{(a, c) \mid \exists b \in B : (a, b) \in R \land (b, c) \in S\}.73066-8) This category is dagger-compact and serves as the primary example of an , a bicategory where every has a converse, enabling a of relations that captures properties like associativity and converse preservation under composition.73066-8) The structure of Rel highlights how relation composition extends beyond mere set-theoretic operations to a framework supporting enriched categorical constructions, such as monoidal structures induced by Cartesian products. In more abstract settings, such as regular categories—those with finite limits, coequalizers of kernel pairs, and pullback-stable regular epimorphisms—internal relations are defined using spans or jointly monic pairs. A relation from object rr to ss is a jointly monic span rxsr \leftarrow x \twoheadrightarrow s, where the pair (f:xr,g:xs)(f: x \to r, g: x \to s) induces a f,g:xr×s\langle f, g \rangle: x \to r \times s, representing subobjects of the product. Composition of two such relations, say rxsr \leftarrow x \twoheadrightarrow s and syts \leftarrow y \twoheadrightarrow t, proceeds via the x×syx \times_s y along the codomain and domain maps, followed by taking the regular image of the induced map to r×tr \times t to ensure the result is again a jointly monic span. This construction yields a bicategory of relations internal to the regular category, equivalent to the 2-category of relational po-categories, where composition is associative and independent of the choice of span representatives. Linear relations provide a further generalization over vector spaces or modules, where a relation between vector spaces VV and WW over a field kk (such as F2\mathbb{F}_2) is a linear subspace LV×WL \subseteq V \times W, closed under addition and scalar multiplication. Composition mirrors the relational case but leverages linearity: for LV×WL \subseteq V \times W and MW×UM \subseteq W \times U, the composite is LM={(v,u)wW. (v,w)L(w,u)M}L \circ M = \{(v, u) \mid \exists w \in W.\ (v, w) \in L \land (w, u) \in M \}, which is again a linear subspace of V×UV \times U. In finite-dimensional settings over F2\mathbb{F}_2, the category of linear relations is isomorphic to the phase-free fragment of the qubit ZX-calculus, where linear maps and relations are depicted as Z- and X-spiders connected by wires, allowing diagrammatic simplification of composites through rewrite rules like the bialgebra laws. This framework is particularly useful in quantum information, where ZX-diagrams encode compositions of linear relations on Hilbert spaces. Profunctors, also known as distributors, extend relation composition to arbitrary categories, generalizing binary relations as bifunctors P:Cop×DSetP: C^{op} \times D \to \mathbf{Set} that assign to objects cCc \in C and dDd \in D a set of "relations" between them. Composition of profunctors P:CDP: C \nrightarrow D and Q:DEQ: D \nrightarrow E is given by the coend formula (QP)(c,e)=dDQ(d,e)×P(c,d)(Q \circ P)(c, e) = \int^{d \in D} Q(d, e) \times P(c, d), which quotients by the actions of morphisms in DD to ensure functoriality, forming the bicategory Prof\mathbf{Prof} of categories, profunctors, and natural transformations. When restricted to the category of sets, profunctors recover ordinary relations, with composition reducing to the relational product, but in general, this construction applies to arrow categories (where objects are arrows in a base category and morphisms are commuting squares) by viewing arrows as fibrations and profunctors as generalized relations between them, preserving associativity up to in the bicategorical sense. This abstraction underpins applications in and open systems modeling, where profunctor composition models relational queries across structured categories.

Representation and Computation

Matrix Composition

A binary relation RX×YR \subseteq X \times Y on finite sets X={x1,,xm}X = \{x_1, \dots, x_m\} and Y={y1,,yn}Y = \{y_1, \dots, y_n\} can be represented by an m×nm \times n MRM_R, where the entry (MR)i,j=1(M_R)_{i,j} = 1 if (xi,yj)R(x_i, y_j) \in R and 00 otherwise. This representation uses entries to encode membership directly, facilitating algebraic manipulation. The composition SRS \circ R, where RX×YR \subseteq X \times Y and SY×ZS \subseteq Y \times Z for finite Z={z1,,zp}Z = \{z_1, \dots, z_p\}, corresponds to the Boolean matrix product MSR=MRMSM_{S \circ R} = M_R * M_S. In this product, addition is the logical OR (++, with 1+1=11 + 1 = 1) and multiplication is the logical AND (\cdot). Thus, the entry in row ii and column kk of MSRM_{S \circ R} is computed as j=1n((MR)i,j(MS)j,k)\bigvee_{j=1}^n \left( (M_R)_{i,j} \wedge (M_S)_{j,k} \right), indicating existence of an intermediate element yjy_j connecting xix_i to zkz_k. For illustration, consider sets X={1,2}X = \{1,2\}, Y={a,b}Y = \{a,b\}, Z={A,B}Z = \{A,B\}, with R={(1,a),(2,a),(2,b)}R = \{(1,a), (2,a), (2,b)\} so MR=(1011),M_R = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}, and S={(a,A),(b,B)}S = \{(a,A), (b,B)\} so MS=(1001).M_S = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}. The composition yields SR={(1,A),(2,A),(2,B)}S \circ R = \{(1,A), (2,A), (2,B)\}, with MSR=(1011).M_{S \circ R} = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}. This matrix approach enables efficient computation of relation compositions for finite sets, as the Boolean product can be evaluated in O(mnp)O(m n p) time using standard algorithms adapted for logical operations. Moreover, when X=Y=ZX = Y = Z, the logical matrix aligns with the of the representing the relation, allowing composition to model path existence in .

Heterogeneous Relations

Heterogeneous relations arise in the composition of binary relations where the underlying sets differ in type or , allowing for more general structures beyond homogeneous cases. A relation RX×YR \subseteq X \times Y is heterogeneous if XX and YY are distinct sets, possibly with XY|X| \neq |Y|. The composition with another relation SY×ZS \subseteq Y \times Z follows the standard definition: (x,z)SR(x, z) \in S \circ R if and only if there exists yYy \in Y such that (x,y)R(x, y) \in R and (y,z)S(y, z) \in S. This is valid whenever the of RR aligns with the domain of SS, even if XZX \neq Z or XZ|X| \neq |Z|, enabling compositions across mismatched domains and codomains. Key constructions in heterogeneous relation algebra involve the RTY×XR^T \subseteq Y \times X, defined by (y,x)RT(y, x) \in R^T if and only if (x,y)R(x, y) \in R. The self-composition RRTX×XR R^T \subseteq X \times X captures connectivity within XX; in particular, RR is total on XX (every xXx \in X relates to some yYy \in Y) if and only if the identity relation IXX×XI_X \subseteq X \times X satisfies IXRRTI_X \subseteq R R^T, since (x,x)RRT(x, x) \in R R^T holds precisely when there exists yy with (x,y)R(x, y) \in R. Dually, RTRY×YR^T R \subseteq Y \times Y assesses coverage on YY; RR is surjective on YY (every yYy \in Y is related to by some xXx \in X) if and only if IYRTRI_Y \subseteq R^T R. These tests are fundamental for verifying completeness and exhaustiveness in relational mappings between disparate sets. Heterogeneous relations are computationally represented by rectangular Boolean matrices, with rows indexed by elements of XX and columns by YY, where entry (i,j)=1(i, j) = 1 if (xi,yj)R(x_i, y_j) \in R and 0 otherwise. For composition SRS \circ R with RR an X×Y|X| \times |Y| matrix and SS a Y×Z|Y| \times |Z| matrix, the result is the X×Z|X| \times |Z| matrix product: (SR)ik=j=1Y(RijSjk),(S \circ R)_{i k} = \bigvee_{j=1}^{|Y|} \left( R_{i j} \wedge S_{j k} \right), using disjunction (\vee) as addition and conjunction (\wedge) as in the semiring. This accommodates dimensional heterogeneity, unlike square matrices in homogeneous cases. Consider sets A={[France](/page/France),[Germany](/page/Germany),[Italy](/page/Italy),[Switzerland](/page/Switzerland)}A = \{\text{[France](/page/France)}, \text{[Germany](/page/Germany)}, \text{[Italy](/page/Italy)}, \text{[Switzerland](/page/Switzerland)}\} of countries and B={French,German,Italian}B = \{\text{French}, \text{German}, \text{Italian}\} of languages. The border relation RA×AR \subseteq A \times A (symmetric) includes: , , , . Its matrix (rows/columns: F, G, I, S) is: R=(0101100100011110).R = \begin{pmatrix} 0 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{pmatrix}.
Add your contribution
Related Hubs
Contribute something
User Avatar
No comments yet.