100% found this document useful (1 vote)
436 views

An Introduction To Modular Arithmetic

This document provides an introduction to modular arithmetic. It defines modular arithmetic and congruences, and proves several theorems about properties of modular arithmetic, including: addition, subtraction, multiplication, and exponentiation of congruences. It also discusses linear congruences and solving systems of linear congruences. Finally, it introduces quadratic residues and gives some example problems involving modular arithmetic.

Uploaded by

kalpa_y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
436 views

An Introduction To Modular Arithmetic

This document provides an introduction to modular arithmetic. It defines modular arithmetic and congruences, and proves several theorems about properties of modular arithmetic, including: addition, subtraction, multiplication, and exponentiation of congruences. It also discusses linear congruences and solving systems of linear congruences. Finally, it introduces quadratic residues and gives some example problems involving modular arithmetic.

Uploaded by

kalpa_y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

An Introduction to Modular Arithmetic

Brandon Jiang
May 15, 2016

1 Introduction
Modular arithmetic is an important topic in number theory dealing largely with the study of remainders.
This approach is extremely useful in a variety of difficult problems.

2 Definition
We say that a is the modulo-m residue of n when n ≡ a (mod m), and
0 ≤ a < m.
This is identical to saying that a is the remainder when n is divided by m.

Example 2.1 Given that 0 ≤ n < 9, Find the value of n if 21 ≡ n (mod 9)

Using the division algorithm, we get that 21 = 9 ∗ 2 + 3, so n = 3.

2.1 Modular Inverses


We call the inverse of a the integer a−1 such that aa−1 ≡ 1 (mod m).
This leads us to an important theorem:

Theorem 2.2 For a prime m, each integer in {2, · · ·, m − 2} has a unique inverse modulo-m in the same
set.
The rigorous proof of this theorem a bit contrived, which is why it is not included. However, this fact should
be quite intuitive, especially given Bézout’s Identity. Notice how 1 and m − 1 are excluded. This is because
1 and m − 1 are their own inverses modulo-m.
Theorem 2.3 (Wilson) Given a prime p, (p − 1)! ≡ −1 (mod p).

Proof By Theorem 2.2, since each integer in {2, · · ·, m − 2} is paired with it’s inverse and 1 ≡ 1 (mod p),
we know that (p − 2)! ≡ 1 (mod p). Also, because p − 1 ≡ −1 (mod p), we can multiply the two to get
the desired expression.

3 Properties of Modular Congruences


Let a, b, c, and d be integers and let m be a positive integer such that
a ≡ b (mod m)
c ≡ d (mod m)

Theorem 3.1 a + c ≡ b + d (mod m)

1
Proof Let n and k be integers such that a − b = mn and c − d = mk. Adding these equations gives

(a − b) + (c − d) = mn + mk
(a + c) − (b + d) = m(n + k)

Therefore, a + c ≡ b + d (mod m).

Theorem 3.2 a − c ≡ b − d (mod m)

Proof Similarly define n and k as above. Subtracting equations, we have that

(a − b) − (c − d) = mn − mk
(a − c) − (b − d) = m(n − k)

Therefore, a − c ≡ b − d (mod m).

Theorem 3.3 ac ≡ bd (mod m)

Proof Again, we let a − b = mn. Multiplying both sides by c, we have that ac − bc = mnc, and therefore
ac ≡ bc (mod m). Similarly, we can multiply both sides of the congruence c ≡ d (mod m) by b to get
bc ≡ bd (mod m). Rewriting these as equations and adding them gives

ac − bc = mnc

bc − bd = mkb
ac − bd = m(nc + kb)

Therefore, ac ≡ bd (mod m).

Theorem 3.4 If e is an integer such that a and b are divisible by e, then


a b m
e ≡ e (mod gcd(m,e) ).

Proof We begin with a lemma:


Lemma 3.5 Let x, y, and z be integers, y 6= 0. Then z · (x (mod y)) = zx (mod zy).

Proof We can rewrite x (mod y) as x − yb xy c. Multiplying the expression by z, zx − zyb xy c = zx − zyb zx


zy c.
Reversing our initial step, the conclusion follows.

Since a and b are divisible by e, we can write a = pe and b = qe for integers p and q. We rewrite the
congruence as pe ≡ qe (mod m). Following from Bézout’s Identity, there exists an integer e0 such that
ee0 ≡ gcd(m, e) (mod m). Multiplying with the previous congruence, we have

pee0 ≡ qee0 (mod m)

p gcd(m, e) ≡ q gcd(m, e) (mod m)


By Lemma 3.5, we can divide both sides by gcd(m, e) to achieve the desired result.

