Modular arithmetic

From Wikipedia, the free encyclopedia
(Redirected from Congruence class)
Jump to navigation Jump to search

Template:Short description Script error: No such module "about". Script error: No such module "Unsubst".

File:Clock group.svg
Time-keeping on this clock uses arithmetic modulo 12. Adding 4 hours to 9 o'clock gives 1 o'clock, since 13 is congruent to 1 modulo 12.

In mathematics, modular arithmetic is a system of arithmetic operations for integers, other than the usual ones from elementary arithmetic, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801.

A familiar example of modular arithmetic is the hour hand on a 12-hour clock. If the hour hand points to 7 now, then 8 hours later it will point to 3. Ordinary addition would result in 7 + 8 = 15, but 15 reads as 3 on the clock face. This is because the hour hand makes one rotation every 12 hours and the hour number starts over when the hour hand passes 12. We say that 15 is congruent to 3 modulo 12, written 15 ≡ 3 (mod 12), so that 7 + 8 ≡ 3 (mod 12).

Similarly, if one starts at 12 and waits 8 hours, the hour hand will be at 8. If one instead waited twice as long, 16 hours, the hour hand would be on 4. This can be written as 2 × 8 ≡ 4 (mod 12). Note that after a wait of exactly 12 hours, the hour hand will always be right where it was before, so 12 acts the same as zero, thus 12 ≡ 0 (mod 12).

Congruence

Given an integer m ≥ 1Script error: No such module "Check for unknown parameters"., called a modulus, two integers Template:Mvar and Template:Mvar are said to be congruent modulo Template:Mvar, if Template:Mvar is a divisor of their difference; that is, if there is an integer kScript error: No such module "Check for unknown parameters". such that

ab = k mScript error: No such module "Check for unknown parameters"..

Congruence modulo Template:Mvar is a congruence relation, meaning that it is an equivalence relation that is compatible with addition, subtraction, and multiplication. Congruence modulo Template:Mvar is denoted by

ab(mod m).

The parentheses mean that (mod m)Script error: No such module "Check for unknown parameters". applies to the entire equation, not just to the right-hand side (here, Template:Mvar).

This notation is not to be confused with the notation b mod mScript error: No such module "Check for unknown parameters". (without parentheses), which refers to the remainder of bScript error: No such module "Check for unknown parameters". when divided by mScript error: No such module "Check for unknown parameters"., known as the modulo operation: that is, b mod mScript error: No such module "Check for unknown parameters". denotes the unique integer Template:Mvar such that 0 ≤ r < mScript error: No such module "Check for unknown parameters". and rb (mod m)Script error: No such module "Check for unknown parameters".. Indeed, the expression b mod mScript error: No such module "Check for unknown parameters". does not appear in the statement ab (mod m)Script error: No such module "Check for unknown parameters"., since it is parsed as

(ab)modm.

The congruence relation may be rewritten as

a = k m + bScript error: No such module "Check for unknown parameters".,

explicitly showing its relationship with Euclidean division. However, the bScript error: No such module "Check for unknown parameters". here need not be the remainder in the division of aScript error: No such module "Check for unknown parameters". by m.Script error: No such module "Check for unknown parameters". Rather, ab (mod m)Script error: No such module "Check for unknown parameters". asserts that aScript error: No such module "Check for unknown parameters". and bScript error: No such module "Check for unknown parameters". have the same remainder when divided by mScript error: No such module "Check for unknown parameters".. That is,

a = p m + rScript error: No such module "Check for unknown parameters".,
b = q m + rScript error: No such module "Check for unknown parameters".,

where 0 ≤ r < mScript error: No such module "Check for unknown parameters". is the common remainder. We recover the previous relation (ab = k mScript error: No such module "Check for unknown parameters".) by subtracting these two expressions and setting k = pq.Script error: No such module "Check for unknown parameters".

