remainders - lecture 2 · 02/12/2018  · justin stevens modulos (lecture 2) 6 / 49. outline 1...

53
Remainders Lecture 2 Justin Stevens Justin Stevens Modulos (Lecture 2) 1 / 49

Upload: others

Post on 31-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

RemaindersLecture 2

Justin Stevens

Justin Stevens Modulos (Lecture 2) 1 / 49

Outline

1 Problem Set 1 ReviewSum of First n Triangular NumbersProperties of DivisibilityEquivalent Remainder

2 Modular Arithmetic

3 Exponents

4 Divisibility Rules Revisited

5 Backup Slides

Justin Stevens Modulos (Lecture 2) 2 / 49

Sum of First n Triangular Numbers I

Example. Find the sum of the first n triangular numbers.

Solution. We color the triangular numbers blue. We compute the top rowby beginning with the circled 0 and adding the triangular number below it.

0 1 4 10 20 35 56 84 1201 3 6 10 15 21 28 36

What are the two rows directly below this?

0 1 4 10 20 35 56 84 1201 3 6 10 15 21 28 36

2 3 4 5 6 7 81 1 1 1 1 1

Since the third row is constant, we expect our formula to be cubic.Justin Stevens Modulos (Lecture 2) 3 / 49

Sum of First n Triangular Numbers II

Example. Find the sum of the first n triangular numbers.

Let p(n) = an3 + bn2 + cn + d . Can you find a, b, c, and d?

From the circled number, p(0) = 0 =⇒ d = 0. Plugging inp(1) = 1, p(2) = 4, and p(3) = 10 gives:

a + b + c = 18a + 4b + 2c = 4

27a + 9b + 3c = 10.

Solving this system gives (a, b, c) = (16 , 1

2 , 13). Hence,

p(n) = 16n3 + 1

2n2 + 13n = n(n + 1)(n + 2)

6 .

Justin Stevens Modulos (Lecture 2) 4 / 49

Properties of Divisibility

Transitive Property: If d | m and m | n, then d | n.Linear Combinations: If d | n1 and d | n2, then d | n1c1 + n2c2.Dividing a Sum: If d | n1, d | n2, · · · , d | nk , then d |

∑kj=1 nj .

Cancellation: If dc | nc, then d | n.

Justin Stevens Modulos (Lecture 2) 5 / 49

Equivalent Remainder

Example. When we divide the numbers 1059, 1417, and 2312 by aninteger d > 1, the remainder is the integer r . Find d and r .

Solution. By the division algorithm, there exists three integer quotientsq1, q2, and q3 such that

1059 = dq1 + r1417 = dq2 + r2312 = dq3 + r .

We subtract the equations in pairs to get:358 = d(q2 − q1), 895 = d(q3 − q2), 1253 = d(q3 − q1).

Hence, d must divide 358 = 2 · 179, 895 = 5 · 179, 1253 = 7 · 179.We therefore conclude that d = 179 .

Now, dividing 1059 by 179 gives 1059 = 179 · 5 + 164. Therefore, r = 164 .

Justin Stevens Modulos (Lecture 2) 6 / 49

Outline

1 Problem Set 1 Review

2 Modular ArithmeticCalendar MathDefinitionAddition/SubtractionCaesar Shift CrytographyMultiplication

3 Exponents

4 Divisibility Rules Revisited

5 Backup Slides

Justin Stevens Modulos (Lecture 2) 7 / 49

Calendar Math I

Modular Arithmetic is incredibly powerful and is used in cryptography,computer science, chemistry, music, and many other places.

Consider a simplified calendar system where the days of the week stay thesame, but there is now only one month with 365 days. If the year begins ona Monday, then the first 20 days of the year look like the table below:

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 20

Example. What day of the week is day 31 on?

Justin Stevens Modulos (Lecture 2) 8 / 49

Calendar Math II

Example. What day of the week is day 31 on?

Solution. Extending our table two more rows:

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 31 32 33 34

We call the days that are Wednesdays congruent to 3 modulo 7. This isbecause the days of the week cycle with period 7. From the table above:

31 ≡ 24 ≡ 17 ≡ 10 ≡ 3 (mod 7).

Try dividing these numbers by 7.Justin Stevens Modulos (Lecture 2) 9 / 49

Calendar Math III

Example. Analyze the congruence 31 ≡ 24 ≡ 17 ≡ 10 ≡ 3 (mod 7).

