A relation is said to be an equivalence relation if it is:
Symmetric
Reflexive
Transitive
It would be useful to provide some revision of these concepts first.
Formally, we can define a symmetric relation as:
In other words, whenever a relation
A pretty common example is the siblings' relationship. Whenever
And similarly, some counter-examples:
A book is translated from the language
Test yourself
Is the relation where is the additive inverse of symmetric?
A reflexive relation is pretty simple:
In other words, the self-relation should be defined for each set member.
While equality
Division: A set having non-zero elements is reflexive, as every (non-zero) number can divide by itself.
Similarly, transitive relation means that if
Again, a number of examples like siblings, coworkers, and classmates are examples of transitive relations. Some more examples:
If we define a line as a relationship between two points
Similarly, relational operators
After this preamble, let's return to the equivalence relations definition. We can now establish any relation as an equivalence relation if we test it for the above three attributes. Let's start with an example (taken from Rosen's Discrete Mathematics):
To check the symmetry of a relation, we need to iterate through the set members and make sure there exists a
As we quickly realize, a
Wait a minute! Won't it be better to formulate this algorithm so we can apply it to a number of sets?
using Collections;class Relation{int a;int b;}static class CheckEquivalence{static bool CheckSymmetry(List<Relation> wholeRelation){foreach(Relation r in wholeRelation){if(r.a!=r.b){//find the relation r2 with r2.a=r.b and r2.b=r.a//If found, continue, otherwise return false}}}}
That was a sidenote and can be skipped. Now, we check for the reflexivity.
We can quickly see that it contains all the
static class CheckEquivalence{static bool CheckRefelxivity(Set _set){foreach(element a in _set){//If (a,a) exists, then continue, otherwise return false}}}
Finally, we can check the transitive property too.
Is the above relation transitive? Apparently, yes, but it is not.
So, in the end, the relation we checked turns out to be not an equivalence set. We can check some other examples, too.
But why do we use equivalence sets? It should be an automatic and valid question. Equivalence sets have a number of applications.
For example, equivalence relations on a set
Note: Even the converse is true; If we partition a set into non-overlapping subsets, there would be some equivalence relations representing (or getting represented by) that partition.
Free Resources