An equivalence class for the equivalence relation of congruence modulo n. So, two integers are in the same class if they have the same remainder upon division by n. If [a] denotes the residue class modulo n containing a, the residue classes modulo n can be represented as [0], [1], [2],…, [n−1]. The sum and product of residue classes are defined by
where it is necessary to show these definitions are well defined and independent of the choice of representatives a and b. With this addition and multiplication, the set, denoted by ℤn, of residue classes modulo n forms a commutative ring with identity. If n is composite, the ring ℤn has zero-divisors, but when p is prime ℤp is a field.