31 = 7 · 4 + 3, 24 = 7 · 3 + 3, 17 = 7 · 2 + 3, 10 = 7 · 1 + 3.

Every Wednesday is of the form 7q + 3. We can rethink of the table as:

Sun Mon Tue Wed Thu Fri Sat7q 7q + 1 7q + 2 7q + 3 7q + 4 7q + 5 7q + 6

q = 0 1 2 3 4 5 6q = 1 7 8 9 10 11 12 13q = 2 14 15 16 17 18 19 20q = 3 21 22 23 24 25 26 27q = 4 28 29 30 31 32 33 34

Example. Determine the weekday of day 75, 100, and 133.

Justin Stevens Modulos (Lecture 2) 10 / 49

Calendar Math IV

Example. Determine the weekday of day 75, 100, and 133.

Sun Mon Tue Wed Thu Fri Sat7q 7q + 1 7q + 2 7q + 3 7q + 4 7q + 5 7q + 6

Solution. We use the division algorithm!

75 = 7 · 10 + 5 which lies on a Friday.

100 = 7 · 14 + 2 which lies on a Tuesday.

133 = 7 · 19 + 0 which lies on a Sunday.

In general, n = 7q + r , 0 ≤ r < 7 =⇒ n ≡ r (mod 7).

Hence, 75 ≡ 5 (mod 7), 100 ≡ 2 (mod 7), and 133 ≡ 0 (mod 7).

Justin Stevens Modulos (Lecture 2) 11 / 49

Modulo Definition I

Generalizing our work with days of the week, we have this definition:

Definition. If n = dq + r where 0 ≤ r < d , then n ≡ r (mod d).

r is said to be a modulo d residue. These consist of all possible remaindersupon division by d , namely {0, 1, 2, 3, · · · , d − 1}. This set is Zd .

An example is the units digit. The possible decimal units digit of a numberare 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. These form the modulo 10 residues.

Justin Stevens Modulos (Lecture 2) 12 / 49

Residue Sets

Definition. A set {a1, a2, a3, · · · , an} is called a reduced residueset if for every integer b, there exists exactly one index j such thatb ≡ aj (mod n).

For example, {−41, 11, 2, 33,−7, 24,−1} is a reduced residue set mod 7,since

{−41, 11, 2, 33,−7, 24,−1} ≡ {1, 4, 2, 5, 0, 3, 6} (mod 7).

However, {1, 2, 3, 4, 5, 6, 8} is not since 1 ≡ 8 (mod 7).

Justin Stevens Modulos (Lecture 2) 13 / 49

Modulo Definition II

Definition. If n = dq + r where 0 ≤ r < d , then n ≡ r (mod d).

If n1 ≡ n2 (mod d), then they leave the same remainder upon division by d :

n1 = dq1 + rn2 = dq2 + r .

Hence, n1 − n2 = d(q1 − q2) =⇒ d | n1 − n2.

Justin Stevens Modulos (Lecture 2) 14 / 49

Modulo Addition/Subtraction

We add/subtract constants to the congruence 25 ≡ 11 (mod 7).

Blue represents an addition of 2.Orange represents a subtraction of 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Adding 2 gives 27 ≡ 13 (mod 7) and subtracting 3 gives 22 ≡ 8 (mod 7).

Theorem. If n1 ≡ n2 mod d , then n1 + c ≡ n2 + c mod d for integer c .

Justin Stevens Modulos (Lecture 2) 15 / 49

Modulo Addition/Subtraction

We add/subtract constants to the congruence 25 ≡ 11 (mod 7).

Blue represents an addition of 2.Orange represents a subtraction of 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Adding 2 gives 27 ≡ 13 (mod 7) and subtracting 3 gives 22 ≡ 8 (mod 7).

Theorem. If n1 ≡ n2 mod d , then n1 + c ≡ n2 + c mod d for integer c .

Justin Stevens Modulos (Lecture 2) 15 / 49

Modulo Addition/Subtraction

We add/subtract constants to the congruence 25 ≡ 11 (mod 7).

Blue represents an addition of 2.Orange represents a subtraction of 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Adding 2 gives 27 ≡ 13 (mod 7) and subtracting 3 gives 22 ≡ 8 (mod 7).

Theorem. If n1 ≡ n2 mod d , then n1 + c ≡ n2 + c mod d for integer c .

Justin Stevens Modulos (Lecture 2) 15 / 49

Modulo Addition/Subtraction