Because the congruence modulo Template:Mvar is defined by the divisibility by Template:Mvar and because −1Script error: No such module "Check for unknown parameters". is a unit in the ring of integers, a number is divisible by mScript error: No such module "Check for unknown parameters". exactly if it is divisible by Template:Mvar. This means that every non-zero integer Template:Mvar may be taken as a modulus.

Examples

In modulus 12, one can assert that:

38 ≡ 14 (mod 12)Script error: No such module "Check for unknown parameters".

because the difference is 38 − 14 = 24 = 2 × 12Script error: No such module "Check for unknown parameters"., a multiple of 12Script error: No such module "Check for unknown parameters".. Equivalently, 38Script error: No such module "Check for unknown parameters". and 14Script error: No such module "Check for unknown parameters". have the same remainder 2Script error: No such module "Check for unknown parameters". when divided by 12Script error: No such module "Check for unknown parameters"..

The definition of congruence also applies to negative values. For example:

23(mod5)8+7(mod5)38(mod5).

Basic properties

Script error: No such module "anchor". The congruence relation satisfies all the conditions of an equivalence relation:

  • Reflexivity: aa (mod m)Script error: No such module "Check for unknown parameters".
  • Symmetry: ab (mod m)Script error: No such module "Check for unknown parameters". if and only if ba (mod m)Script error: No such module "Check for unknown parameters"..
  • Transitivity: If ab (mod m)Script error: No such module "Check for unknown parameters". and bc (mod m)Script error: No such module "Check for unknown parameters"., then ac (mod m)Script error: No such module "Check for unknown parameters".

If a1b1 (mod m)Script error: No such module "Check for unknown parameters". and a2b2 (mod m)Script error: No such module "Check for unknown parameters"., or if ab (mod m)Script error: No such module "Check for unknown parameters"., then:[1]

  • a + kb + k (mod m)Script error: No such module "Check for unknown parameters". for any integer kScript error: No such module "Check for unknown parameters". (compatibility with translation)
  • k ak b (mod m)Script error: No such module "Check for unknown parameters". for any integer kScript error: No such module "Check for unknown parameters". (compatibility with scaling)
  • k ak b (mod k m)Script error: No such module "Check for unknown parameters". for any integer kScript error: No such module "Check for unknown parameters".
  • a1 + a2b1 + b2 (mod m)Script error: No such module "Check for unknown parameters". (compatibility with addition)
  • a1a2b1b2 (mod m)Script error: No such module "Check for unknown parameters". (compatibility with subtraction)
  • a1 a2b1 b2 (mod m)Script error: No such module "Check for unknown parameters". (compatibility with multiplication)
  • akbk (mod m)Script error: No such module "Check for unknown parameters". for any non-negative integer kScript error: No such module "Check for unknown parameters". (compatibility with exponentiation)
  • p(a) ≡ p(b) (mod m)Script error: No such module "Check for unknown parameters"., for any polynomial p(x)Script error: No such module "Check for unknown parameters". with integer coefficients (compatibility with polynomial evaluation)

If ab (mod m)Script error: No such module "Check for unknown parameters"., then it is generally false that kakb (mod m)Script error: No such module "Check for unknown parameters".. However, the following is true:

  • If cd (mod φ(m)),Script error: No such module "Check for unknown parameters". where φScript error: No such module "Check for unknown parameters". is Euler's totient function, then acad (mod m)Script error: No such module "Check for unknown parameters".—provided that aScript error: No such module "Check for unknown parameters". is coprime with mScript error: No such module "Check for unknown parameters"..

If ab (mod mn)Script error: No such module "Check for unknown parameters"., then ab (mod m)Script error: No such module "Check for unknown parameters". and ab (mod n)Script error: No such module "Check for unknown parameters"..

