Modular Arithmetic Investigation

Similar documents
Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

Integers and Division

A Guide to Arithmetic

CHAPTER 3. Congruences. Congruence: definitions and properties

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

1 Modular Arithmetic Grade Level/Prerequisites: Time: Materials: Preparation: Objectives: Navajo Nation Math Circle Connection

Modular Arithmetic Instructor: Marizza Bailey Name:

Math 109 HW 9 Solutions

Powers in Modular Arithmetic, and RSA Public Key Cryptography

MATH 25 CLASS 12 NOTES, OCT Contents 1. Simultaneous linear congruences 1 2. Simultaneous linear congruences 2

Number Theory. Modular Arithmetic

MATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

Sums of Squares. Bianca Homberg and Minna Liu

Math 299 Supplement: Modular Arithmetic Nov 8, 2013

You separate binary numbers into columns in a similar fashion. 2 5 = 32

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

ax b mod m. has a solution if and only if d b. In this case, there is one solution, call it x 0, to the equation and there are d solutions x m d

Math From Scratch Lesson 20: The Chinese Remainder Theorem

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

Number theory (Chapter 4)

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Number Theory Proof Portfolio

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

Math 110 HW 3 solutions

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Algebra 1B notes and problems March 12, 2009 Factoring page 1

8 Primes and Modular Arithmetic

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

Winter Camp 2009 Number Theory Tips and Tricks

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Elementary Number Theory MARUCO. Summer, 2018

cse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 1

The RSA public encryption scheme: How I learned to stop worrying and love buying stuff online

MODULAR ARITHMETIC KEITH CONRAD

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course

(Primes and) Squares modulo p

Exam 2 Solutions. In class questions

Continuing discussion of CRC s, especially looking at two-bit errors

Number Theory Homework.

1. multiplication is commutative and associative;

CS 360, Winter Morphology of Proof: An introduction to rigorous proof techniques

Wilson s Theorem and Fermat s Little Theorem

Factoring. there exists some 1 i < j l such that x i x j (mod p). (1) p gcd(x i x j, n).

Applied Cryptography and Computer Security CSE 664 Spring 2018

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Number theory (Chapter 4)

1 Overview and revision

MATH CSE20 Homework 5 Due Monday November 4

4 Linear Recurrence Relations & the Fibonacci Sequence

Lecture Notes, Week 6

CHMC: Finite Fields 9/23/17

MATH 310: Homework 7

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Number Theory A focused introduction

Clock Arithmetic. 1. If it is 9 o clock and you get out of school in 4 hours, when do you get out of school?

MATH 2200 Final Review

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

1. Prove that the number cannot be represented as a 2 +3b 2 for any integers a and b. (Hint: Consider the remainder mod 3).

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

Math 13, Spring 2013, Lecture B: Midterm

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

Number Theory. Zachary Friggstad. Programming Club Meeting

π π π points:= { seq([n*cos(pi/4*n), N*sin(Pi/4*N)], N=0..120) }:

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Math Circles Cryptography

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Homework 5. This homework is due October 6, 2014, at 12:00 noon.

Introduction. What is RSA. A Guide To RSA by Robert Yates. Topics

Simple Math: Cryptography

Proof Techniques (Review of Math 271)

The Chinese Remainder Theorem

Math 38: Graph Theory Spring 2004 Dartmouth College. On Writing Proofs. 1 Introduction. 2 Finding A Solution

CSE 20: Discrete Mathematics

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

Grade 11/12 Math Circles Rational Points on an Elliptic Curves Dr. Carmen Bruni November 11, Lest We Forget

Chapter 3 ALGEBRA. Overview. Algebra. 3.1 Linear Equations and Applications 3.2 More Linear Equations 3.3 Equations with Exponents. Section 3.

10 Public Key Cryptography : RSA

Base Number Systems. Honors Precalculus Mr. Velazquez

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Clock Arithmetic and Euclid s Algorithm