We add/subtract constants to the congruence 25 ≡ 11 (mod 7).

Blue represents an addition of 2.Orange represents a subtraction of 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Adding 2 gives 27 ≡ 13 (mod 7) and subtracting 3 gives 22 ≡ 8 (mod 7).

Theorem. If n1 ≡ n2 mod d , then n1 + c ≡ n2 + c mod d for integer c .

Justin Stevens Modulos (Lecture 2) 15 / 49

Modulo Addition/Subtraction

We add/subtract constants to the congruence 25 ≡ 11 (mod 7).

Blue represents an addition of 2.Orange represents a subtraction of 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Adding 2 gives 27 ≡ 13 (mod 7) and subtracting 3 gives 22 ≡ 8 (mod 7).

Theorem. If n1 ≡ n2 mod d , then n1 + c ≡ n2 + c mod d for integer c .

Justin Stevens Modulos (Lecture 2) 15 / 49

Modulo Addition/Subtraction III

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27

Consider the congruences 16 ≡ 9 (mod 7) and 10 ≡ 3 (mod 7).

Adding these congruences produces Fridays: 26 ≡ 12 (mod 7).

Tuesdays are of the form 7q1 + 2 and Wednesdays 7q2 + 3. Their sum is:

(7q1 + 2) + (7q2 + 3) = 7 (q1 + q2) + 5.

This is a Friday!

Justin Stevens Modulos (Lecture 2) 16 / 49

Modulo Addition/Subtraction IV

Theorem. If m1, m2, n1, n2 are integers such that

m1 ≡ m2 (mod d)n1 ≡ n2 (mod d),

then m1 + n1 ≡ m2 + n2 (mod d).

Justin Stevens Modulos (Lecture 2) 17 / 49

Modulo Addition Puzzles

Example 1. Compute the remainder when the sum

3 + 8 + 13 + 18 + · · ·+ 1003

is divided by 5.

Justin Stevens Modulos (Lecture 2) 18 / 49

Caesar Shift Cryptography

Example. Decode the secret message ‘PDWK LV DZHVRPH’.

In order to encode this, I used something known as a Caesar shift.Essentially, I shifted every character in my original message by three letters.

Figure 1: Caesar Shift Cryptography for k = 3.

Using this, can you figure out my original message?

Justin Stevens Modulos (Lecture 2) 19 / 49

Caesar Shift Examples

Example 2. Encode the message ‘PYTHON IS FUN’ using a Caesarshift with k = 2.

Example 3. Decode the message ‘YHUB ZHOO GRQH’ given it wasencoded using a Caesar shift with k = 3.

Justin Stevens Modulos (Lecture 2) 20 / 49

General Formulas

Theorem. If we represent the letter A as 0 and Z as 25, we can thinkof the alphabet as a mod 26 system.

To encode a letter x , we use the encoding En(x) ≡ x +n (mod 26).To decode a letter x , we use the decoding Dn(x) ≡ x−n (mod 26).

Justin Stevens Modulos (Lecture 2) 21 / 49

Modulo Multiplication I

We now multiplying the congruence 10 ≡ 3 (mod 7) by constants.

Blue represents a multiplication by 2.Orange represents a multiplication by 3.

Sun Mon Tue Wed Thu Fri Sat1 2 3 4 5 6

7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 31 32 33 34

Multiplying by 2 gives 20 ≡ 6 (mod 7) and by 3 gives 30 ≡ 9 (mod 7).

Theorem. If n1 ≡ n2 (mod d), then for integer c, n1c ≡ n2c (mod d).

Justin Stevens Modulos (Lecture 2) 22 / 49

Modulo Multiplication II

Theorem. If n1 ≡ n2 (mod d), then for integer c , n1c ≡ n2c (mod d).

Proof. Since n1 ≡ n2 (mod d), we have d | n1 − n2.

By our theorem yesterday, we can multiply a divisibility by a constant:

d | n1 − n2 =⇒ d | c (n1 − n2) .

Expanding, we see that c (n1 − n2) = n1c − n2c. Therefore,

d | n1c − n2c =⇒ n1c ≡ n2c (mod d).

Example. Find the units digit of 34 · 62. What do you notice?

Justin Stevens Modulos (Lecture 2) 23 / 49

Units Digit Multiplication

Example. Find the units digit of 34 · 62. What do you notice?

Solution. Through multiplying, 34 · 62 = 2108, which has a units digit of 8.We see that 8 is the product of the units digit of 34 and 62.