For cancellation of common terms, we have the following rules:

  • If a + kb + k (mod m)Script error: No such module "Check for unknown parameters"., where kScript error: No such module "Check for unknown parameters". is any integer, then ab (mod m)Script error: No such module "Check for unknown parameters"..
  • If k ak b (mod m)Script error: No such module "Check for unknown parameters". and kScript error: No such module "Check for unknown parameters". is coprime with mScript error: No such module "Check for unknown parameters"., then ab (mod m)Script error: No such module "Check for unknown parameters"..
  • If k ak b (mod k m)Script error: No such module "Check for unknown parameters". and k ≠ 0Script error: No such module "Check for unknown parameters"., then ab (mod m)Script error: No such module "Check for unknown parameters"..

The last rule can be used to move modular arithmetic into division. If bScript error: No such module "Check for unknown parameters". divides aScript error: No such module "Check for unknown parameters"., then (a/b) mod m = (a mod b m) / bScript error: No such module "Check for unknown parameters"..

The modular multiplicative inverse is defined by the following rules:

  • Existence: There exists an integer denoted a−1Script error: No such module "Check for unknown parameters". such that aa−1 ≡ 1 (mod m)Script error: No such module "Check for unknown parameters". if and only if aScript error: No such module "Check for unknown parameters". is coprime with mScript error: No such module "Check for unknown parameters".. This integer a−1Script error: No such module "Check for unknown parameters". is called a modular multiplicative inverse of Template:Mvar modulo mScript error: No such module "Check for unknown parameters"..
  • If ab (mod m)Script error: No such module "Check for unknown parameters". and a−1Script error: No such module "Check for unknown parameters". exists, then a−1b−1 (mod m)Script error: No such module "Check for unknown parameters". (compatibility with multiplicative inverse, and, if a = bScript error: No such module "Check for unknown parameters"., uniqueness modulo mScript error: No such module "Check for unknown parameters".).
  • If axb (mod m)Script error: No such module "Check for unknown parameters". and aScript error: No such module "Check for unknown parameters". is coprime to mScript error: No such module "Check for unknown parameters"., then the solution to this linear congruence is given by xa−1b (mod m)Script error: No such module "Check for unknown parameters"..

The multiplicative inverse xa−1 (mod m)Script error: No such module "Check for unknown parameters". may be efficiently computed by solving Bézout's equation a x + m y = 1Script error: No such module "Check for unknown parameters". for xScript error: No such module "Check for unknown parameters"., yScript error: No such module "Check for unknown parameters"., by using the Extended Euclidean algorithm.

In particular, if pScript error: No such module "Check for unknown parameters". is a prime number, then aScript error: No such module "Check for unknown parameters". is coprime with pScript error: No such module "Check for unknown parameters". for every aScript error: No such module "Check for unknown parameters". such that 0 < a < pScript error: No such module "Check for unknown parameters".; thus a multiplicative inverse exists for all aScript error: No such module "Check for unknown parameters". that is not congruent to zero modulo pScript error: No such module "Check for unknown parameters"..

Advanced properties

