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 ab(modn)a \equiv b \pmod{n}
  • Modular arithmetic follows certain properties:
    • Reflexive property: aa(modn)a \equiv a \pmod{n}
    • Symmetric property: If ab(modn)a \equiv b \pmod{n}, then ba(modn)b \equiv a \pmod{n}
    • Transitive property: If ab(modn)a \equiv b \pmod{n} and bc(modn)b \equiv c \pmod{n}, then ac(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 a1a^{-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 axb(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=23+17 = 2 \cdot 3 + 1
    • 3=31+03 = 3 \cdot 1 + 0
    • Working backwards: 1=17231 = 1 \cdot 7 - 2 \cdot 3, so 312(mod7)3^{-1} \equiv -2 \pmod{7}

Solving Linear Congruences

Methods for Solving Linear Congruences

  • A linear congruence is an equation of the form axb(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 a1a^{-1}, when gcd(a,n)=1gcd(a, n) = 1
    • Multiply both sides of the congruence by a1a^{-1} to isolate xx: a1axa1b(modn)a^{-1}ax \equiv a^{-1}b \pmod{n} simplifies to xa1b(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 3x4(mod7)3x \equiv 4 \pmod{7}
    • Using the multiplicative inverse method: 312(mod7)3^{-1} \equiv -2 \pmod{7}, so x246(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 6x9(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 2x3(mod5)2x \equiv 3 \pmod{5}
    • Solving for xx: x2134(mod5)x \equiv 2^{-1} \cdot 3 \equiv 4 \pmod{5}
    • The three solutions are x4,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:
    • xa1(modn1)x \equiv a_1 \pmod{n_1}
    • xa2(modn2)x \equiv a_2 \pmod{n_2}
    • ...
    • xak(modnk)x \equiv a_k \pmod{n_k}
  • and gcd(ni,nj)=1gcd(n_i, n_j) = 1 for all iji \neq j, then there exists a unique solution modulo N=n1n2...nkN = n_1 \cdot n_2 \cdot ... \cdot n_k
  • The solution is given by xi=1kaiNiyi(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 ap11(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 ab(modn)a \equiv b \pmod{n}, then nn divides aba - b, or equivalently, aa and bb have the same remainder when divided by nn
  • The congruence a0(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 0r<b0 \leq r < |b|. This is related to the congruence ar(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 an10n+an110n1+...+a110+a0a_n \cdot 10^n + a_{n-1} \cdot 10^{n-1} + ... + a_1 \cdot 10 + a_0
    • Since 101(mod3)10 \equiv 1 \pmod{3}, the number is congruent to an+an1+...+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
Pep mascot
Upgrade your Fiveable account to print any study guide

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Click below to go to billing portal → update your plan → choose Yearly → and select "Fiveable Share Plan". Only pay the difference

Plan is open to all students, teachers, parents, etc
Pep mascot
Upgrade your Fiveable account to export vocabulary

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Plan is open to all students, teachers, parents, etc
report an error
description

screenshots help us find and fix the issue faster (optional)

add screenshot

2,589 studying →