Equivalence relation
Binary relations  

 
A "✓" indicates that the column property is required in the row definition. For example, the definition of an equivalence relation requires it to be symmetric. All definitions tacitly require transitivity and reflexivity. 
In mathematics, an equivalence relation is a binary relation that is reflexive, symmetric and transitive. The relation "is equal to" is the canonical example of an equivalence relation.
Each equivalence relation provides a partition of the underlying set into disjoint equivalence classes. Two elements of the given set are equivalent to each other, if and only if they belong to the same equivalence class.
Notation
Various notations are used in the literature to denote that two elements a and b of a set are equivalent with respect to an equivalence relation R; the most common are "a ~ b" and "a ≡ b", which are used when R is implicit, and variations of "a ~_{R} b", "a ≡_{R} b", or "" to specify R explicitly. Nonequivalence may be written "a ≁ b" or "".
Definition
A binary relation ~ on a set X is said to be an equivalence relation, if and only if it is reflexive, symmetric and transitive. That is, for all a, b and c in X:
 a ~ a. ( Reflexivity)
 a ~ b if and only if b ~ a. ( Symmetry)
 if a ~ b and b ~ c, then a ~ c. ( Transitivity)
X together with the relation ~ is called a setoid. The equivalence class of under ~, denoted ,^{ [1]} is defined as .^{ [2]}^{ [3]}
Examples
Simple example
Let the set have the equivalence relation . The following sets are equivalence classes of this relation:
 .
The set of all equivalence classes for this relation is . This set is a partition of the set .
Equivalence relations
The following relations are all equivalence relations:
 "Is equal to" on the set of numbers. For example, is equal to .^{ [3]}
 "Has the same birthday as" on the set of all people.
 "Is similar to" on the set of all triangles.
 "Is congruent to" on the set of all triangles.
 "Is congruent to, modulo n" on the integers.^{ [3]}
 "Has the same image under a function" on the elements of the domain of the function.
 "Has the same absolute value" on the set of real numbers
 "Has the same cosine" on the set of all angles.
Relations that are not equivalences
 The relation "≥" between real numbers is reflexive and transitive, but not symmetric. For example, 7 ≥ 5 does not imply that 5 ≥ 7. It is, however, a total order.
 The relation "has a common factor greater than 1 with" between natural numbers greater than 1, is reflexive and symmetric, but not transitive. For example, the natural numbers 2 and 6 have a common factor greater than 1, and 6 and 3 have a common factor greater than 1, but 2 and 3 do not have a common factor greater than 1.
 The empty relation R (defined so that aRb is never true) on a nonempty set X is vacuously symmetric and transitive, but not reflexive. (If X is also empty then R is reflexive.)
 The relation "is approximately equal to" between real numbers, even if more precisely defined, is not an equivalence relation, because although reflexive and symmetric, it is not transitive, since multiple small changes can accumulate to become a big change. However, if the approximation is defined asymptotically, for example by saying that two functions f and g are approximately equal near some point if the limit of f − g is 0 at that point, then this defines an equivalence relation.
Connections to other relations
 A partial order is a relation that is reflexive, antisymmetric, and transitive.
 Equality is both an equivalence relation and a partial order. Equality is also the only relation on a set that is reflexive, symmetric and antisymmetric. In algebraic expressions, equal variables may be substituted for one another, a facility that is not available for equivalence related variables. The equivalence classes of an equivalence relation can substitute for one another, but not individuals within a class.
 A strict partial order is irreflexive, transitive, and asymmetric.
 A partial equivalence relation is transitive and symmetric. Such a relation is reflexive if and only if it is serial, that is, if ∀a∃b a ~ b.^{ [4]} Therefore, an equivalence relation may be alternatively defined as a symmetric, transitive, and serial relation.
 A ternary equivalence relation is a ternary analogue to the usual (binary) equivalence relation.
 A reflexive and symmetric relation is a dependency relation (if finite), and a tolerance relation if infinite.
 A preorder is reflexive and transitive.
 A congruence relation is an equivalence relation whose domain X is also the underlying set for an algebraic structure, and which respects the additional structure. In general, congruence relations play the role of kernels of homomorphisms, and the quotient of a structure by a congruence relation can be formed. In many important cases, congruence relations have an alternative representation as substructures of the structure on which they are defined (e.g., the congruence relations on groups correspond to the normal subgroups).
 Any equivalence relation is the negation of an apartness relation, though the converse statement only holds in classical mathematics (as opposed to constructive mathematics), since it is equivalent to the law of excluded middle.
