Congruence is an example of an equivalence relation. The leftmost two triangles are congruent, while the third and fourth triangles are not congruent to any other triangle shown here. Thus, the first two triangles are in the same equivalence class, while the third and fourth triangles are each in their own equivalence class.
In mathematics, when the elements of some set have a notion of equivalence (formalized as an equivalence relation), then one may naturally split the set into equivalence classes. These equivalence classes are constructed so that elements and belong to the same equivalence classif, and only if, they are equivalent.
Formally, given a set and an equivalence relation on the equivalence class of an element in denoted by  is the set
of elements which are equivalent to It may be proven, from the defining properties of equivalence relations, that the equivalence classes form a partition of This partition—the set of equivalence classes—is sometimes called the quotient set or the quotient space of by and is denoted by .
If is the set of all cars, and is the equivalence relation "has the same color as", then one particular equivalence class would consist of all green cars, and could be naturally identified with the set of all car colors.
Let be the set of all rectangles in a plane, and the equivalence relation "has the same area as", then for each positive real number there will be an equivalence class of all the rectangles that have area 
Consider the modulo 2 equivalence relation on the set of integers, such that if and only if their difference is an even number. This relation gives rise to exactly two equivalence classes: one class consists of all even numbers, and the other class consists of all odd numbers. Using square brackets around one member of the class to denote an equivalence class under this relation, and all represent the same element of 
Let be the set of ordered pairs of integers with non-zero and define an equivalence relation on such that if and only if then the equivalence class of the pair can be identified with the rational number 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.
The equivalence class of an element is often denoted or and is defined as the set of elements that are related to by  The word "class" in the term "equivalence class" may generally be considered as a synonym of "set", although some equivalence classes are not sets but proper classes. For example, "being isomorphic" is an equivalence relation on groups, and the equivalence classes, called isomorphism classes, are not sets.
The set of all equivalence classes in with respect to an equivalence relation is denoted as and is called modulo (or the quotient set of by ). The surjective map from onto which maps each element to its equivalence class, is called the canonical surjection, or the canonical projection.
Every element of an equivalence class characterizes the class, and may be used to represent it. When such an element is chosen, it is called a representative of the class. The choice of a representative in each class defines an injection from to X. Since its composition with the canonical surjection is the identity of such an injection is called a section, when using the terminology of category theory.
Sometimes, there is a section that is more "natural" than the other ones. In this case, the representatives are called canonical representatives. For example, in modular arithmetic, for every integerm greater than 1, the congruence modulo m is an equivalence relation on the integers, for which two integers a and b are equivalent—in this case, one says congruent —if m divides this is denoted Each class contains a unique non-negative integer smaller than and these integers are the canonical representatives.
The use of representatives for representing classes allows avoiding to consider explicitly classes as sets. In this case, the canonical surjection that maps an element to its class is replaced by the function that maps an element to the representative of its class. In the preceding example, this function is denoted and produces the remainder of the Euclidean division of a by m.
Every element of is a member of the equivalence class Every two equivalence classes and are either equal or disjoint. Therefore, the set of all equivalence classes of forms a partition of : every element of belongs to one and only one equivalence class. Conversely, every partition of comes from an equivalence relation in this way, according to which if and only if and belong to the same set of the partition.
It follows from the properties of an equivalence relation that
if and only if
In other words, if is an equivalence relation on a set and and are two elements of then these statements are equivalent:
If is an equivalence relation on and is a property of elements of such that whenever is true if is true, then the property is said to be an invariant of or well-defined under the relation
A frequent particular case occurs when is a function from to another set ; if whenever then is said to be class invariant under or simply invariant under This occurs, for example, in the character theory of finite groups. Some authors use "compatible with " or just "respects " instead of "invariant under ".
Any function is class invariant under according to which if and only if The equivalence class of is the set of all elements in which get mapped to that is, the class is the inverse image of This equivalence relation is known as the kernel of
More generally, a function may map equivalent arguments (under an equivalence relation on ) to equivalent values (under an equivalence relation on ). Such a function is a morphism of sets equipped with an equivalence relation.
Quotient space in topology
In topology, a quotient space is a topological space formed on the set of equivalence classes of an equivalence relation on a topological space, using the original space's topology to create the topology on the set of equivalence classes.
The orbits of a group action on a set may be called the quotient space of the action on the set, particularly when the orbits of the group action are the right cosets of a subgroup of a group, which arise from the action of the subgroup on the group by left translations, or respectively the left cosets as orbits under right translation.
A normal subgroup of a topological group, acting on the group by translation action, is a quotient space in the senses of topology, abstract algebra, and group actions simultaneously.
Although the term can be used for any equivalence relation's set of equivalence classes, possibly with further structure, the intent of using the term is generally to compare that type of equivalence relation on a set either to an equivalence relation that induces some structure on the set of equivalence classes from a structure of the same kind on or to the orbits of a group action. Both the sense of a structure preserved by an equivalence relation, and the study of invariants under group actions, lead to the definition of invariants of equivalence relations given above.
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