In general, let the two numbers be n = 10qn + rn and m = 10qm + rm:

nm = (10qn + rn) (10qm + rm)= 100qnqm + 10qnrm + 10qmrn + rnrm

≡ rnrm (mod 10).

The units digit of nm equals the product of the units digit of n and m.

Justin Stevens Modulos (Lecture 2) 24 / 49

Modulo Multiplication IV

Theorem. If m1, m2, n1, n2 are integers such that

m1 ≡ m2 (mod d)n1 ≡ n2 (mod d),

then m1n1 ≡ m2n2 (mod d).

Justin Stevens Modulos (Lecture 2) 25 / 49

Modulo Multiplication Puzzles

Example 4. The remainders when two natural numbers are divided by12 are 7 and 9 respectively.

Find the remainder when their product is divided by 12.Find the remainder when their product is divided by 4.

Justin Stevens Modulos (Lecture 2) 26 / 49

Product Mod 12 and 4

Example. The remainders when two natural numbers are divided by12 are 7 and 9 respectively.

Find the remainder when their product is divided by 12.Find the remainder when their product is divided by 4.

Solution. Let a and b be such that a ≡ 7 (mod 12) and b ≡ 9 (mod 12).Multiplying the congruences gives

ab ≡ 7 · 9 ≡ 63 ≡ 3 (mod 12).

We wish to find the modulo 4 residues of a and b:

a = 12q1 + 7 = 4 (3q1 + 1) + 3b = 12q2 + 9 = 4 (3q2 + 2) + 1.

Therefore, a ≡ 3 (mod 4) and b ≡ 1 (mod 4). Multiplying gives:

ab ≡ 3 · 1 ≡ 3 (mod 4).Justin Stevens Modulos (Lecture 2) 27 / 49

Outline

1 Problem Set 1 Review

2 Modular Arithmetic

3 ExponentsFactorizing xn − yn

Factorizing xn + yn

ExplorationBinomial Theorem

4 Divisibility Rules Revisited

5 Backup Slides

Justin Stevens Modulos (Lecture 2) 28 / 49

Exponential Divisibility Puzzles

Example 5. Show that 3 always divides 4n − 1n for all integers n.

Example 6. Show that 5 always divides 7n − 2n for all integers n.

Justin Stevens Modulos (Lecture 2) 29 / 49

4n − 1 Divisible by 3 Part I

Example. Show that 3 always divides 4n − 1n for all integers n.

Solution.

42 − 12 = 16− 1 = 15 = 3 · 543 − 13 = 64− 1 = 63 = 3 · 2144 − 14 = 256− 1 = 255 = 3 · 8545 − 15 = 1024− 1 = 1023 = 3 · 341.

Do you notice anything interesting about the numbers on the right?

5 = 4 + 121 = 16 + 4 + 185 = 64 + 16 + 4 + 1

341 = 256 + 64 + 16 + 4 + 1.

These are all powers of 4. Why does this hold true?Justin Stevens Modulos (Lecture 2) 30 / 49

4n − 1 Divisible by 3 Part II

Example. Show that 3 always divides 4n − 1 for all integers n.

Using the fact that 4− 1 = 3, we can rewrite the original equations as:

42 − 12 = (4− 1)(4 + 1)43 − 13 = (4− 1)(42 + 4 + 1)44 − 14 = (4− 1)(43 + 42 + 4 + 1)45 − 15 = (4− 1)(44 + 43 + 42 + 4 + 1).

In general, I claim that

4n − 1 = (4− 1)(4n−1 + 4n−2 + · · ·+ 4 + 1

).

How do we prove this?

Justin Stevens Modulos (Lecture 2) 31 / 49

4n − 1 Divisible by 3 Part III

Example. Show that 4n−1 = (4− 1)(4n−1 + 4n−2 + · · ·+ 4 + 1

).

Solution. Let S = 4n−1 + 4n−2 + · · ·+ 4 + 1. Then

4S = 4n + 4n−1 + 4n−2 + · · ·+ 42 + 4S = 4n−1 + 4n−2 + · · ·+ 42 + 4 + 1

Subtracting these equations yields 3S = 4n − 1. Substituting for S proves

(4− 1)(4n−1 + 4n−2 + · · ·+ 4 + 1

)= 4n − 1.

Therefore, for all integers n, 3 | 4n − 1. Can we generalize this result?

xn − 1 = (x − 1)(xn−1 + xn−2 + · · ·+ x + 1

).