3 The language of proof

REVIEW PROBLEMS FOR SECOND 3200 MIDTERM

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

CPSC 467: Cryptography and Computer Security

3.7 Non-linear Diophantine Equations

EXTRA CREDIT FOR MATH 39

COMP424 Computer Security

Notes on arithmetic. 1. Representation in base B

Basic elements of number theory

Transcription:

The basics Modular Arithmetic Investigation Definition: Two numbers are considered congruent, modulo n if they are exactly a multiple of n apart. Equivalently, if the two numbers are the same distance away from a multiple of n. Example: 17 and 122 are congruent, modulo 5, because 17 = 5 3 + 2 and 122 = 5 24 + 2. They are both 2 more than a multiple of 5. Definition: The residue of a number, modulo n, is the smallest number (always between 0 and n 1) which is congruent to the original number, modulo n. Example: The residue of 34, modulo 10, is 4, because it is the smallest number which is, like 34, also 4 more than a multiple of 10. Notation: The statement 17 is congruent to 302, modulo 3 can be written as: 17 mod 3 302 mod 3, or often just 17 302 mod 3. If the modulus is known, you can get away with abbreviating this further to 17 302. For instance, if we are just dealing with mod 10, it is fine to write 31415 66435 5, etc. The investigation The aim is to investigate how the rules of adding and multiplying apply to modular arithmetic. Getting started As with any open investigation, conclusions are most readily found through a clear, structured approach which relies on the use of conjectures to direct your efforts. A conjecture is simply an observation which you think may be true. You do not need to be convinced by it, but by clarifying the pattern or rule you think you have observed you will be in a better position to investigate further and hopefully prove or disprove your conjecture either is beneficial. If you prove a conjecture correct, see if you can strengthen or extend it. If you prove it false, consider how it might be modified or improved to make it true. If you find a conjecture is partially true, but breaks down in certain cases, consider what makes those cases different and try to develop or modify your conjecture accordingly. Problem solving Begin by following these three simple steps: 1. Clarify the question Even if the problem you are working on is given in deliberately vague terms (like this one!) you should do your best to narrow down what is being asked. How will you know when you ve solved the problem? What would a satisfactory answer look like? Will you need to demonstrate how you got your answer? 2. Consider your position Having a clear view of your starting point will help you see where to go next. What do you already know that may be helpful? What relevant information have you been given? 3. Choose an approach When you get stuck, try a different tack. Use conjectures to test your ideas, and when you think you have found a valid conclusion, try to explain why it must be true. If the problem is too hard to tackle, try to simplify it. Solve an easier version, then see if you can extend the ideas to the harder one.

Hints & suggestions for how to proceed Modular Arithmetic Investigation Hints, suggestions and challenges Start by choosing a modulus, and calculate the residue of a few numbers with this modulus. Try adding a pair of numbers, and see what happens to the residue. Make a table listing the residue of the numbers you added and the residue of the answer. See if you can form a rule that describes what is happening, and explain why it works. Follow a similar approach to investigate multiplication. List some numbers, and their residue, then tabulate the residue of their product. Look for a rule that links the two original residues with the result. As an extension, consider powers. To begin with, use a modulus of 10, and investigate this for successive powers of, say 2. Is there a pattern to the residues? Will there be a pattern for different moduli? Or for powers of a different number? The final challenges Once you ve developed your ideas sufficiently and reached some useful conclusions, you should be able to attempt a few of these (hard) challenges: (answers should be relatively easily calculated without a calculator by using clever simplifying: if you re struggling with the multiplication you re trying too hard!) 1. Find the remainder when 3 + 52 + 97 + 22 + 438 is divided by 10. 2. Find the remainder when 3 52 97 22 438 is divided by 10. 3. Find the remainder when 3 52 97 22 438 is divided by 7. 4. Find the remainder when 2 64 is divided by 10. (Hint: consider 2 2, then (2 2 ) 2, etc.) 5. The largest known prime, as of 2014, is the 48 th Mersenne prime (one in the form 2 p 1 where p is prime), which is: 2 57885161 1. Find the last digit of this number. (Hint: use modulus 10). 6. Find the remainder when 2 57885161 1 is divided by 11. What s next? The powerful nature of modular arithmetic is responsible for the RSA encryption algorithm, which requires computers to calculate otherwise intractable problems involving huge powers. The tricks with the modulus function allow one-way calculations to be done quickly, while reversing the calculations with current knowledge and computing power would take years and years. This is the basis of internet security (look up Public Key RSA encryption for more details).

