Fiveable

๐ŸงฎAdditive Combinatorics Unit 2 Review

QR code for Additive Combinatorics practice questions

2.1 Modular arithmetic and congruences

2.1 Modular arithmetic and congruences

Written by the Fiveable Content Team โ€ข Last updated August 2025
Written by the Fiveable Content Team โ€ข Last updated August 2025
๐ŸงฎAdditive Combinatorics
Unit & Topic Study Guides

Modular arithmetic is a game-changer in number theory. It's like a clock where numbers wrap around after reaching a certain point. This system simplifies complex calculations and reveals hidden patterns in numbers, making it a powerful tool for solving tricky math problems.

In the world of additive number theory, modular arithmetic is a key player. It helps us understand how numbers behave when we add, subtract, or multiply them in a cyclic system. This knowledge is crucial for tackling more advanced concepts in the field.

Modular Arithmetic

Definition and Properties

  • Modular arithmetic is a system of arithmetic for integers where numbers "wrap around" when reaching a certain value, called the modulus
  • The modulus is a positive integer that determines the cyclical nature of the arithmetic
  • Two numbers are said to be congruent modulo nn if their difference is divisible by nn, denoted as aโ‰กb(modn)a \equiv b \pmod{n}
  • Modular arithmetic follows certain properties:
    • Reflexive property: aโ‰กa(modn)a \equiv a \pmod{n}
    • Symmetric property: If aโ‰กb(modn)a \equiv b \pmod{n}, then bโ‰กa(modn)b \equiv a \pmod{n}
    • Transitive property: If aโ‰กb(modn)a \equiv b \pmod{n} and bโ‰กc(modn)b \equiv c \pmod{n}, then aโ‰กc(modn)a \equiv c \pmod{n}
  • Modular arithmetic is closed under addition, subtraction, and multiplication, meaning that performing these operations on congruent numbers modulo nn results in congruent answers modulo nn

Multiplicative Inverses and Division

  • Modular arithmetic does not always have the property of division, as not every element has a multiplicative inverse modulo nn
  • A multiplicative inverse of aa modulo nn, denoted as aโˆ’1a^{-1}, exists when gcd(a,n)=1gcd(a, n) = 1
  • When a multiplicative inverse exists, it can be used to solve linear congruences of the form axโ‰กb(modn)ax \equiv b \pmod{n}
  • The multiplicative inverse can be found using the extended Euclidean algorithm
  • Example: To find the multiplicative inverse of 3 modulo 7, use the extended Euclidean algorithm:
    • 7=2โ‹…3+17 = 2 \cdot 3 + 1
    • 3=3โ‹…1+03 = 3 \cdot 1 + 0
    • Working backwards: 1=1โ‹…7โˆ’2โ‹…31 = 1 \cdot 7 - 2 \cdot 3, so 3โˆ’1โ‰กโˆ’2(mod7)3^{-1} \equiv -2 \pmod{7}

Solving Linear Congruences

Methods for Solving Linear Congruences

  • A linear congruence is an equation of the form axโ‰กb(modn)ax \equiv b \pmod{n}, where aa, bb, and nn are known integers, and xx is an unknown integer
  • To solve a linear congruence, find the value(s) of xx that satisfy the congruence
  • One method to solve linear congruences is by using the multiplicative inverse of aa modulo nn, denoted as aโˆ’1a^{-1}, when gcd(a,n)=1gcd(a, n) = 1
    • Multiply both sides of the congruence by aโˆ’1a^{-1} to isolate xx: aโˆ’1axโ‰กaโˆ’1b(modn)a^{-1}ax \equiv a^{-1}b \pmod{n} simplifies to xโ‰กaโˆ’1b(modn)x \equiv a^{-1}b \pmod{n}
  • Another method is to use the extended Euclidean algorithm to find the modular multiplicative inverse when gcd(a,n)=1gcd(a, n) = 1
  • Example: Solve the linear congruence 3xโ‰ก4(mod7)3x \equiv 4 \pmod{7}
    • Using the multiplicative inverse method: 3โˆ’1โ‰กโˆ’2(mod7)3^{-1} \equiv -2 \pmod{7}, so xโ‰กโˆ’2โ‹…4โ‰ก6(mod7)x \equiv -2 \cdot 4 \equiv 6 \pmod{7}
Definition and Properties, relations - Transitive and reflexive graph - Mathematics Stack Exchange

Linear Congruences with No or Multiple Solutions

  • If gcd(a,n)โ‰ 1gcd(a, n) \neq 1, the linear congruence may have no solutions or multiple solutions
    • If gcd(a,n)gcd(a, n) does not divide bb, there are no solutions
    • If gcd(a,n)gcd(a, n) divides bb, there are gcd(a,n)gcd(a, n) solutions
  • Example: Consider the linear congruence 6xโ‰ก9(mod15)6x \equiv 9 \pmod{15}
    • gcd(6,15)=3gcd(6, 15) = 3, which divides 9, so there are 3 solutions
    • Dividing both sides by 3 yields 2xโ‰ก3(mod5)2x \equiv 3 \pmod{5}
    • Solving for xx: xโ‰ก2โˆ’1โ‹…3โ‰ก4(mod5)x \equiv 2^{-1} \cdot 3 \equiv 4 \pmod{5}
    • The three solutions are xโ‰ก4,9,14(mod15)x \equiv 4, 9, 14 \pmod{15}