Welldefinedness under an equivalence relation
If ~ is an equivalence relation on X, and P(x) is a property of elements of X, such that whenever x ~ y, P(x) is true if P(y) is true, then the property P is said to be welldefined or a class invariant under the relation ~.
A frequent particular case occurs when f is a function from X to another set Y; if x_{1} ~ x_{2} implies f(x_{1}) = f(x_{2}) then f is said to be a morphism for ~, a class invariant under ~, or simply invariant under ~. This occurs, e.g. in the character theory of finite groups. The latter case with the function f can be expressed by a commutative triangle. See also invariant. Some authors use "compatible with ~" or just "respects ~" instead of "invariant under ~".
More generally, a function may map equivalent arguments (under an equivalence relation ~_{A}) to equivalent values (under an equivalence relation ~_{B}). Such a function is known as a morphism from ~_{A} to ~_{B}.
Equivalence class, quotient set, partition
Let . Some definitions:
Equivalence class
A subset Y of X such that a ~ b holds for all a and b in Y, and never for a in Y and b outside Y, is called an equivalence class of X by ~. Let denote the equivalence class to which a belongs. All elements of X equivalent to each other are also elements of the same equivalence class.
Quotient set
The set of all equivalence classes of X by ~, denoted , is the quotient set of X by ~. If X is a topological space, there is a natural way of transforming X/~ into a topological space; see quotient space for the details.
Projection
The projection of ~ is the function defined by which maps elements of X into their respective equivalence classes by ~.
 Theorem on projections:^{ [5]} Let the function f: X → B be such that a ~ b → f(a) = f(b). Then there is a unique function g : X/~ → B, such that f = gπ. If f is a surjection and a ~ b ↔ f(a) = f(b), then g is a bijection.
Equivalence kernel
The equivalence kernel of a function f is the equivalence relation ~ defined by . The equivalence kernel of an injection is the identity relation.
Partition
A partition of X is a set P of nonempty subsets of X, such that every element of X is an element of a single element of P. Each element of P is a cell of the partition. Moreover, the elements of P are pairwise disjoint and their union is X.
Counting partitions
Let X be a finite set with n elements. Since every equivalence relation over X corresponds to a partition of X, and vice versa, the number of equivalence relations on X equals the number of distinct partitions of X, which is the nth Bell number B_{n}:
Fundamental theorem of equivalence relations
A key result links equivalence relations and partitions:^{ [6]}^{ [7]}^{ [8]}
 An equivalence relation ~ on a set X partitions X.
 Conversely, corresponding to any partition of X, there exists an equivalence relation ~ on X.
In both cases, the cells of the partition of X are the equivalence classes of X by ~. Since each element of X belongs to a unique cell of any partition of X, and since each cell of the partition is identical to an equivalence class of X by ~, each element of X belongs to a unique equivalence class of X by ~. Thus there is a natural bijection between the set of all equivalence relations on X and the set of all partitions of X.
Comparing equivalence relations
If ~ and ≈ are two equivalence relations on the same set S, and a~b implies a≈b for all a,b ∈ S, then ≈ is said to be a coarser relation than ~, and ~ is a finer relation than ≈. Equivalently,
 ~ is finer than ≈ if every equivalence class of ~ is a subset of an equivalence class of ≈, and thus every equivalence class of ≈ is a union of equivalence classes of ~.
 ~ is finer than ≈ if the partition created by ~ is a refinement of the partition created by ≈.