Some of the more advanced properties of congruence relations are the following:

  • Fermat's little theorem: If pScript error: No such module "Check for unknown parameters". is prime and does not divide aScript error: No such module "Check for unknown parameters"., then aTemplate:I sup ≡ 1 (mod p)Script error: No such module "Check for unknown parameters"..
  • Euler's theorem: If aScript error: No such module "Check for unknown parameters". and mScript error: No such module "Check for unknown parameters". are coprime, then aTemplate:I sup ≡ 1 (mod m)Script error: No such module "Check for unknown parameters"., where φScript error: No such module "Check for unknown parameters". is Euler's totient function.
  • A simple consequence of Fermat's little theorem is that if pScript error: No such module "Check for unknown parameters". is prime, then a−1aTemplate:I sup (mod p)Script error: No such module "Check for unknown parameters". is the multiplicative inverse of 0 < a < pScript error: No such module "Check for unknown parameters".. More generally, from Euler's theorem, if aScript error: No such module "Check for unknown parameters". and mScript error: No such module "Check for unknown parameters". are coprime, then aTemplate:I supaTemplate:I sup (mod m)Script error: No such module "Check for unknown parameters".. Hence, if ax1 (mod m)Script error: No such module "Check for unknown parameters"., then xaTemplate:I sup (mod m)Script error: No such module "Check for unknown parameters"..
  • Another simple consequence is that if ab (mod φ(m))Script error: No such module "Check for unknown parameters"., where φScript error: No such module "Check for unknown parameters". is Euler's totient function, then kakb (mod m)Script error: No such module "Check for unknown parameters". provided kScript error: No such module "Check for unknown parameters". is coprime with mScript error: No such module "Check for unknown parameters"..
  • Wilson's theorem: pScript error: No such module "Check for unknown parameters". is prime if and only if (p − 1)! ≡ −1 (mod p)Script error: No such module "Check for unknown parameters"..
  • Chinese remainder theorem: For any aScript error: No such module "Check for unknown parameters"., bScript error: No such module "Check for unknown parameters". and coprime mScript error: No such module "Check for unknown parameters"., nScript error: No such module "Check for unknown parameters"., there exists a unique x (mod mn)Script error: No such module "Check for unknown parameters". such that xa (mod m)Script error: No such module "Check for unknown parameters". and xb (mod n)Script error: No such module "Check for unknown parameters".. In fact, xb mn−1 m + a nm−1 n (mod mn)Script error: No such module "Check for unknown parameters". where mn−1Script error: No such module "Check for unknown parameters". is the inverse of mScript error: No such module "Check for unknown parameters". modulo nScript error: No such module "Check for unknown parameters". and nm−1Script error: No such module "Check for unknown parameters". is the inverse of nScript error: No such module "Check for unknown parameters". modulo mScript error: No such module "Check for unknown parameters"..
  • Lagrange's theorem: If pScript error: No such module "Check for unknown parameters". is prime and f (x) = a0 xd + ... + adScript error: No such module "Check for unknown parameters". is a polynomial with integer coefficients such that Template:Mvar is not a divisor of a0Script error: No such module "Check for unknown parameters"., then the congruence f (x) ≡ 0 (mod p)Script error: No such module "Check for unknown parameters". has at most dScript error: No such module "Check for unknown parameters". non-congruent solutions.
  • Primitive root modulo mScript error: No such module "Check for unknown parameters".: A number gScript error: No such module "Check for unknown parameters". is a primitive root modulo mScript error: No such module "Check for unknown parameters". if, for every integer aScript error: No such module "Check for unknown parameters". coprime to mScript error: No such module "Check for unknown parameters"., there is an integer kScript error: No such module "Check for unknown parameters". such that gka (mod m)Script error: No such module "Check for unknown parameters".. A primitive root modulo mScript error: No such module "Check for unknown parameters". exists if and only if mScript error: No such module "Check for unknown parameters". is equal to 2, 4, pkScript error: No such module "Check for unknown parameters". or 2pkScript error: No such module "Check for unknown parameters"., where pScript error: No such module "Check for unknown parameters". is an odd prime number and kScript error: No such module "Check for unknown parameters". is a positive integer. If a primitive root modulo mScript error: No such module "Check for unknown parameters". exists, then there are exactly φ(φ(m))Script error: No such module "Check for unknown parameters". such primitive roots, where φScript error: No such module "Check for unknown parameters". is the Euler's totient function.
  • Quadratic residue: An integer aScript error: No such module "Check for unknown parameters". is a quadratic residue modulo mScript error: No such module "Check for unknown parameters"., if there exists an integer xScript error: No such module "Check for unknown parameters". such that x2a (mod m)Script error: No such module "Check for unknown parameters".. Euler's criterion asserts that, if pScript error: No such module "Check for unknown parameters". is an odd prime, and Template:Mvar is not a multiple of Template:Mvar, then aScript error: No such module "Check for unknown parameters". is a quadratic residue modulo pScript error: No such module "Check for unknown parameters". if and only if
    aTemplate:I sup ≡ 1 (mod p)Script error: No such module "Check for unknown parameters"..

