Skip to main content

Discrete Math with SageMath: Learn math with open-source software

Section 5.5 Equivalence

A relation on a set is called an equivalence relation if it is reflexive, symmetric, and transitive. The equivalence class of an element \(a\) in a set \(A\) is the set of all elements in \(A\) that are related to \(a\) by this relation, denoted by:
\begin{equation*} [a] = \{x \in A \; | \; xRa\} \end{equation*}
Here, \([a]\) represents the equivalence class of \(a\text{,}\) comprising all elements in \(A\) that are related to \(a\) through the relation \(R\text{.}\) This illustrates the grouping of elements into equivalence classes.
Consider a set \(A\) defined as:
\begin{equation*} A = \{x \; | \; x \text{ is a person living in a given building} \} \end{equation*}
Create sets for the people living on each floor of the building:
Let \(R\) be the relation on \(A\) described as follows:
\begin{equation*} x R y\ \text{iff}\ x\ \text{and}\ y\ \text{live in the same floor of the building.} \end{equation*}
This relation demonstrates the properties of an equivalence relation:
Reflexive: A person lives in the same floor as themselves.
Symmetric: If person \(a\) lives in the same floor as person \(b\text{,}\) then person \(b\) lives in the same floor as person \(a\text{.}\)
Transitive: If person \(a\) lives in the same floor as person \(b\) and person \(b\) lives in the same floor as person \(c\text{,}\) then person \(a\) lives in the same floor as person \(c\text{.}\)