Chinese Remainder Theorem

  • The Chinese Remainder Theorem can be used to solve a system of simultaneous linear congruences with coprime moduli
  • If the system of congruences is:
    • xโ‰กa1(modn1)x \equiv a_1 \pmod{n_1}
    • xโ‰กa2(modn2)x \equiv a_2 \pmod{n_2}
    • ...
    • xโ‰กak(modnk)x \equiv a_k \pmod{n_k}
  • and gcd(ni,nj)=1gcd(n_i, n_j) = 1 for all iโ‰ ji \neq j, then there exists a unique solution modulo N=n1โ‹…n2โ‹…...โ‹…nkN = n_1 \cdot n_2 \cdot ... \cdot n_k
  • The solution is given by xโ‰กโˆ‘i=1kaiโ‹…Niโ‹…yi(modN)x \equiv \sum_{i=1}^{k} a_i \cdot N_i \cdot y_i \pmod{N}, where:
    • Ni=N/niN_i = N / n_i
    • yiy_i is the modular multiplicative inverse of NiN_i modulo nin_i

Applications of Modular Arithmetic

Number Theory

  • Modular arithmetic is a powerful tool in solving various problems in number theory
  • Fermat's Little Theorem states that if pp is prime and gcd(a,p)=1gcd(a, p) = 1, then apโˆ’1โ‰ก1(modp)a^{p-1} \equiv 1 \pmod{p}. This can be used to test for primality or to simplify calculations
  • Euler's Theorem generalizes Fermat's Little Theorem for composite moduli: If gcd(a,n)=1gcd(a, n) = 1, then aฯ•(n)โ‰ก1(modn)a^{\phi(n)} \equiv 1 \pmod{n}, where ฯ•(n)\phi(n) is Euler's totient function
  • The Chinese Remainder Theorem can be used to solve systems of linear congruences, which has applications in cryptography and coding theory
  • Example: RSA cryptosystem relies on modular exponentiation and the difficulty of factoring large numbers
Definition and Properties, Quadratic Functions โ€“ Algebra and Trigonometry OpenStax

Cryptography and Coding Theory

  • Modular exponentiation, computing ab(modn)a^b \pmod{n}, is a key operation in many cryptographic systems, such as RSA
  • The security of RSA is based on the difficulty of factoring large numbers, which is related to the hardness of solving certain congruences
  • Quadratic residues and the Legendre symbol can be used to determine the solvability of quadratic congruences modulo prime numbers
  • Example: In the ElGamal encryption system, the public key is generated using modular arithmetic, and the security relies on the discrete logarithm problem

Modular Arithmetic vs Divisibility

Relationship between Modular Arithmetic and Divisibility

  • Modular arithmetic is closely related to the concept of divisibility
  • If aโ‰กb(modn)a \equiv b \pmod{n}, then nn divides aโˆ’ba - b, or equivalently, aa and bb have the same remainder when divided by nn
  • The congruence aโ‰ก0(modn)a \equiv 0 \pmod{n} is equivalent to saying that nn divides aa
  • The set of integers modulo nn, denoted as Z/nZ\mathbb{Z}/n\mathbb{Z} or Zn\mathbb{Z}_n, consists of equivalence classes of integers with the same remainder when divided by nn
  • Example: The set of integers modulo 5, Z5\mathbb{Z}_5, consists of five equivalence classes: [0],[1],[2],[3],[4][0], [1], [2], [3], [4]

Division Algorithm and Divisibility Rules

  • The division algorithm states that for any integers aa and bb with b>0b > 0, there exist unique integers qq (quotient) and rr (remainder) such that a=bq+ra = bq + r, where 0โ‰คr<โˆฃbโˆฃ0 \leq r < |b|. This is related to the congruence aโ‰กr(modb)a \equiv r \pmod{b}
  • Divisibility rules, such as the rules for divisibility by 2, 3, 5, 9, or 11, can be derived using modular arithmetic
  • Example: A number is divisible by 3 if and only if the sum of its digits is divisible by 3, which can be proven using modular arithmetic:
    • Let the number be anโ‹…10n+anโˆ’1โ‹…10nโˆ’1+...+a1โ‹…10+a0a_n \cdot 10^n + a_{n-1} \cdot 10^{n-1} + ... + a_1 \cdot 10 + a_0
    • Since 10โ‰ก1(mod3)10 \equiv 1 \pmod{3}, the number is congruent to an+anโˆ’1+...+a1+a0(mod3)a_n + a_{n-1} + ... + a_1 + a_0 \pmod{3}
    • Therefore, the number is divisible by 3 if and only if the sum of its digits is divisible by 3