The equality equivalence relation is the finest equivalence relation on any set, while the universal relation, which relates all pairs of elements, is the coarsest.
The relation "~ is finer than ≈" on the collection of all equivalence relations on a fixed set is itself a partial order relation, which makes the collection a geometric lattice.^{ [9]}
Generating equivalence relations
 Given any set X, an equivalence relation over the set [X → X] of all functions X→X can be obtained as follows. Two functions are deemed equivalent when their respective sets of fixpoints have the same cardinality, corresponding to cycles of length one in a permutation.
 An equivalence relation ~ on X is the equivalence kernel of its surjective projection π : X → X/~.^{ [10]} Conversely, any surjection between sets determines a partition on its domain, the set of preimages of singletons in the codomain. Thus an equivalence relation over X, a partition of X, and a projection whose domain is X, are three equivalent ways of specifying the same thing.
 The intersection of any collection of equivalence relations over X (binary relations viewed as a subset of X × X) is also an equivalence relation. This yields a convenient way of generating an equivalence relation: given any binary relation R on X, the equivalence relation generated by R is the intersection of all equivalence relations containing R (also known as the smallest equivalence relation containing R). Concretely, R generates the equivalence relation a ~ b if and only if there exist elements x_{1}, x_{2}, ..., x_{n} in X such that a = x_{1}, b = x_{n}, and (x_{i}, x_{i+1}) ∈ R or (x_{i+1}, x_{i}) ∈ R, i = 1, ..., n−1. The equivalence relation generated in this manner can be trivial. For instance, the equivalence relation generated by any total order on X has exactly one equivalence class, X itself.
 Equivalence relations can construct new spaces by "gluing things together." Let X be the unit Cartesian square [0, 1] × [0, 1], and let ~ be the equivalence relation on X defined by (a, 0) ~ (a, 1) for all a ∈ [0, 1] and (0, b) ~ (1, b) for all b ∈ [0, 1]. Then the quotient space X/~ can be naturally identified ( homeomorphism) with a torus: take a square piece of paper, bend and glue together the upper and lower edge to form a cylinder, then bend the resulting cylinder so as to glue together its two open ends, resulting in a torus.
Algebraic structure
Much of mathematics is grounded in the study of equivalences, and order relations. Lattice theory captures the mathematical structure of order relations. Even though equivalence relations are as ubiquitous in mathematics as order relations, the algebraic structure of equivalences is not as well known as that of orders. The former structure draws primarily on group theory and, to a lesser extent, on the theory of lattices, categories, and groupoids.
Group theory
Just as order relations are grounded in ordered sets, sets closed under pairwise supremum and infimum, equivalence relations are grounded in partitioned sets, which are sets closed under bijections that preserve partition structure. Since all such bijections map an equivalence class onto itself, such bijections are also known as permutations. Hence permutation groups (also known as transformation groups) and the related notion of orbit shed light on the mathematical structure of equivalence relations.
Let '~' denote an equivalence relation over some nonempty set A, called the universe or underlying set. Let G denote the set of bijective functions over A that preserve the partition structure of A: ∀x ∈ A ∀g ∈ G (g(x) ∈ [x]). Then the following three connected theorems hold:^{ [11]}
 ~ partitions A into equivalence classes. (This is the Fundamental Theorem of Equivalence Relations, mentioned above);
 Given a partition of A, G is a transformation group under composition, whose orbits are the cells of the partition;^{ [15]}
 Given a transformation group G over A, there exists an equivalence relation ~ over A, whose equivalence classes are the orbits of G.^{ [16]}^{ [17]}
In sum, given an equivalence relation ~ over A, there exists a transformation group G over A whose orbits are the equivalence classes of A under ~.
This transformation group characterisation of equivalence relations differs fundamentally from the way lattices characterize order relations. The arguments of the lattice theory operations meet and join are elements of some universe A. Meanwhile, the arguments of the transformation group operations composition and inverse are elements of a set of bijections, A → A.
Moving to groups in general, let H be a subgroup of some group G. Let ~ be an equivalence relation on G, such that a ~ b ↔ (ab^{−1} ∈ H). The equivalence classes of ~—also called the orbits of the action of H on G—are the right cosets of H in G. Interchanging a and b yields the left cosets.
Related thinking can be found in Rosen (2008: chpt. 10).
Categories and groupoids
Let G be a set and let "~" denote an equivalence relation over G. Then we can form a groupoid representing this equivalence relation as follows. The objects are the elements of G, and for any two elements x and y of G, there exists a unique morphism from x to y if and only if x~y.
The advantages of regarding an equivalence relation as a special case of a groupoid include:
 Whereas the notion of "free equivalence relation" does not exist, that of a free groupoid on a directed graph does. Thus it is meaningful to speak of a "presentation of an equivalence relation," i.e., a presentation of the corresponding groupoid;
 Bundles of groups, group actions, sets, and equivalence relations can be regarded as special cases of the notion of groupoid, a point of view that suggests a number of analogies;
 In many contexts "quotienting," and hence the appropriate equivalence relations often called congruences, are important. This leads to the notion of an internal groupoid in a category.^{ [18]}