This is equivalent to the geometric series formula you see in algebra.

Justin Stevens Modulos (Lecture 2) 32 / 49

General Factorization

Theorem. For all positive integers n,

xn − yn = (x − y)(xn−1 + xn−2y1 + xn−3y2 + · · ·+ yn−1

).

Therefore, x − y | xn − yn.

Justin Stevens Modulos (Lecture 2) 33 / 49

Mod Exponents

The previous are identical to 4n ≡ 1 (mod 3) and 7n ≡ 2n (mod 5).

Theorem. For integers x and y , if x ≡ y (mod d) then xn ≡ yn (mod d).

Proof. x ≡ y (mod d) =⇒ d | x − y and x − y | xn − yn. Hence,

d | x − y | xn − yn =⇒ d | xn − yn.

The conclusion is that xn ≡ yn (mod d).

An alternative way is observing the congruences

x ≡ y (mod d)x ≡ y (mod d).

Multiplying them gives x2 ≡ y2 (mod d). Multiplying again gives x3 ≡ y3

(mod d). We can always increase the exponent by 1, hence, in general,xn ≡ yn (mod d). This proof method is known as induction.

Justin Stevens Modulos (Lecture 2) 34 / 49

Factorizing xn + yn

Theorem. For all odd positive integers n,

xn + yn = (x + y)(xn−1 − xn−2y + xn−3y2 + · · ·+ yn−1

).

Therefore, for odd n, x + y | xn + yn.

Justin Stevens Modulos (Lecture 2) 35 / 49

Exploration

Example 7. Compute 570 (mod 31).

Example 8. Compute the units digit of 3711 .

Justin Stevens Modulos (Lecture 2) 36 / 49

Powers of 5 Mod 31

Example. Compute 570 (mod 31).

Solution. Notice that 53 ≡ 1 (mod 31), therefore

570 = 51 ·(53)23≡ 51 · 123 ≡ 5 (mod 31).

Justin Stevens Modulos (Lecture 2) 37 / 49

Units Digit of Power of 7

Example. Compute the units digit of 3711 .

Solution. Observe the following relations for nonnegative integer n:

n ≡ 0 (mod 4) =⇒ 3n ≡ 1 (mod 10)n ≡ 1 (mod 4) =⇒ 3n ≡ 3 (mod 10)n ≡ 2 (mod 4) =⇒ 3n ≡ 9 (mod 10)n ≡ 3 (mod 4) =⇒ 3n ≡ 7 (mod 10).

We therefore wish to compute 711 mod 4. Observe

711 ≡ (−1)11 ≡ −1 ≡ 3 (mod 4).

Therefore,3711 ≡ 33 ≡ 7 (mod 10).

Justin Stevens Modulos (Lecture 2) 38 / 49

Binomial Theorem

Theorem. For every positive integer n,

(x + y)n =n∑

k=0

(nk

)xkyn−k .

Example 9. Show that 100 divides 1110 − 1.

Justin Stevens Modulos (Lecture 2) 39 / 49

Power of 11

Example. Show that 100 divides 1110 − 1.

Since 11 = 1 + 10, we use the binomial theorem:

1110 = (10 + 1)10

=10∑

k=0

(10k

)10k110−k

= 1 +(101

)101 +

(102

)102 +

(103

)103 + · · ·

≡ 1 (mod 100).

The conclusion hence follows that 100 | 1110 − 1.

Justin Stevens Modulos (Lecture 2) 40 / 49

Outline

1 Problem Set 1 Review

2 Modular Arithmetic

3 Exponents

4 Divisibility Rules RevisitedDivisibility Rules

5 Backup Slides

Justin Stevens Modulos (Lecture 2) 41 / 49

Decimal

The system we conventionally use for writing numbers is known as decimal.

In the decimal system, we write a number such as 1337 in terms of powersof 10. For instance, 1337 = 103 + 3 · 102 + 3 · 101 + 7 · 100. In general,

n = akak−1 · · · a2a1a0

= 10kak + 10k−1ak−1 + · · ·+ 102a2 + 101a1 + a0

=k∑

j=0

(10j · aj

).

Using decimal, we can prove the divisibility rules for 9 and 11.

Justin Stevens Modulos (Lecture 2) 42 / 49

Divisibility Rule for 9

Example. Show that a number is divisible by 9 if and only if thesum of its digits is divisible by 9.

Solution. Let the number be n. We express n in decimal form:

