TheInfoList

In
modular arithmetic #REDIRECT Modular arithmetic#REDIRECT Modular arithmetic In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), a ...
, the
integer An integer (from the Latin Latin (, or , ) is a classical language belonging to the Italic branch of the Indo-European languages. Latin was originally spoken in the area around Rome, known as Latium. Through the power of the Roman Re ...
s
coprime In number theory, two integer An integer (from the Latin wikt:integer#Latin, ''integer'' meaning "whole") is colloquially defined as a number that can be written without a Fraction (mathematics), fractional component. For example, 21, 4, 0, ...
(relatively prime) to ''n'' from the set $\$ of ''n'' non-negative integers form a
group A group is a number A number is a mathematical object used to counting, count, measurement, measure, and nominal number, label. The original examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with ...
under multiplication modulo ''n'', called the multiplicative group of integers modulo ''n''. Equivalently, the elements of this group can be thought of as the congruence classes, also known as ''residues'' modulo ''n'', that are coprime to ''n''. Hence another name is the group of primitive residue classes modulo ''n''. In the theory of rings, a branch of
abstract algebra In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematics), rings, field (mathema ...
, it is described as the
group of units In the branch of abstract algebra known as ring theory In algebra, ring theory is the study of ring (mathematics), rings—algebraic structures in which addition and multiplication are defined and have similar properties to those operations def ...
of the ring of integers modulo ''n''. Here ''units'' refers to elements with a
multiplicative inverse Image:Hyperbola one over x.svg, thumbnail, 300px, alt=Graph showing the diagrammatic representation of limits approaching infinity, The reciprocal function: . For every ''x'' except 0, ''y'' represents its multiplicative inverse. The graph forms a r ...
, which, in this ring, are exactly those coprime to ''n''. This
quotient group A quotient group or factor group is a math Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geome ...
, usually denoted $\left(\mathbb/n\mathbb\right)^\times$, is fundamental in
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of devoted primarily to the study of the s and . German mathematician (1777–1855) said, "Mathematics is the queen of the sciences—and number theory is the queen ...

. It has found applications in
cryptography Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia ''-logy'' is a suffix in the English language, used with words originally adapted from Ancient Greek ending in (''- ...

,
integer factorization In number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic function, integer-valued functions. German mathematician Carl Frie ...
, and
primality test A primality test is an algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specification ...
ing. It is an abelian,
finite Finite is the opposite of Infinity, infinite. It may refer to: * Finite number (disambiguation) * Finite set, a set whose cardinality (number of elements) is some natural number * Finite verb, a verb form that has a subject, usually being inflected ...
group whose order is given by
Euler's totient function The first thousand values of . The points on the top line represent when is a prime number, which is In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written ...
: $, \left(\mathbb/n\mathbb\right)^\times, =\varphi\left(n\right).$ For prime ''n'' the group is
cyclic Cycle or cyclic may refer to: Anthropology and social sciences * Cyclic history, a theory of history * Cyclical theory, a theory of American political history associated with Arthur Schlesinger, Sr. * Social cycle, various cycles in social scienc ...

and in general the structure is easy to describe, though even for prime ''n'' no general formula for finding generators is known.

# Group axioms

It is a straightforward exercise to show that, under multiplication, the set of
congruence class In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
es modulo ''n'' that are coprime to ''n'' satisfy the axioms for an
abelian group In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
. Indeed, ''a'' is coprime to ''n'' if and only if . Integers in the same congruence class satisfy , hence one is coprime to ''n'' if and only if the other is. Thus the notion of congruence classes modulo ''n'' that are coprime to ''n'' is well-defined. Since and implies , the set of classes coprime to ''n'' is closed under multiplication. Integer multiplication respects the congruence classes, that is, and implies . This implies that the multiplication is associative, commutative, and that the class of 1 is the unique multiplicative identity. Finally, given ''a'', the
multiplicative inverse Image:Hyperbola one over x.svg, thumbnail, 300px, alt=Graph showing the diagrammatic representation of limits approaching infinity, The reciprocal function: . For every ''x'' except 0, ''y'' represents its multiplicative inverse. The graph forms a r ...
of ''a'' modulo ''n'' is an integer ''x'' satisfying . It exists precisely when ''a'' is coprime to ''n'', because in that case and by Bézout's lemma there are integers ''x'' and ''y'' satisfying . Notice that the equation implies that ''x'' is coprime to ''n'', so the multiplicative inverse belongs to the group.

# Notation

The set of (congruence classes of) integers modulo ''n'' with the operations of addition and multiplication is a ring. It is denoted $\mathbb/n\mathbb$  or  $\mathbb/\left(n\right)$  (the notation refers to taking the
quotient In arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne' ...
of integers modulo the
ideal Ideal may refer to: Philosophy * Ideal (ethics) An ideal is a principle A principle is a proposition or value that is a guide for behavior or evaluation. In law Law is a system A system is a group of Interaction, interacting ...
$n\mathbb$ or $\left(n\right)$ consisting of the multiples of ''n''). Outside of number theory the simpler notation $\mathbb_n$ is often used, though it can be confused with the -adic integers when ''n'' is a prime number. The multiplicative group of integers modulo ''n'', which is the
group of units In the branch of abstract algebra known as ring theory In algebra, ring theory is the study of ring (mathematics), rings—algebraic structures in which addition and multiplication are defined and have similar properties to those operations def ...
in this ring, may be written as (depending on the author) $\left(\mathbb/n\mathbb\right)^\times,$   $\left(\mathbb/n\mathbb\right)^*,$   $\mathrm\left(\mathbb/n\mathbb\right),$   $\mathrm\left(\mathbb/n\mathbb\right)$   (for German ''Einheit'', which translates as ''unit''), $\mathbb_n^*$, or similar notations. This article uses $\left(\mathbb/n\mathbb\right)^\times.$ The notation $\mathrm_n$ refers to the
cyclic group In group theory The popular puzzle Rubik's cube invented in 1974 by Ernő Rubik has been used as an illustration of permutation group">Ernő_Rubik.html" ;"title="Rubik's cube invented in 1974 by Ernő Rubik">Rubik's cube invented in 1974 by Er ...

of order ''n''. It is
isomorphic In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...
to the group of integers modulo ''n'' under addition. Note that $\mathbb/n\mathbb$ or $\mathbb_n$ may also refer to the group under addition. For example, the multiplicative group $\left(\mathbb/p\mathbb\right)^\times$ for a prime ''p'' is cyclic and hence isomorphic to the additive group $\mathbb/\left(p-1\right)\mathbb$, but the isomorphism is not obvious.

# Structure

The order of the multiplicative group of integers modulo ''n'' is the number of integers in $\$ coprime to ''n''. It is given by
Euler's totient function The first thousand values of . The points on the top line represent when is a prime number, which is In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written ...
: $, \left(\mathbb/n\mathbb\right)^\times, =\varphi\left(n\right)$ . For prime ''p'', $\varphi\left(p\right)=p-1$.

## Cyclic case

The group $\left(\mathbb/n\mathbb\right)^\times$ is
cyclic Cycle or cyclic may refer to: Anthropology and social sciences * Cyclic history, a theory of history * Cyclical theory, a theory of American political history associated with Arthur Schlesinger, Sr. * Social cycle, various cycles in social scienc ...

if and only if ''n'' is 1, 2, 4, ''p''''k'' or 2''p''''k'', where ''p'' is an odd prime and . For all other values of ''n'' the group is not cyclic. This was first proved by
Gauss Johann Carl Friedrich Gauss (; german: Gauß ; la, Carolus Fridericus Gauss; 30 April 177723 February 1855) was a German mathematician This is a List of German mathematician A mathematician is someone who uses an extensive knowledge of m ...

. This means that for these ''n'': :$\left(\mathbb/n\mathbb\right)^\times \cong \mathrm_,$ where $\varphi\left(p^k\right)=\varphi\left(2 p^k\right)=p^k - p^.$ By definition, the group is cyclic if and only if it has a generator ''g'' (a
generating set In mathematics and physics, the term generator or generating set may refer to any of a number of related concepts. The underlying concept in each case is that of a smaller set (mathematics), set of objects, together with a set of Operation (mathe ...
of size one), that is, the powers $g^0,g^1,g^2,\dots,$ give all possible residues modulo ''n'' coprime to ''n'' (the first $\varphi\left(n\right)$ powers $g^0,\dots,g^$ give each exactly once). A generator of $\left(\mathbb/n\mathbb\right)^\times$ is called a primitive root modulo ''n''. If there is any generator, then there are $\varphi\left(\varphi\left(n\right)\right)$ of them.

## Powers of 2

Modulo 1 any two integers are congruent, i.e., there is only one congruence class, coprime to 1. Therefore, $\left(\mathbb/1\,\mathbb\right)^\times \cong \mathrm_1$ is the trivial group with element. Because of its trivial nature, the case of congruences modulo 1 is generally ignored and some authors choose not to include the case of ''n'' = 1 in theorem statements. Modulo 2 there is only one coprime congruence class, so $\left(\mathbb/2\mathbb\right)^\times \cong \mathrm_1$ is the
trivial groupIn mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...
. Modulo 4 there are two coprime congruence classes, and so $\left(\mathbb/4\mathbb\right)^\times \cong \mathrm_2,$ the cyclic group with two elements. Modulo 8 there are four coprime congruence classes, and The square of each of these is 1, so $\left(\mathbb/8\mathbb\right)^\times \cong \mathrm_2 \times \mathrm_2,$ the
Klein four-group In mathematics, the Klein four-group is a Group (mathematics), group with four elements, in which each element is Involution (mathematics), self-inverse (composing it with itself produces the identity) and in which composing any two of the three ...
. Modulo 16 there are eight coprime congruence classes and $\\cong \mathrm_2 \times \mathrm_2,$ is the 2-
torsion subgroupIn the theory of abelian group In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (math ...
(i.e., the square of each element is 1), so $\left(\mathbb/16\mathbb\right)^\times$ is not cyclic. The powers of 3, $\$ are a subgroup of order 4, as are the powers of 5, $\.$   Thus $\left(\mathbb/16\mathbb\right)^\times \cong \mathrm_2 \times \mathrm_4.$ The pattern shown by 8 and 16 holds for higher powers 2''k'', : $\\cong \mathrm_2 \times \mathrm_2,$ is the 2-torsion subgroup (so $\left(\mathbb/2^k\mathbb\right)^\times$ is not cyclic) and the powers of 3 are a cyclic subgroup of order , so $\left(\mathbb/2^k\mathbb\right)^\times \cong \mathrm_2 \times \mathrm_.$

## General composite numbers

By the
fundamental theorem of finite abelian groups In mathematics, an abelian group, also called a commutative group, is a group (mathematics), group in which the result of applying the group Operation (mathematics), operation to two group elements does not depend on the order in which they are ...
, the group $\left(\mathbb/n\mathbb\right)^\times$ is isomorphic to a
direct productIn mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...
of cyclic groups of prime power orders. More specifically, the
Chinese remainder theorem In number theory, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer An integer (from the Latin wikt:integer#Latin, ''integer'' meaning "whole") is colloquially defined as a number ...
says that if $\;\;n=p_1^p_2^p_3^\dots, \;$ then the ring $\mathbb/n\mathbb$ is the
direct productIn mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...
of the rings corresponding to each of its prime power factors: :$\mathbb/n\mathbb \cong \mathbb/\mathbb\; \times \;\mathbb/\mathbb \;\times\; \mathbb/\mathbb\dots\;\;$ Similarly, the group of units $\left(\mathbb/n\mathbb\right)^\times$ is the direct product of the groups corresponding to each of the prime power factors: :$\left(\mathbb/n\mathbb\right)^\times\cong \left(\mathbb/\mathbb\right)^\times \times \left(\mathbb/\mathbb\right)^\times \times \left(\mathbb/\mathbb\right)^\times \dots\;.$ For each odd prime power $p^$ the corresponding factor $\left(\mathbb/\mathbb\right)^\times$ is the cyclic group of order $\varphi\left(p^k\right)=p^k - p^$, which may further factor into cyclic groups of prime-power orders. For powers of 2 the factor $\left(\mathbb/\mathbb\right)^\times$ is not cyclic unless ''k'' = 0, 1, 2, but factors into cyclic groups as described above. The order of the group $\varphi\left(n\right)$ is the product of the orders of the cyclic groups in the direct product. The
exponent Exponentiation is a mathematical Mathematics (from Greek Greek may refer to: Greece Anything of, from, or related to Greece Greece ( el, Ελλάδα, , ), officially the Hellenic Republic, is a country located in Southeast Europ ...
of the group, that is, the
least common multiple In arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne', ...

of the orders in the cyclic groups, is given by the
Carmichael function In number theory, a branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathemati ...
$\lambda\left(n\right)$ . In other words, $\lambda\left(n\right)$ is the smallest number such that for each ''a'' coprime to ''n'', $a^ \equiv 1 \pmod n$ holds. It divides $\varphi\left(n\right)$ and is equal to it if and only if the group is cyclic.

# Subgroup of false witnesses

If ''n'' is composite, there exists a subgroup of the multiplicative group, called the "group of false witnesses", in which the elements, when raised to the power , are congruent to 1 modulo ''n''. (Because the residue 1 when raised to any power is congruent to 1 modulo ''n'', the set of such elements is nonempty.) One could say, because of
Fermat's Little Theorem Fermat's little theorem states that if is a prime number, then for any integer , the number is an integer multiple of . In the notation of modular arithmetic, this is expressed as :a^p \equiv a \pmod p. For example, if = 2 and = 7, then 27 = ...
, that such residues are "false positives" or "false witnesses" for the primality of ''n''. The number 2 is the residue most often used in this basic primality check, hence is famous since 2340 is congruent to 1 modulo 341, and 341 is the smallest such composite number (with respect to 2). For 341, the false witnesses subgroup contains 100 residues and so is of index 3 inside the 300 element multiplicative group mod 341.

## Examples

### ''n'' = 9

The smallest example with a nontrivial subgroup of false witnesses is . There are 6 residues coprime to 9: 1, 2, 4, 5, 7, 8. Since 8 is congruent to , it follows that 88 is congruent to 1 modulo 9. So 1 and 8 are false positives for the "primality" of 9 (since 9 is not actually prime). These are in fact the only ones, so the subgroup is the subgroup of false witnesses. The same argument shows that is a "false witness" for any odd composite ''n''.

### ''n'' = 91

For ''n'' = 91 (= 7 × 13), there are $\varphi\left(91\right)=72$ residues coprime to 91, half of them (i.e., 36 of them) are false witnesses of 91, namely 1, 3, 4, 9, 10, 12, 16, 17, 22, 23, 25, 27, 29, 30, 36, 38, 40, 43, 48, 51, 53, 55, 61, 62, 64, 66, 68, 69, 74, 75, 79, 81, 82, 87, 88, and 90, since for these values of ''x'', ''x''90 is congruent to 1 mod 91.

### ''n'' = 561

''n'' = 561 (= 3 × 11 × 17) is a
Carmichael number In number theory, a Carmichael number is a composite number n which satisfies the modular arithmetic In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical struc ...
, thus ''s''560 is congruent to 1 modulo 561 for any integer ''s'' coprime to 561. The subgroup of false witnesses is, in this case, not proper; it is the entire group of multiplicative units modulo 561, which consists of 320 residues.

# Examples

This table shows the cyclic decomposition of $\left(\mathbb/n\mathbb\right)^\times$ and a
generating set In mathematics and physics, the term generator or generating set may refer to any of a number of related concepts. The underlying concept in each case is that of a smaller set (mathematics), set of objects, together with a set of Operation (mathe ...
for ''n'' ≤ 128. The decomposition and generating sets are not unique; for example, $\displaystyle \begin\left(\mathbb/35\mathbb\right)^\times & \cong \left(\mathbb/5\mathbb\right)^\times \times \left(\mathbb/7\mathbb\right)^\times \cong \mathrm_4 \times \mathrm_6 \cong \mathrm_4 \times \mathrm_2 \times \mathrm_3 \cong \mathrm_2 \times \mathrm_ \cong \left(\mathbb/4\mathbb\right)^\times \times \left(\mathbb/13\mathbb\right)^\times \\ & \cong \left(\mathbb/52\mathbb\right)^\times \end$ (but $\not\cong \mathrm_ \cong \mathrm_8 \times \mathrm_3$). The table below lists the shortest decomposition (among those, the lexicographically first is chosen – this guarantees isomorphic groups are listed with the same decompositions). The generating set is also chosen to be as short as possible, and for ''n'' with primitive root, the smallest primitive root modulo ''n'' is listed. For example, take $\left(\mathbb/20\mathbb\right)^\times$. Then $\varphi\left(20\right)=8$ means that the order of the group is 8 (i.e., there are 8 numbers less than 20 and coprime to it); $\lambda\left(20\right)=4$ means the order of each element divides 4, that is, the fourth power of any number coprime to 20 is congruent to 1 (mod 20). The set generates the group, which means that every element of $\left(\mathbb/20\mathbb\right)^\times$ is of the form (where ''a'' is 0, 1, 2, or 3, because the element 3 has order 4, and similarly ''b'' is 0 or 1, because the element 19 has order 2). Smallest primitive root mod ''n'' are (0 if no root exists) :0, 1, 2, 3, 2, 5, 3, 0, 2, 3, 2, 0, 2, 3, 0, 0, 3, 5, 2, 0, 0, 7, 5, 0, 2, 7, 2, 0, 2, 0, 3, 0, 0, 3, 0, 0, 2, 3, 0, 0, 6, 0, 3, 0, 0, 5, 5, 0, 3, 3, 0, 0, 2, 5, 0, 0, 0, 3, 2, 0, 2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 5, 5, 0, 0, 0, 0, 3, 0, 2, 7, 2, 0, 0, 3, 0, 0, 3, 0, ... Numbers of the elements in a minimal generating set of mod ''n'' are :0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 3, 1, 2, 1, 2, 2, 1, 1, 3, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 3, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 1, 2, 2, 2, 2, 1, 3, 1, 1, 1, 3, 2, 1, 2, 3, 1, 2, ...

# See also

*
Lenstra elliptic curve factorization The Lenstra elliptic-curve factorization or the elliptic-curve factorization method (ECM) is a fast, sub-exponential running time, algorithm for integer factorization, which employs elliptic curves. For general-purpose computer, general-purpose fa ...

# References

The ''
Disquisitiones Arithmeticae Title page of the first edition The (Latin Latin (, or , ) is a classical language belonging to the Italic languages, Italic branch of the Indo-European languages. Latin was originally spoken in the area around Rome, known as Latium. Through ...
'' has been translated from Gauss's Ciceronian Latin into
English English usually refers to: * English language English is a West Germanic languages, West Germanic language first spoken in History of Anglo-Saxon England, early medieval England, which has eventually become the World language, leading lan ...

and
German German(s) may refer to: Common uses * of or related to Germany * Germans, Germanic ethnic group, citizens of Germany or people of German ancestry * For citizens of Germany, see also German nationality law * German language The German la ...

. The German edition includes all of his papers on number theory: all the proofs of
quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, struc ...
, the determination of the sign of the
Gauss sumIn algebraic number theory Title page of the first edition of Disquisitiones Arithmeticae, one of the founding works of modern algebraic number theory. Algebraic number theory is a branch of number theory that uses the techniques of abstract al ...
, the investigations into
biquadratic reciprocity Quartic or biquadratic reciprocity is a collection of theorems in elementary and algebraic number theory, algebraic number theory that state conditions under which the congruence relation, congruence ''x''4 ≡ ''p'' (mod ''q'') is solvable; ...
, and unpublished notes. * * * *

# External links

* *{{MathWorld , title=Primitive Root , id=PrimitiveRoot
Web-based tool to interactively compute group tables
by John Jones Finite groups Modular arithmetic Multiplication