Modular Arithmetic Investigation SOLUTIONS Note: the following is designed to resemble a logical approach to the problem. It is not the only logical approach by any means, and since it does not include dead ends or unproductive conjectures it is both unrealistically short compared to a genuine investigation and unrealistically linear in its progress. Firstly, we can look at adding, using a really simple example modulo 2. This should give us results we are already familiar with (for instance, adding two odd numbers gives an odd number). 5 1 mod 2 6 0 mod 2 5 + 6 11 1 mod 2 10 0 4 0 10 + 4 14 0 7 1 11 1 7 + 11 18 0 Conjecture: When two numbers are added, the sum of their residues is congruent to the residue of their sums. In other words: (a mod n) + (b mod n) (a + b) mod n Testing the conjecture with a different modulus: The residue of the sum: (245 + 16) mod 10 261 mod 10 1 mod 10 The sum of the residues: (245 mod 10) + (16 mod 10) (5) + (6) 11 1 mod 10 This appears to be true. Proof: a mod n can be written as pn + q where q is the remainder when a is divided by n. (For instance 29 mod 6 can be written as 4 6 + 5). Then when this is added to b mod n (which we can assume, similarly, may be written as rn + s), we get: (pn + q) + (rn + s) = (p + r)n + (q + s) Finding the residue of this, mod n, will be equivalent to finding the residue of q + s since the residue of (p + r)n must be 0 (it has n as a factor). Therefore the sum of the original residues (q + s) is congruent to the residue of the sum (also q + s). Challenge Question 1 Solution Find the remainder when 3 + 52 + 97 + 22 + 438 is divided by 10. Since adding numbers then finding their residue is equivalent to finding their residue then adding, we can simplify this whole problem to: 3 + 2 + 7 + 2 + 8 Which gives: 22 Which is congruent to: 2

Next, we will investigate multiplying, modulo 5. 12 2 mod 5 10 0 mod 5 12 10 120 0 mod 5 7 2 6 1 7 6 42 2 8 3 9 4 8 9 72 2 Initially it looked like the product of the residues gave the same as the residue of the product, but, as the last example shows, it is not quite that simple. However, notice that 3 4 12 2, so the results are congruent, just like when adding. Conjecture: When two numbers are multiplied, the product of the residues is congruent to the residue of the product. Proof: Let a mod n be equal to pn + q as in the previous proof, and b mod n be equal to rn + s. Then: (a mod n)(b mod n) (pn + q)(rn + s) prn 2 + (qr + ps)n + qs qs Note that this expression can be written as n(prn + qr + ps) + qs, and since all but qs has a factor of n, the residue of this expression is simply the residue of qs. That is, the product of the residues (qs) is congruent to the residue of the product (also qs). Challenge Question 2 Solution Find the remainder when 3 52 97 22 438 is divided by 10. Just like with adding, we can take residues before we start and make everything simpler: 3 2 7 2 8 And even as we go along, we can simplify at each step by taking residues again. For instance, 2 8 6: Grouping in any convenient way you like: Taking residues to make the next step easier: Taking residues again: (3 2 7) (2 8) 42 16 2 6 12 2