n = 10kak + 10k−1ak−1 + · · ·+ 102a2 + 101a1 + a0.

Notice that 10 ≡ 1 (mod 9). Therefore, using modulo exponentiation:

n = 10kak + 10k−1ak−1 + · · ·+ 102a2 + 101a1 + a0

≡ 1kak + 1k−1ak−1 + · · ·+ 12a2 + 11a1 + a0

≡ ak + ak−1 + · · ·+ a2 + a1 + a0 (mod 9).

Therefore, n is divisible by 9 if and only if the sum of its digits is.

Justin Stevens Modulos (Lecture 2) 43 / 49

Divisibility Rule for 11

Example. Show that a number is divisible by 11 if and only if thealternating sum of its digits is divisible by 11.

Solution. The alternating sum of digits of n isa0 − a1 + a2 − a3 + · · ·+ (−1)k ak . Notice that 10 ≡ −1 (mod 11).Therefore, using modulo exponentiation:

n = 10kak + 10k−1ak−1 + · · ·+ 102a2 + 101a1 + a0

≡ (−1)k ak + (−1)k−1 ak−1 + · · ·+ (−1)2 a2 + (−1)1 a1 + a0

≡ a0 − a1 + a2 − a3 + · · ·+ (−1)k ak (mod 11).

Therefore, n is divisible by 11 if and only if the alternating sum of its digitsis.

Justin Stevens Modulos (Lecture 2) 44 / 49

Divisible by 91 Problem

Example. (HMMT) For what single digit N does 91 divide the9-digit number 12345N789.

Solution. Since 1001 = 91 · 11, 103 = 1000 ≡ −1 (mod 91). Now,

123450789 = 123 · 106 + 450 · 103 + 789≡ 123 · 1 + 450 · −1 + 789 · 1≡ 32 + (−5) · (−1) + 61≡ 98 ≡ 7 (mod 91).

Therefore, in order to find N:

12345N789 = 7 + 1000N ≡ 7− N ≡ 0 (mod 91) =⇒ N = 7 .

Justin Stevens Modulos (Lecture 2) 45 / 49

Outline

1 Problem Set 1 Review

2 Modular Arithmetic

3 Exponents

4 Divisibility Rules Revisited

5 Backup Slides

Justin Stevens Modulos (Lecture 2) 46 / 49

Natural Numbers Divided by 12

Example. The remainders when two natural numbers are divided by12 are 7 and 8 respectively.

Find the remainder when their sum is divided by 12.Find the remainder when their sum is divided by 6.

Solution. Let a and b be such that a ≡ 7 (mod 12) and b ≡ 8 (mod 12).Adding the congruences gives

a + b ≡ 7 + 8 ≡ 15 ≡ 3 (mod 12).

We wish to find the modulo 6 residues of a and b:

a = 12q1 + 7 = 6 (2q1 + 1) + 1b = 12q2 + 8 = 6 (2q2 + 1) + 2.

Therefore, a ≡ 1 (mod 6) and b ≡ 2 (mod 6). Adding gives:

a + b ≡ 1 + 2 ≡ 3 (mod 6).Justin Stevens Modulos (Lecture 2) 47 / 49

7n − 2n Divisible by 5 Part I

Example. Show that 5 always divides 7n − 2n for all integers n.

Solution. As we did before, we begin by exploring this for small values of n:

72 − 22 = 49− 4 = 45 = 5 · 973 − 23 = 343− 8 = 335 = 5 · 6774 − 24 = 2401− 16 = 2385 = 5 · 477

Do you see anything interesting about the coefficients on the right?

9 = 71 + 21

67 = 72 + 71 · 21 + 22

477 = 73 + 72 · 21 + 71 · 22 + 23

Justin Stevens Modulos (Lecture 2) 48 / 49

7n − 2n Divisible by 5 Part II

Example. Show that 5 always divides 7n − 2n for all integers n.Using the fact that 7− 2 = 5, we can rewrite the original equations as:

72 − 22 = (7− 2)(7 + 2)73 − 23 = (7− 2)(72 + 71 · 21 + 22)74 − 24 = (7− 2)(73 + 72 · 21 + 71 · 22 + 23).

In general, I claim that

7n − 2n = (7− 2)(7n−1 + 7n−2 · 21 + 7n−3 · 22 + · · ·+ 2n−1

).

Therefore, 5 | 7n − 2n.

Justin Stevens Modulos (Lecture 2) 49 / 49