Chinese remainder theorem for noncoprime moduli Created 2026-10-13 Updated 2026-10-20
For positive integer moduli , the simultaneous integer congruences and are solvable exactly when . When solvable, they determine a unique congruence class modulo . To see the condition, put : the remaining equation is the linear congruence , which is solvable exactly when the greatest common divisor divides .
For example, and give , hence and . Thus . Changing the second remainder to two makes the conditions incompatible: the first requires an odd integer, while the second requires an even integer. Article 32 of Carl Friedrich Gauss's Disquisitiones arithmeticae gives a successive construction for simultaneous remainders, including the greatest common divisor and least common multiple that enter this general case. [ref]
Commutative ring Created 2026-09-24 Updated 2026-10-14
A commutative ring is a ring in which multiplication satisfies for every pair. The integers and the polynomial ring are examples. So is , the quotient ring whose elements are residue classes in modular arithmetic. We represent these by and reduce each sum or product to its remainder. All following calculations modulo use this convention.
In , , although neither factor is zero. Thus and are zero divisors: nonzero elements whose product with another nonzero element can vanish. Also . Removing the common factor would falsely assert . The entire row for multiplication by is
The repetitions explain the linear congruences directly. The equation has exactly the two solutions , whereas has none. A common factor can erase information, and a nonzero coefficient does not guarantee that an equation has a solution.
Figure 1.
Multiplication modulo 6 repeats outputs, while every nonzero row modulo 5 is a permutation
. Details.
A unit in a ring is an element with a multiplicative inverse, meaning for some . In , the units are exactly and , since . The other nonzero elements, , are zero divisors; for , use . In a nonzero commutative ring, a unit cannot be a zero divisor: multiplying by its multiplicative inverse forces . But a nonzero element need not be a unit or a zero divisor: the integer is neither in .
By contrast, in , every row for a nonzero multiplier is a permutation of . Each such row contains exactly once, giving a multiplicative inverse: , , , and . Hence this commutative ring is a field. For example, now has the unique solution . Reading the tables reveals which algebraic steps the arithmetic permits.
Let . A supported sample guarantees . Dividing its linear congruence by gives an invertible coefficient modulo and a unique residue there. The compatible discrete logarithms modulo are for . Only determines the discrete logarithm from the sample alone; conveys no information for .
Modular arithmetic Created 2026-10-03 Updated 2026-10-18
Modular arithmetic performs addition and multiplication on integers while remembering only their remainders for a fixed positive integer modulus . The relation means that divides : the two integers lie in the same congruence class. For example, , and represent one class modulo . Choosing the least nonnegative residue gives exactly representatives, , even though each congruence class contains infinitely many integers.
A clock supplies a familiar example. Represent the twelve positions by , with at the position usually labelled twelve. Starting at ten and moving seven positions gives
The integer congruence records the final position; it discards the number of complete revolutions. Adding another twelve changes the elapsed count while preserving the position. The picture also shows a single congruence class modulo five spread along the number line.
Figure 1.
Clock addition wraps modulo twelve, while integers separated by five represent one congruence class
. Details.
The useful surprise is that discarding this information still preserves the arithmetic. If and modulo , then and modulo . Thus a large calculation can reduce its intermediate integers after every step. For instance,
Replacing by gives the same answers with smaller intermediate values. The congruence classes with these operations form the quotient ring ; their addition alone forms a cyclic group. This passage from integers to a finite arithmetic system is the setting for modular exponentiation, primality testing and the RSA cryptosystem. [ref]
Multiplicative cancellation needs extra care. Modulo six, , but : multiplication by two has merged distinct congruence classes. Cancelling a factor while retaining the integer modulus is justified when that factor has a modular multiplicative inverse, equivalently when it is coprime to the integer modulus. A linear congruence can consequently have no solutions, one solution class, or several solution classes. The Chinese remainder theorem supplies a complementary operation: splitting a calculation across coprime integer moduli and reconstructing its class modulo their product.
Small remainders can also certify impossibility. A perfect square has residue zero or one modulo four, as checking the four congruence classes shows. Therefore an integer equation has no solution. The converse direction needs care: a permitted residue does not guarantee an integer solution, since but five is not a perfect square. Such local tests provide necessary conditions for Diophantine equations without replacing the full problem.
In Disquisitiones arithmeticae (1801), Carl Friedrich Gauss defines integer congruence in article 1 and adopts the symbol in article 2. Article 12 derives divisibility tests from powers of ten and explains checking arithmetic by its remainders. These passages show a systematic treatment of the same idea; they are not a claim that remainders were first used in 1801. [ref]
Divide the linear congruence by the common factor , also dividing its modulus:
The Bézout's identity from part (a) makes the inverse of modulo . Multiplication by therefore gives . Thus all integer solutions are . Equivalently, the three solution classes modulo are ; using modulus must not discard two of these classes.
Let . If the linear congruence holds, then for some integer , so the greatest common divisor divides . Conversely, Bézout's identity gives integers with . If , multiply this identity by to obtain . Hence
For the number of solutions, write , and . The linear congruence becomes , where are coprime integers. Multiplication by is invertible modulo by Bézout's identity, so the solutions form one residue class . Modulo , these are exactly
They are distinct: if two have the same residue class modulo , then divides , forcing ; with , this forces . Every other solution differs from by a multiple of , so these exhaust the solutions.
Finally,
Combining this with the existence criterion gives the requested equivalent modular congruence.
Take a generator of the multiplicative group of a finite field , which has order . Write . Since any possible nonzero base is , the condition of being a th power is
By part (a), this linear congruence is soluble exactly when divides . Meanwhile
Thus the required test is
The exponent residue classes divisible by are , so there are exactly distinct nonzero th powers. Equivalently, part (a) shows each value has exactly preimages under the power map.
Subtracting twice the first linear congruence from the second gives . Since , the modular inverse of modulo is . Thus . Substitution in the first linear congruence then gives , whence . All integer solutions are
The two free integers are independent. Conversely, these values give and , so no additional restriction is needed.
Apply the same positive-exponent quantum Fourier transform to each of the two quantum registers. The amplitude at of the coset state is
The finite geometric series is when and zero otherwise. Therefore
There are allowed pairs, with following the uniform distribution on a finite set. The factor changes the probability amplitudes by phases depending on the output label , but has no effect on their probabilities. Using an inverse rather than forward quantum Fourier transform on both quantum registers gives the same support relation.
A modular inverse of exists precisely when . In that case the discrete logarithm is
It cannot generally be determined from every allowed pair. Put . The supported linear congruence has solutions modulo , and determines only modulo ; gives no information when . For instance and are compatible with both and . One may verify a candidate by modular exponentiation, checking . Repeated discrete-logarithm Fourier sampling finds an invertible with per-trial probability , which has the same totient lower bound from the Mertens product as before. When , the group is trivial and are determined without Fourier samples.
The Euclidean algorithm gives
so . Since , the criterion for a linear congruence guarantees a solution. One can also exhibit it directly: , or in the original coefficients,
Thus is a solution, with an explicit Bézout coefficient certificate.
Unit modulo n Created 2026-09-29 Updated 2026-10-14
For a positive integer modulus , a residue class is a unit when it has a modular multiplicative inverse: some integer satisfies . Modulo twelve, the units are exactly
In particular, five is its own modular inverse, since . Multiplying all twelve residue classes by five gives a permutation; multiplying the outputs by five recovers the inputs. By contrast, multiplying by six gives only zero and six, with six inputs for each output. It cannot be reversed.
Figure 1.
Multiplication by five permutes all twelve residue classes, whereas multiplication by six merges distinct inputs
. Details.
In general, the exact criterion is
For the forward direction, implies every common divisor of divides one. Conversely, if their greatest common divisor is one, Bézout's identity supplies , so is a modular inverse. The extended Euclidean algorithm computes these coefficients. The units form the unit group under multiplication. [ref]
Multiplicative cancellation while keeping the same integer modulus is valid for a unit modulo n: from , multiply by a modular inverse of to get . A nonunit cannot be cancelled as a general rule. For example, , yet . Thus division by six cannot undo this multiplication; solving a linear congruence instead keeps track of all possible classes.
This distinction marks the boundary between commutative rings and fields. Modulo a prime number , every nonzero residue class is a unit, so is a finite field. Modulo twelve it is a commutative ring with zero divisors, and is not a field. For , the sole class satisfies and is a unit; this one-element zero ring is not a field. [ref]