Congruence classes

The congruence relation is an equivalence relation. The equivalence class modulo Template:Mvar of an integer aScript error: No such module "Check for unknown parameters". is the set of all integers of the form a + k mScript error: No such module "Check for unknown parameters"., where Template:Mvar is any integer. It is called the congruence class or residue class of aScript error: No such module "Check for unknown parameters". modulo mScript error: No such module "Check for unknown parameters"., and may be denoted (a mod m)Script error: No such module "Check for unknown parameters"., or as aScript error: No such module "Check for unknown parameters". or [a]Script error: No such module "Check for unknown parameters". when the modulus mScript error: No such module "Check for unknown parameters". is known from the context.

Each residue class modulo mScript error: No such module "Check for unknown parameters". contains exactly one integer in the range 0,...,|m|1. Thus, these |m| integers are representatives of their respective residue classes.

It is generally easier to work with integers than sets of integers; that is, the representatives most often considered, rather than their residue classes.

Consequently, (a mod m)Script error: No such module "Check for unknown parameters". denotes generally the unique integer Template:Mvar such that 0 ≤ r < mScript error: No such module "Check for unknown parameters". and ra (mod m)Script error: No such module "Check for unknown parameters".; it is called the residue of aScript error: No such module "Check for unknown parameters". modulo mScript error: No such module "Check for unknown parameters"..

In particular, (a mod m) = (b mod m)Script error: No such module "Check for unknown parameters". is equivalent to ab (mod m)Script error: No such module "Check for unknown parameters"., and this explains why "=Script error: No such module "Check for unknown parameters"." is often used instead of "Script error: No such module "Check for unknown parameters"." in this context.

Residue systems

Each residue class modulo mScript error: No such module "Check for unknown parameters". may be represented by any one of its members, although we usually represent each residue class by the smallest nonnegative integer which belongs to that class[2] (since this is the proper remainder which results from division). Any two members of different residue classes modulo mScript error: No such module "Check for unknown parameters". are incongruent modulo mScript error: No such module "Check for unknown parameters".. Furthermore, every integer belongs to one and only one residue class modulo mScript error: No such module "Check for unknown parameters"..[3]

The set of integers Template:MsetScript error: No such module "Check for unknown parameters". is called the least residue system modulo mScript error: No such module "Check for unknown parameters".. Any set of mScript error: No such module "Check for unknown parameters". integers, no two of which are congruent modulo mScript error: No such module "Check for unknown parameters"., is called a complete residue system modulo mScript error: No such module "Check for unknown parameters"..

The least residue system is a complete residue system, and a complete residue system is simply a set containing precisely one representative of each residue class modulo mScript error: No such module "Check for unknown parameters"..[4] For example, the least residue system modulo 4Script error: No such module "Check for unknown parameters". is Template:MsetScript error: No such module "Check for unknown parameters".. Some other complete residue systems modulo 4Script error: No such module "Check for unknown parameters". include:

  • Template:MsetScript error: No such module "Check for unknown parameters".
  • Template:MsetScript error: No such module "Check for unknown parameters".
  • Template:MsetScript error: No such module "Check for unknown parameters".
  • Template:MsetScript error: No such module "Check for unknown parameters".
  • Template:MsetScript error: No such module "Check for unknown parameters".
  • Template:MsetScript error: No such module "Check for unknown parameters".

Some sets that are not complete residue systems modulo 4 are:

  • Template:MsetScript error: No such module "Check for unknown parameters"., since 6Script error: No such module "Check for unknown parameters". is congruent to 22Script error: No such module "Check for unknown parameters". modulo 4Script error: No such module "Check for unknown parameters"..
  • Template:MsetScript error: No such module "Check for unknown parameters"., since a complete residue system modulo 4Script error: No such module "Check for unknown parameters". must have exactly 4Script error: No such module "Check for unknown parameters". incongruent residue classes.

