Composition of commuting equivalence relations Created 2026-10-14 Updated 2026-10-31
Using the left-to-right convention for composition of relations, two equivalence relations have an equivalence-relation composite exactly when . Its inverse is . Commutation gives , proving transitivity. Every equivalence relation containing contains their two-step composite, so this is their least common extension.
// Destination: combinatorics.bigb
Composition of relations 2026-10-14
This convention composes paths in their written order; some sources instead reverse that convention. Composition of relations is associative. Taking inverse relations reverses the order: .
// Target: foundations-of-mathematics.bigb
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 4 5E ii Solution Created 2026-09-24 Updated 2026-10-14
A binary relation is transitive exactly when . If condition (iii) holds, associativity and monotonicity of composition of relations giveHence (iii) implies (ii). Conversely, the inclusions implyIf is a transitive relation, the right side lies in , which is condition (iii). Thus (ii) and (iii) are equivalent.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 4 5E Solution 2026-10-14
An equivalence relation on is a binary relation that is reflexive, symmetric and transitive: for every ; ; and . Write , using the stated order for composition of relations. Composition is associative because both possible bracketings mean that there is a two-step sequence of intermediate witnesses. Reflexivity showsand also that is reflexive. Transitivity and reflexivity of the original relations give , . Since both original relations are symmetric,The four parts below show that each condition is equivalent to the commuting equivalence relations condition .
For the integer example, put . Membership of in the composite means that some satisfies , for integers . Consequently is divisible by . Conversely, if is divisible by , the Bezout identity expresses it as ; setting provides the required witness. ThusReversing the roles of gives exactly the same modular congruence relation, hence . This verifies all four conditions and identifies their common smallest equivalence relation explicitly.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 11 ii Solution Created 2026-09-24 Updated 2026-10-14
If is transitive, then . Since , monotonicity of composition of relations giveswhich is condition (iii).
Conversely, condition (iii), associativity of composition of relations, and the identities , giveFor a direct chain description, start with . Replace its middle by using condition (iii), then use transitivity inside and to obtain . Hence is transitive. Conditions (ii) and (iii) are equivalent.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 11 Solution 2026-10-14
An equivalence relation on a set is a binary relation that is reflexive, symmetric and transitive: every element is related to itself, related pairs may be reversed, and two consecutive related pairs imply the pair of endpoints is related.
Write , using the printed left-to-right composition of relations convention. Reflexivity implies and , and hence is reflexive. Reversing a two-step chain givessince are symmetric. Also and : one inclusion is transitivity, and the reverse follows by inserting a reflexive step. These elementary identities supply the equivalences below, without presuming that a composite of equivalence relations is automatically an equivalence relation.
The answer is no, even when both original binary relations are equivalence relations. On , let have equivalence classes and have equivalence classes . Each is a transitive relation and, by the earlier proof, a Euclidean relation.
Use exactly the paper's convention for composition of relations: means and for some . The possible successors areIndeed, from or the first step can reach or , whose successors together exhaust ; from the first step must stay at , whose successors are only . Consequently and , but not . Therefore
Use the first binary relation for the outer generator, the second for the inner generator, and match their middle values. Different witnesses can generate the same output pair, so apply duplicate removal:
relcomp :: Eq a => [(a, a)] -> [(a, a)] -> [(a, a)]
relcomp r s = removedup [(a, b) | (a, c) <- r,
(d, b) <- s, c == d]The guards give precisely the existential witness required for composition of relations:Every output is sound by its generating witness, and every witness is visited for finite inputs. Duplicate removal converts the resulting enumeration back to the required representation by distinct pairs.
Maintain all pairs discovered so far. Extend every discovered path by one original binary relation edge, keeping the old pairs first:
transclose :: Eq a => [(a, a)] -> [(a, a)]
transclose r = grow (removedup r)
where
grow s =
let t = removedup (s ++ relcomp r s)
in if length t == length s then s else grow tAfter extensions, the represented binary relation is . This loop invariant follows by distributivity of composition of relations over a union. The old list
s is a duplicate-free prefix of t; therefore equality of lengths is equivalent to equality of the represented sets and signals a fixed point.Let be the finite set of endpoints appearing in the input. No extension introduces a new endpoint, so there are at most distinct pairs. Every nonfinal iteration adds at least one pair, proving algorithm termination. At the fixed point , we have and . Mathematical induction gives for every positive , while the loop invariant says that each discovered pair belongs to some . HenceThis is the transitive closure of a relation, rather than a reflexive closure: diagonal pairs appear only when supported by nonempty cycles. The empty input is handled immediately.
Using the wiki convention that paths follow the written order of the binary relations, composition of relations isSome treatments reverse the naming convention; stating it explicitly avoids ambiguity. The powers of the single relation below are the same under either convention.
False. Use the same two equivalence relations as in part (ii). They are both symmetric relations. The composite contains , since and . It does not contain , as shown there. Hence composition of relations need not preserve symmetry of a relation, even when both factors are also reflexive and transitive.
True. Fix . Reflexivity supplies and . In the definition of composition of relations, choose the intermediate element to be itself. Then . This holds for every , so the composite binary relation is reflexive.
For each requested
x, enumerate its middle relatives and then each middle value's relatives in the second relation:def compose2[X, Y, Z](r: Rel2[X, Y], s: Rel2[Y, Z]): Rel2[X, Z] =
new Rel2[X, Z] {
def relatives(x: X): List[Z] =
r.relatives(x).flatMap(y => s.relatives(y)).distinct
}A returned
z is present exactly when some enumerated y witnesses the two relation memberships. Conversely, every such witness appears in r.relatives(x), and its z appears in s.relatives(y), so no composed relative is omitted. .distinct removes repeated endpoints, including repetitions produced through different witnesses. This is the same composition of relations as part (b), represented one queried row at a time. Neither the entire first carrier nor the entire result must be enumerated in advance. The relation operations must remain consistent while the returned view is used; changing their underlying state would make this a live view rather than a snapshot. Power of a relation 2026-10-31
For a binary relation on a set , define and for nonnegative integers , using composition of relations. A pair belongs to precisely when a sequence has for every . This follows by mathematical induction, splitting off one step in the recurrence. Thus records paths with exactly steps, rather than at most steps. The union is the transitive closure of a relation; including gives its reflexive transitive closure. The powers of a single relation agree under the two common composition-order conventions.