Lattices
The equivalence relations on any set X, when ordered by set inclusion, form a complete lattice, called Con X by convention. The canonical map ker: X^X → Con X, relates the monoid X^X of all functions on X and Con X. ker is surjective but not injective. Less formally, the equivalence relation ker on X, takes each function f: X→X to its kernel ker f. Likewise, ker(ker) is an equivalence relation on X^X.
Equivalence relations and mathematical logic
Equivalence relations are a ready source of examples or counterexamples. For example, an equivalence relation with exactly two infinite equivalence classes is an easy example of a theory which is ω categorical, but not categorical for any larger cardinal number.
An implication of model theory is that the properties defining a relation can be proved independent of each other (and hence necessary parts of the definition) if and only if, for each property, examples can be found of relations not satisfying the given property while satisfying all the other properties. Hence the three defining properties of equivalence relations can be proved mutually independent by the following three examples:
 Reflexive and transitive: The relation ≤ on N. Or any preorder;
 Symmetric and transitive: The relation R on N, defined as aRb ↔ ab ≠ 0. Or any partial equivalence relation;
 Reflexive and symmetric: The relation R on Z, defined as aRb ↔ "a − b is divisible by at least one of 2 or 3." Or any dependency relation.
Properties definable in firstorder logic that an equivalence relation may or may not possess include:
 The number of equivalence classes is finite or infinite;
 The number of equivalence classes equals the (finite) natural number n;
 All equivalence classes have infinite cardinality;
 The number of elements in each equivalence class is the natural number n.
Euclidean relations
Euclid's The Elements includes the following "Common Notion 1":
 Things which equal the same thing also equal one another.
Nowadays, the property described by Common Notion 1 is called Euclidean (replacing "equal" by "are in relation with"). By "relation" is meant a binary relation, in which aRb is generally distinct from bRa. A Euclidean relation thus comes in two forms:
 (aRc ∧ bRc) → aRb (LeftEuclidean relation)
 (cRa ∧ cRb) → aRb (RightEuclidean relation)
The following theorem connects Euclidean relations and equivalence relations:
 Theorem
 If a relation is (left or right) Euclidean and reflexive, it is also symmetric and transitive.
 Proof for a leftEuclidean relation
 (aRc ∧ bRc) → aRb [a/c] = (aRa ∧ bRa) → aRb [reflexive; erase T∧] = bRa → aRb. Hence R is symmetric.
 (aRc ∧ bRc) → aRb [symmetry] = (aRc ∧ cRb) → aRb. Hence R is transitive.
with an analogous proof for a rightEuclidean relation. Hence an equivalence relation is a relation that is Euclidean and reflexive. The Elements mentions neither symmetry nor reflexivity, and Euclid probably would have deemed the reflexivity of equality too obvious to warrant explicit mention.
See also
 Apartness relation
 Conjugacy class
 Equipollence (geometry)
 Quotient by an equivalence relation
 Topological conjugacy
 Up to