Reduced residue systems

Script error: No such module "Labelled list hatnote".

Given the Euler's totient function φ(m)Script error: No such module "Check for unknown parameters"., any set of φ(m)Script error: No such module "Check for unknown parameters". integers that are relatively prime to mScript error: No such module "Check for unknown parameters". and mutually incongruent under modulus mScript error: No such module "Check for unknown parameters". is called a reduced residue system modulo mScript error: No such module "Check for unknown parameters"..[5] The set Template:MsetScript error: No such module "Check for unknown parameters". from above, for example, is an instance of a reduced residue system modulo 4.

Covering systems

Script error: No such module "Labelled list hatnote". Covering systems represent yet another type of residue system that may contain residues with varying moduli.

Integers modulo m

In the context of this paragraph, the modulus mScript error: No such module "Check for unknown parameters". is almost always taken as positive.

The set of all congruence classes modulo mScript error: No such module "Check for unknown parameters". is a ring called the ring of integers modulo mScript error: No such module "Check for unknown parameters"., and is denoted /m, /m, or m.[6] The ring /m is fundamental to various branches of mathematics (see Template:Section link below). (In some parts of number theory the notation m is avoided because it can be confused with the set of mScript error: No such module "Check for unknown parameters".-adic integers.)

For m > 0Script error: No such module "Check for unknown parameters". one has

/m={ama}={0m,1m,2m,,m1m}.

When m = 1Script error: No such module "Check for unknown parameters"., /m is the zero ring; when m = 0Script error: No such module "Check for unknown parameters"., /m is not an empty set; rather, it is isomorphic to , since a0 = Template:MsetScript error: No such module "Check for unknown parameters"..

Addition, subtraction, and multiplication are defined on /m by the following rules:

  • am+bm=(a+b)m
  • ambm=(ab)m
  • ambm=(ab)m.

The properties given before imply that, with these operations, /m is a commutative ring. For example, in the ring /24, one has

1224+2124=3324=924

as in the arithmetic for the 24-hour clock.

The notation /m is used because this ring is the quotient ring of by the ideal m, the set formed by all multiples of mScript error: No such module "Check for unknown parameters"., that is, all numbers k mScript error: No such module "Check for unknown parameters". with k.

Under addition, /m is a cyclic group. All finite cyclic groups are isomorphic with /m for some Template:Mvar.[7]

The ring of integers modulo mScript error: No such module "Check for unknown parameters". is a field; that is, every nonzero element has a multiplicative inverse, if and only if mScript error: No such module "Check for unknown parameters". is prime. If m = pTemplate:I supScript error: No such module "Check for unknown parameters". is a prime power with k > 1Script error: No such module "Check for unknown parameters"., there exists a unique (up to isomorphism) finite field GF(m)=𝔽m with mScript error: No such module "Check for unknown parameters". elements, which is not isomorphic to /m, which fails to be a field because it has zero-divisors.

If m > 1Script error: No such module "Check for unknown parameters"., (/m)× denotes the multiplicative group of the integers modulo mScript error: No such module "Check for unknown parameters". that are invertible. It consists of the congruence classes amScript error: No such module "Check for unknown parameters"., where aScript error: No such module "Check for unknown parameters". is coprime to mScript error: No such module "Check for unknown parameters".; these are precisely the classes possessing a multiplicative inverse. They form an abelian group under multiplication; its order is φ(m)Script error: No such module "Check for unknown parameters"., where Template:Mvar is Euler's totient function.

Applications

In pure mathematics, modular arithmetic is one of the foundations of number theory, touching on almost every aspect of its study, and it is also used extensively in group theory, ring theory, knot theory, and abstract algebra. In applied mathematics, it is used in computer algebra, cryptography, computer science, chemistry and the visual and musical arts.

