MODULE 05

Relations Calculator: Properties, Closures & Composition

Set: 1,2,3 · Pairs: (1,1),(1,2),(2,1),(2,2),(3,3)

Directed Graph

What is Relations?

A relation describes how elements of a set connect to each other as ordered pairs. Whether a relation is reflexive, symmetric, and/or transitive determines if it behaves like an equality or an ordering.

How Does This Calculator Work?

Enter set A and the relation as ordered pairs like (1,2),(2,3), then click analyze. The calculator checks reflexive, symmetric, and transitive properties pair by pair, and can also compute closures or compose two relations.

Common Formulas & Rules

  • Reflexive: every element relates to itself, i.e. (a,a) is in R for all a.
  • Symmetric: if (a,b) is in R, then (b,a) must be too.
  • Transitive: if (a,b) and (b,c) are in R, then (a,c) must be too.
  • Equivalence relation: reflexive, symmetric, and transitive all at once — it partitions the set into equivalence classes.
  • Closure: the smallest relation containing R that also satisfies a given property (e.g. transitive closure).

Worked Example

Let A = {1,2,3} and R = {(1,1),(2,2),(3,3),(1,2),(2,1)}. R is reflexive (every (a,a) pair is present) and symmetric (1,2) and (2,1) both appear), and checking all chains confirms it's transitive too — so R is an equivalence relation that splits A into the classes {1,2} and {3}.

Closures: making a relation reflexive, symmetric or transitive

The Closure tab adds the fewest pairs needed to give a relation a property: the reflexive closure adds every missing (a, a), the symmetric closure adds every missing reverse pair, and the transitive closure adds every pair joined by a chain of existing pairs.

For the transitive closure, with a full worked example and Warshall's algorithm, use the dedicated transitive closure calculator.

Study guide: Relations

Written for students learning this topic for the first time. Last updated October 2026.

Overview

A relation from A to B is a subset of A × B; a relation on A is a subset of A × A. Equality, ≤, “divides”, friendship and “is a prerequisite of” are all relations, and the properties a relation has decide what kind of structure it describes.

Four properties (reflexive, symmetric, antisymmetric, transitive) combine into two cornerstone structures: equivalence relations, which partition a set, and partial orders, which arrange it in a hierarchy.

Key ideas explained

The four properties

Reflexive: (a, a) is in R for every a. Symmetric: (a, b) in R implies (b, a) in R. Antisymmetric: if both (a, b) and (b, a) are in R then a = b. Transitive: (a, b) and (b, c) in R imply (a, c) in R. Symmetric and antisymmetric are not opposites: equality is both, and {(1,2),(2,1),(1,3)} is neither.

Equivalence relations

Reflexive, symmetric and transitive. They split the set into disjoint equivalence classes. Congruence modulo 3 on the integers produces exactly three classes.

Partial orders

Reflexive, antisymmetric and transitive, like “divides” on the positive integers or ⊆ on sets. If every two elements are comparable, the order is total. Hasse diagrams draw a partial order without loops or implied edges.

Closures and composition

A closure is the smallest relation containing R that has a property. The reflexive closure adds missing (a, a) pairs, the symmetric closure adds reverses, and the transitive closure adds every pair connected by a chain. The composition S ∘ R links R-steps followed by S-steps.

Worked examples

Recognising an equivalence relation

Problem. On A = {1,2,3}, let R = {(1,1),(2,2),(3,3),(1,2),(2,1)}.

  1. Reflexive: all three loops are present.
  2. Symmetric: (1,2) has its reverse (2,1).
  3. Transitive: every chain, such as (1,2),(2,1) giving (1,1), lands back inside R.
  4. The classes are the groups of related elements.

Answer. R is an equivalence relation with classes {1,2} and {3}.

Building a transitive closure

Problem. A = {1,2,3,4}, R = {(1,2),(2,3),(3,4)}.

  1. Chains of length two: 1→2→3 gives (1,3); 2→3→4 gives (2,4).
  2. Now 1→3→4 gives (1,4).
  3. No further new pairs appear.

Answer. The transitive closure is R ∪ {(1,3),(2,4),(1,4)}, six pairs in total.

Enter these same values in the calculator above and compare each step with the working shown here.

Common mistakes to avoid

  • Checking transitivity only on pairs that look obviously connected. Every chain must be checked.
  • Assuming “not symmetric” means “antisymmetric”.
  • Overlooking one missing loop (a, a), which already breaks reflexivity.
  • Forgetting that the empty relation on a non-empty set is symmetric and transitive but not reflexive.

Where this shows up in computer science

  • The relational model of databases treats a table as a relation, and a join is a composition.
  • Transitive closure answers “can A eventually reach B?”, which build systems and package managers rely on.
  • Equivalence classes underlie grouping by key, union–find, and modular arithmetic.

Test yourself

Try each question before opening the answer.

Is “divides” on {1,2,3,4,6,12} a partial order? A total order?

A partial order (reflexive, antisymmetric, transitive) but not total, since 2 and 3 are incomparable.

How many equivalence classes does congruence modulo 5 have on the integers?

Five.

What is the fewest pairs a reflexive relation on {1,2,3} can have?

Three: the loops (1,1), (2,2), (3,3).

Frequently asked questions

What makes a relation an equivalence relation?

A relation is an equivalence relation if it's simultaneously reflexive (every element relates to itself), symmetric (if a relates to b, b relates to a), and transitive (if a relates to b and b relates to c, a relates to c).

What's the difference between a relation and a function?

Every function is a relation, but not every relation is a function. A relation just pairs elements; a function additionally requires each input to map to exactly one output.

What is the transitive closure of a relation?

The transitive closure is the smallest relation that contains the original relation and is also transitive — found by repeatedly adding (a,c) whenever (a,b) and (b,c) are present, until nothing new can be added.

How do you find the transitive closure of a relation?

Repeatedly add a pair (a, c) whenever (a, b) and (b, c) are already present, until no new pairs appear. Warshall's algorithm does this systematically by allowing one more intermediate element at a time. The guide on this page shows a full example.

What is the difference between a transitive relation and a transitive closure?

A relation is transitive if it already contains every shortcut pair (a, c). The transitive closure is the smallest transitive relation that contains a given relation, found by adding the missing shortcut pairs.