|This article does not cite any references or sources. (December 2009)|
- This article is about equivalency in mathematics; for equivalency in music see equivalence class (music).
In mathematics, given a set X and an equivalence relation ~ on X, the equivalence class of an element n in X is the subset of all elements in X which are equivalent to n. Equivalence classes among elements of a structure are often used to produce a smaller structure whose elements are the classes, distilling a relationship every element of the class shares with at least one other element of another class. This is known as modding out by the class. The class may assume the identity of one of the original elements, as when fractions are put in reduced form.
Notation and formal definition 
An equivalence relation is a binary relation ~ satisfying three properties:
- For every element a in X, a ~ a (reflexivity),
- For every two elements a and b in X, if a ~ b, then b ~ a (symmetry)
- For every three elements a, b, and c in X, if a ~ b and b ~ c, then a ~ c (transitivity).
The equivalence class of an element a is denoted [a] and may be defined as the set
of elements that are related to a by ~. The alternative notation [a]R can be used to denote the equivalence class of the element a specifically with respect to the equivalence relation R. This is said to be the R-equivalence class of a.
The set of all equivalence classes in X given an equivalence relation ~ is denoted as X/~ and called the quotient set of X by ~. Each equivalence relation has a canonical projection map that maps each element to its equivalence class, the surjective function π from X to X/~ given by π(x) = [x].
Analogy with division 
This operation can be thought of as the act of dividing the input set by the equivalence relation, hence both the name "quotient", and the notation, which are both reminiscent of division. One way in which the quotient set resembles division is that if X is finite and the equivalence classes are all equinumerous, then the number of equivalence classes in X/~ can be calculated by dividing the number of elements in X by the number of elements in each equivalence class. The quotient set X/~ may be thought of as the set X with all the equivalent points identified.
- If X is the set of all cars, and ~ is the equivalence relation "has the same color as", then one particular equivalence class consists of all green cars. X/~ could be naturally identified with the set of all car colors (cardinality of X/~ would be the number of all car colors)
- Consider the modulo 2 equivalence relation on the set Z of integers: x ~ y if and only if their difference x − y is an even number. This relation gives rise to exactly two equivalence classes: one class consisting of all even numbers, and the other consisting of all odd numbers. Under this relation , , and  all represent the same element of Z/~.
- Let X be the set of ordered pairs of integers (a,b) with b not zero, and define an equivalence relation ~ on X according to which (a,b) ~ (c,d) if and only if ad = bc. Then the equivalence class of the pair (a,b) can be identified with the rational number a/b, and this equivalence relation and its equivalence classes can be used to give a formal definition of the set of rational numbers. The same construction can be generalized to the field of fractions of any integral domain.
Every element x of X is a member of the equivalence class [x]. Every two equivalence classes [x] and [y] are either equal or disjoint. Therefore, the set of all equivalence classes of X forms a partition of X: every element of X belongs to one and only one equivalence class. Conversely every partition of X comes from an equivalence relation in this way, according to which x ~ y if and only if x and y belong to the same set of the partition.
It follows from the properties of an equivalence relation that
- x ~ y if and only if [x] = [y].
In other words, if ~ is an equivalence relation on a set X, and x and y are two elements of X, then these statements are equivalent:
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 an invariant of ~, or well-defined under the relation ~.
A frequent particular case occurs when f is a function from X to another set Y; if f(x1) = f(x2) whenever x1 ~ x2, 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. Some authors use "compatible with ~" or just "respects ~" instead of "invariant under ~".
Any function f : X → Y itself defines an equivalence relation on X according to which x1 ~ x2 if and only if f(x1) = f(x2). The equivalence class of x is the set of all elements in X which get mapped to f(x), i.e. the class [x] is the inverse image of f(x). This equivalence relation is known as the kernel of f.
More generally, a function may map equivalent arguments (under an equivalence relation ~X on X) to equivalent values (under an equivalence relation ~Y on Y). Such a function is known as a morphism from ~X to ~Y.
See also 
- Equivalence partitioning, a method for devising test sets in software testing based on dividing the possible program inputs into equivalence classes according to the behavior of the program on those inputs
- Quotient group, a construction of mathematical groups from equivalence classes of larger groups