A very practical application is to calculate checksums within serial number identifiers. For example, International Standard Book Number (ISBN) uses modulo 11 (for 10-digit ISBN) or modulo 10 (for 13-digit ISBN) arithmetic for error detection. Likewise, International Bank Account Numbers (IBANs) use modulo 97 arithmetic to spot user input errors in bank account numbers. In chemistry, the last digit of the CAS registry number (a unique identifying number for each chemical compound) is a check digit, which is calculated by taking the last digit of the first two parts of the CAS registry number times 1, the previous digit times 2, the previous digit times 3 etc., adding all these up and computing the sum modulo 10.

In cryptography, modular arithmetic directly underpins public key systems such as RSA and Diffie–Hellman, and provides finite fields which underlie elliptic curves, and is used in a variety of symmetric key algorithms including Advanced Encryption Standard (AES), International Data Encryption Algorithm (IDEA), and RC4. RSA and Diffie–Hellman use modular exponentiation.

In computer algebra, modular arithmetic is commonly used to limit the size of integer coefficients in intermediate calculations and data. It is used in polynomial factorization, a problem for which all known efficient algorithms use modular arithmetic. It is used by the most efficient implementations of polynomial greatest common divisor, exact linear algebra and Gröbner basis algorithms over the integers and the rational numbers. As posted on Fidonet in the 1980s and archived at Rosetta Code, modular arithmetic was used to disprove Euler's sum of powers conjecture on a Sinclair QL microcomputer using just one-fourth of the integer precision used by a CDC 6600 supercomputer to disprove it two decades earlier via a brute force search.[8]

In computer science, modular arithmetic is often applied in bitwise operations and other operations involving fixed-width, cyclic data structures. The modulo operation, as implemented in many programming languages and calculators, is an application of modular arithmetic that is often used in this context. The logical operator XOR sums 2 bits, modulo 2.

The use of long division to turn a fraction into a repeating decimal in any base b is equivalent to modular multiplication of b modulo the denominator. For example, for decimal, b = 10.

In music, arithmetic modulo 12 is used in the consideration of the system of twelve-tone equal temperament, where octave and enharmonic equivalency occurs (that is, pitches in a 1:2 or 2:1 ratio are equivalent, and C-sharp is considered the same as D-flat).

The method of casting out nines offers a quick check of decimal arithmetic computations performed by hand. It is based on modular arithmetic modulo 9, and specifically on the crucial property that 10 ≡ 1 (mod 9).

Arithmetic modulo 7 is used in algorithms that determine the day of the week for a given date. In particular, Zeller's congruence and the Doomsday algorithm make heavy use of modulo-7 arithmetic.

More generally, modular arithmetic also has application in disciplines such as politics (for example, apportionment), economics (for example, game theory) and other areas of the social sciences, where proportional division and allocation of resources plays a central part of the analysis.

Computational complexity

Since modular arithmetic has such a wide range of applications, it is important to know how hard it is to solve a system of congruences. A linear system of congruences can be solved in polynomial time with a form of Gaussian elimination, for details see linear congruence theorem. Algorithms, such as Montgomery reduction, also exist to allow simple arithmetic operations, such as multiplication and exponentiation modulo mScript error: No such module "Check for unknown parameters"., to be performed efficiently on large numbers.

Some operations, like finding a discrete logarithm or a quadratic congruence appear to be as hard as integer factorization and thus are a starting point for cryptographic algorithms and encryption. These problems might be NP-intermediate.

Solving a system of non-linear modular arithmetic equations is NP-complete.[9]

See also

<templatestyles src="Div col/styles.css"/>

Notes

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "Footnotes".
  4. Script error: No such module "Footnotes".
  5. Script error: No such module "Footnotes".
  6. Script error: No such module "citation/CS1".
  7. Sengadir T., Template:Trim&pg=PA293&dq=%22Zn+is+generated+by+1%22 Discrete Mathematics and Combinatorics, p. 293, at Google Books
  8. Script error: No such module "citation/CS1".
  9. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

References

External links

Script error: No such module "Navbox".