Notes
 ^ "Comprehensive List of Algebra Symbols". Math Vault. 20200325. Retrieved 20200830.
 ^ Weisstein, Eric W. "Equivalence Class". mathworld.wolfram.com. Retrieved 20200830.
 ^ ^{a} ^{b} ^{c} "7.3: Equivalence Classes". Mathematics LibreTexts. 20170920. Retrieved 20200830.
 ^ If: Given a, let a~b hold using seriality, then b~a by symmetry, hence a~a by transitivity. — Only if: Given a, choose b=a, then a~b by reflexivity.
 ^ Garrett Birkhoff and Saunders Mac Lane, 1999 (1967). Algebra, 3rd ed. p. 35, Th. 19. Chelsea.
 ^ Wallace, D. A. R., 1998. Groups, Rings and Fields. p. 31, Th. 8. SpringerVerlag.
 ^ Dummit, D. S., and Foote, R. M., 2004. Abstract Algebra, 3rd ed. p. 3, Prop. 2. John Wiley & Sons.
 ^ Karel Hrbacek & Thomas Jech (1999) Introduction to Set Theory, 3rd edition, pages 29–32, Marcel Dekker
 ^ Birkhoff, Garrett (1995), Lattice Theory, Colloquium Publications, 25 (3rd ed.), American Mathematical Society, ISBN 9780821810255. Sect. IV.9, Theorem 12, page 95
 ^ Garrett Birkhoff and Saunders Mac Lane, 1999 (1967). Algebra, 3rd ed. p. 33, Th. 18. Chelsea.
 ^ Rosen (2008), pp. 243–45. Less clear is §10.3 of Bas van Fraassen, 1989. Laws and Symmetry. Oxford Univ. Press.
 ^ Bas van Fraassen, 1989. Laws and Symmetry. Oxford Univ. Press: 246.
 ^ Wallace, D. A. R., 1998. Groups, Rings and Fields. SpringerVerlag: 22, Th. 6.
 ^ Wallace, D. A. R., 1998. Groups, Rings and Fields. SpringerVerlag: 24, Th. 7.

^
Proof.^{
[12]} Let
function composition interpret group multiplication, and function inverse interpret group inverse. Then G is a group under composition, meaning that ∀x ∈ A ∀g ∈ G ([g(x)] = [x]), because G satisfies the following four conditions:
 G is closed under composition. The composition of any two elements of G exists, because the domain and codomain of any element of G is A. Moreover, the composition of bijections is bijective;^{ [13]}
 Existence of identity function. The identity function, I(x) = x, is an obvious element of G;
 Existence of inverse function. Every bijective function g has an inverse g^{−1}, such that gg^{−1} = I;
 Composition associates. f(gh) = (fg)h. This holds for all functions over all domains.^{ [14]}
 ^ Wallace, D. A. R., 1998. Groups, Rings and Fields. SpringerVerlag: 202, Th. 6.
 ^ Dummit, D. S., and Foote, R. M., 2004. Abstract Algebra, 3rd ed. John Wiley & Sons: 114, Prop. 2.
 ^ Borceux, F. and Janelidze, G., 2001. Galois theories, Cambridge University Press, ISBN 0521803098
References
 Brown, Ronald, 2006. Topology and Groupoids. Booksurge LLC. ISBN 1419627228.
 Castellani, E., 2003, "Symmetry and equivalence" in Brading, Katherine, and E. Castellani, eds., Symmetries in Physics: Philosophical Reflections. Cambridge Univ. Press: 422–433.
 Robert Dilworth and Crawley, Peter, 1973. Algebraic Theory of Lattices. Prentice Hall. Chpt. 12 discusses how equivalence relations arise in lattice theory.
 Higgins, P.J., 1971. Categories and groupoids. Van Nostrand. Downloadable since 2005 as a TAC Reprint.
 John Randolph Lucas, 1973. A Treatise on Time and Space. London: Methuen. Section 31.
 Rosen, Joseph (2008) Symmetry Rules: How Science and Nature are Founded on Symmetry. SpringerVerlag. Mostly chapters. 9,10.
 Raymond Wilder (1965) Introduction to the Foundations of Mathematics 2nd edition, Chapter 28: Axioms defining equivalence, pp 48–50, John Wiley & Sons.
External links
 "Equivalence relation", Encyclopedia of Mathematics, EMS Press, 2001 [1994]
 Bogomolny, A., " Equivalence Relationship" cuttheknot. Accessed 1 September 2009
 Equivalence relation at PlanetMath
 OEIS sequence A231428 (Binary matrices representing equivalence relations)