Theorem 3.6 ae ≡ be (mod m) for all positive integers e.

Proof We will proceed with induction. The base case, a ≡ b (mod m) is given. Now let us assume
that ak ≡ bk (mod m). By Theorem 3.3, we can multiply corresponding terms with the base case to get
ak+1 ≡ bk+1 (mod m). This completes the inductive step, and the conclusion follows.

2
4 Linear Congruences
A linear congruence is a modular congruence of the form ax + b ≡ c (mod m). Solving for x is similar to
solving a linear equation. Solving congruences involves the above properties. A notable strategy is to use
the fact that m ≡ 0 (mod m) and adding multiples of m to both sides of the equation.
Example 4.1 Solve the linear congruence for x.
5x + 12 ≡ 3 (mod 8)
We can manipulate the congruence
5x + 4 ≡ 11 (mod 8)
5x ≡ 7 (mod 8)
5x ≡ 15 (mod 8)
x≡3 (mod 8)
When we have more than one equation, we have a linear congruence system.
Example 4.2 There are a certain number of people in the school band. If the members try to line up in 14
equal rows, then 1 person is left over. If they line up in 15 equal rows, then 2 people are left over. If there
are more than 200 people in the band, what is the fewest possible number of people in the band?
We can express this information in the form of two linear congruences. Let N be the number of people in
the band.
N ≡ 1 (mod 14)
N ≡2 (mod 15)
Adding 13 to both equations, we have
N + 13 ≡ 0 (mod 14)
N + 13 ≡ 0 (mod 15)
Thus, we know that N + 13 is a multiple of 14 and 15. The least positive value of N satisfying this condition
is 14 · 15 − 13 = 197, however the problem states that there are more than 200 people. Therefore, we look
for the next largest which is 2(14 · 15) − 13 = 407 people.

5 Residue Classes
Given integers m and n, the quadratic residues are the possible values p where n2 ≡ p (mod m). As an
example, consider the case n2 ≡ p (mod m). Since we are working modulo-3, we know that n ≡ 0, 1, 2
(mod 3). Taking each case individually,

n≡0 (mod 3), n2 ≡ 0 (mod 3).


n≡1 (mod 3), n2 ≡ 1 (mod 3).
2
n≡2 (mod 3), n ≡ 4 ≡ 1 (mod 3).
What we have discovered here is that no perfect squares leave a remainder of 2 when divided by 3. Some
notable cases to use quadratic residues are modulo-4 and modulo-8. We can extend this strategy to computing
cubic residues as well. A good heuristic for higher powers is to consider modulo-9 for cubic residues, modulo-
16 for quartic residues, and modula-11 for quintic residues. The reader is encouraged to find these values.
Example 5.1 For a positive integer n, find the largest number of zeros that 1n + 2n + 3n + 4n can end in.
(Source: Clevermath)
For n = 1, 2 and 3, we have the expression equivalent to 10, 30, and 100, respectively, so we know that
two zeros is attainable. For n ≥ 4, 2n + 4n ≡ 0 (mod 8). Since 3n leaves residues of 3 and 1 modulo 8,
1n + 3n ≡ 2, 4 (mod 8). Therefore, for n ≥ 4 we cannot have 1n + 2n + 3n + 4n divisible by 8 or 1000, so
the maximum number of zeros is 2.

3
6 Challenge Problems
1. If n = (1 + 2 + · · · + 48)49 , what is the remainder when n is divided by 50?
2. The Fibonacci sequence is defined F0 = F1 = 1 and Fn+2 = Fn+1 + Fn . Find the remainder when F200
is divided by 8.
3. Two random integers, a and b, are independently chosen, with replacement, from 1 to 1000, inclusive.
What is the probability that both 2a + 2b and 3a + 3b are multiples of 5? Express your answer as a
common fraction. (Source: MATHCOUNTS)
4. Find the number of ordered quadruples (a, b, c, d) of positive integers such that a2 +b2 +c2 +d2 = 9·22015 .
(Source: Clevermath)
5. Find the number of solutions to y 2 = x5 − 4 in integers.

6. Ms. Math’s kindergarten class has 16 registered students. The classroom has a very large number, N ,
of play blocks which satisfies the conditions: (a) If 16, 15, or 14 students are present, then in each case
all the blocks can be distributed in equal numbers to each student, and (b) There are three integers
0 < x < y < z < 14 such that when x, y, or z students are present and the blocks are distributed in
equal numbers to each student, there are exactly three blocks left over.
Find the sum of the distinct prime divisors of the least possible value of N satisfying the above
conditions. (Source: AIME)

You might also like