Challenge Question 3 Solution Find the remainder when 3 52 97 22 438 is divided by 7. This is really the same process as above, but residues are just a little less easy to spot since they won t just be the last digit, but the remainder when dividing by 7. Since 52 3, 97 6, etc: Grouping conveniently: 3 3 6 1 4 (3 3) (6 1 4) Taking residues to make the next step easier: 9 24 2 3 6 Powers are somewhat more confusing, but they build on the concept of multiplying. Note that if (a mod n)(b mod n) (ab mod n), as proved above, then (a mod n) 2 a 2 mod n. This can be extended to say that (a mod n) k a k mod n, which means that we know for certain that, since 37 7 mod 10, it follows that 37 2 7 2 mod 10. We can test this: 37 2 1369 9 mod 10, and also we know that 7 2 49 9 mod 10. Using mod 10 (since it is easy to identify the residue simply the last digit): 7 1 7 mod 10 7 2 49 9 mod 10 7 4 (7 2 ) 2 9 2 81 1 mod 10 2 2 mod 10 4 (2 2 ) 2 mod 10 4 2 mod 10 16 mod 10 6 ((2 2 ) 2 ) 2 6 2 mod 10 36 mod 10 6 mod 10 Challenge Question 4 Solution Find the remainder when 2 64 is divided by 10. (Hint: consider 2 2, then (2 2 ) 2, etc.) Since 2 2 4, we know (2 2 ) 2 4 2 16 6. And this means that ((2 2 ) 2 ) 2 6 2 36 6. Turns out, any power of 2 in this form is congruent to 6. 2 64 (2 32 ) 2 ((2 16 ) 2 ) 2 (((2 8 ) 2 ) 2 ) 2 ((((2 4 ) 2 ) 2 ) 2 ) 2 (((((2 2 ) 2 ) 2 ) 2 ) 2 ) 2 6

The idea of using the modulus of the power to calculate the modulus of a number is a very powerful tool for dealing with otherwise impossibly large numbers. We can look for patterns within powers, then use those: Powers of 2 Residue modulo 10 The pattern should be clear. 2 1+4k 2, and 2 2+4k 4 etc, 2 1 2 for all k. This pattern can be verified by considering 2 2 4 multiplication by 2 from one term to the next: 2 3 8 2 2 4 2 4 6 4 2 8 2 5 2 8 2 6 2 6 4 6 2 2 2 7 8 etc 2 8 6 Challenge Question 5 Solution The largest known prime, as of 2014, is the 48 th Mersenne prime (one in the form 2 p 1 where p is prime), which is: 2 57885161 1. Find the last digit of this number. (Hint: use modulus 10). We are looking for the residue of 2 57885161 1, modulo 10. First, consider the power: 57885161 1 mod 4. In other words, it is 1 greater than a multiple of 4, and therefore fits in the same category as 2 5 or 2 9, and must end in a 2. 2 57885161 2 mod 10 2 57885161 1 1 mod 10 Last Digit = 1 To solve the final challenge question, all it takes is examining powers of 2 in relation to a different modulus: Powers of 2 Residue modulo 11 While the pattern for mod 10 seemed nicer, because 2 and 10 are not coprime (that is, they share a common factor), we never got to a point where the residue was 1. 2 1 2 2 2 4 2 3 8 2 4 5 2 5 10 2 6 9 2 7 7 2 8 3 2 9 6 2 10 1 Challenge Question 6 Solution Find the remainder when 2 57885161 1 is divided by 11. Why is that so useful? Consider 2 12345. It can be written as (2 10 ) 1234 2 5. And since 2 10 1, this is the same as 1 1234 2 5. Provided we know the residue of powers of 2 up to 2 10, we know the residue of all powers of 2. Using the results found above for residues modulo 11, we can think of 2 57885161 as: (2 10 ) 5788516 2 1 Taking advantage of the known residues of 2 10 and 2 1 gives: Therefore 2 57885161 1 2 1 1 mod 11 1 5788516 2 1 2 2 So the remainder when the 48 th Mersenne prime is divided by 11 must be 1.