SESAME Modular Arithmetic. MurphyKate Montee. March 2018 IN,Z, We think numbers should satisfy certain rules, which we call axioms:

Similar documents
1.6 Congruence Modulo m

Modular arithmetic Math 2320

The congruence relation has many similarities to equality. The following theorem says that congruence, like equality, is an equivalence relation.

Applications of Fermat s Little Theorem and Congruences

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

Solutions for the 2nd Practice Midterm

Solutions for the Practice Final

Math 127: Equivalence Relations

Wilson s Theorem and Fermat s Theorem

Modular Arithmetic. claserken. July 2016

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

6.2 Modular Arithmetic

MAT Modular arithmetic and number theory. Modular arithmetic

Introduction to Modular Arithmetic

6. Find an inverse of a modulo m for each of these pairs of relatively prime integers using the method

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Number Theory. Konkreetne Matemaatika

Number Theory/Cryptography (part 1 of CSC 282)

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

Modular Arithmetic. Kieran Cooney - February 18, 2016

Power = 36² mod 99 Power = 9 5 a 5 = 0 x = 81 Power = 9² mod 99 Power = 81 6 a 6 = 1 x = 81 x 81 mod 99 x = 27 7 a 7 = 1 x = 27 x 27 mod 99 x = 36

Practice Midterm 2 Solutions

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 4 October 2013

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

Modular Arithmetic and Doomsday

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 24 February 2012

Numbers (8A) Young Won Lim 6/21/17

MATH 135 Algebra, Solutions to Assignment 7

Numbers (8A) Young Won Lim 5/24/17

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

MATH 13150: Freshman Seminar Unit 15

Distribution of Primes

University of British Columbia. Math 312, Midterm, 6th of June 2017

Algorithmic Number Theory and Cryptography (CS 303)

LECTURE 7: POLYNOMIAL CONGRUENCES TO PRIME POWER MODULI

SOLUTIONS FOR PROBLEM SET 4

b) Find all positive integers smaller than 200 which leave remainder 1, 3, 4 upon division by 3, 5, 7 respectively.

Numbers (8A) Young Won Lim 5/22/17

The Chinese Remainder Theorem

Solutions to the 2004 CMO written March 31, 2004

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

Fermat s little theorem. RSA.

Solutions for the Practice Questions

Data security (Cryptography) exercise book

p 1 MAX(a,b) + MIN(a,b) = a+b n m means that m is a an integer multiple of n. Greatest Common Divisor: We say that n divides m.

#A3 INTEGERS 17 (2017) A NEW CONSTRAINT ON PERFECT CUBOIDS. Thomas A. Plick

Cryptography Math 1580 Silverman First Hour Exam Mon Oct 2, 2017

NOTES: SIGNED INTEGERS DAY 1

MA/CSSE 473 Day 9. The algorithm (modified) N 1

NUMBER THEORY AMIN WITNO

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

Discrete Square Root. Çetin Kaya Koç Winter / 11

Public Key Cryptography

To be able to determine the quadratic character of an arbitrary number mod p (p an odd prime), we. The first (and most delicate) case concerns 2

MATH CIRCLE, 10/13/2018

An interesting class of problems of a computational nature ask for the standard residue of a power of a number, e.g.,

An elementary study of Goldbach Conjecture

Math 255 Spring 2017 Solving x 2 a (mod n)

Grade 6/7/8 Math Circles April 1/2, Modular Arithmetic

Math 412: Number Theory Lecture 6: congruence system and

Public Key Cryptography Great Ideas in Theoretical Computer Science Saarland University, Summer 2014

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

Assignment 2. Due: Monday Oct. 15, :59pm

LECTURE 3: CONGRUENCES. 1. Basic properties of congruences We begin by introducing some definitions and elementary properties.

A C E. Answers Investigation 4. Applications. Dimensions of 39 Square Unit Rectangles and Partitions. Small Medium Large

Modular Arithmetic: refresher.

Primitive Roots. Chapter Orders and Primitive Roots

1999 Mathcounts National Sprint Round Solutions

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

MATH 324 Elementary Number Theory Solutions to Practice Problems for Final Examination Monday August 8, 2005

Goldbach Conjecture (7 th june 1742)

Cryptography, Number Theory, and RSA

Math 319 Problem Set #7 Solution 18 April 2002

Discrete Mathematics & Mathematical Reasoning Multiplicative Inverses and Some Cryptography

Three of these grids share a property that the other three do not. Can you find such a property? + mod

12. Let Rm = {0,1,2,..., m 1} be a complete residue system modulo ra. Let a be an integer. When is a Rm = {0,1 a, 2 a,...

CHAPTER 2. Modular Arithmetic

Overview. The Big Picture... CSC 580 Cryptography and Computer Security. January 25, Math Basics for Cryptography

Public Key Encryption

Two congruences involving 4-cores

Meet #5 March Intermediate Mathematics League of Eastern Massachusetts

IMLEM Meet #5 March/April Intermediate Mathematics League of Eastern Massachusetts

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015

METHOD 1: METHOD 2: 4D METHOD 1: METHOD 2:

Math 1111 Math Exam Study Guide

1111: Linear Algebra I

Class 8 Cubes and Cube Root

Lecture 8. Outline. 1. Modular Arithmetic. Clock Math!!! 2. Inverses for Modular Arithmetic: Greatest Common Divisor. 3. Euclid s GCD Algorithm

Arithmetic of Remainders (Congruences)

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 7 November, CS1800 Discrete Structures Midterm Version C

Final exam. Question Points Score. Total: 150

Patterns and Relations

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

FREDRIK TUFVESSON ELECTRICAL AND INFORMATION TECHNOLOGY

Algorithmic Number Theory and Cryptography (CS 303)

Improper Fractions. An Improper Fraction has a top number larger than (or equal to) the bottom number.

Diophantine Equations and Modulo 11.

Fall. Spring. Possible Summer Topics

T101 DEPARTMENTAL FINAL REVIEW

Exam 1 7 = = 49 2 ( ) = = 7 ( ) =

Transcription:

SESAME Modular Arithmetic MurphyKate Montee March 08 What is a Number? Examples of Number Systems: We think numbers should satisfy certain rules which we call axioms: Commutivity Associativity 3 Existence of an Identity Existence of Inverses Usually we want our numbers to satisfy these rules for two operations: addition and multiplication If a set of numbers satisfies these rules for one operation we call them a: If a set of numbers satisfies these rules for two operations (except that the additive identity has no multiplicative inverse) we call them a: Commutative Group IN Z Examples Q R modular sword modular 6 World ring NonExamples Commutative / t ) % noinvwses! group Ring I Q tin +x ) modular 5 World modular 6 World

' Arithmetic Modulo 5 In the system arithmetic modulo 5 there are 5 numbers : 0 3 and they follow the rule of addition around a circle 05 3 / In algebraic terms we say that two integers are equivalent mod 5 if they di er by a multiple of 5 We write this with a triple equals sign: If it is not totally clear we can write (mod 5) at the end \z i 0 0 0 Examples: + 5 0 (mod 5) 3+7 (mod D 3 FF ' 5) +3 3 (mod 5) 3 Mj ; z z z ' We can fill in an addition table to help our calculations: + 0 3 0 0 I 3 0 3 0 3 3 0 I 3 0 I 3 Question: Does this satisfy our axioms? because Commutative Yes! O Inverse Identity symmetric over diagonal is a 0 in exist because there and column each row

3 Subtraction Modulo 5 We want our subtraction to work like it does in the integers: 5+! 5 and 5 In the modulo 5 world we can use the addition table to help us Example: What is 0 (mod 5)? Since + 0 (mod 5) then 0 (mod 5) You try: 3 0 Since + since : + E 0 Mutiplication Modulo 5 We use the same rule as before: two integers are equivalent modulo 5 if they di er by a multiple of 5 Notice that you can still use the circle to help you * o* Example: 3 6 and 6 (5) + so 6 (mod 5) Therefore: 3 (mod 5) Example: 3 and (5) + so (mod 5) Therefore: 3 (mod 5) Notice that just like in the integers! 3 ( 3) 3

So 0 0 3 0 O 0 0 0 0 0 0 30 0 3 3 3 3 I Name at least three patterns that you see in the multiplication table: each number shows row and column 0 are all 0 rows come in paired Symmetric over up exactly once in each now and column minor diagonal images Kandis land ) Definition: A number k is a square root of n if k n Question: What elements in modulo 5 arithmetic have square roots? Which have cubed roots? Fourth roots? The numbers on the main diagonal and 3 aren't on the diagonal so they are squares aren't squares 030 3 33 3 so every number is a cube! If n ekt a square then n(k so ho or! n is a square of

5 Division Modulo 5 Just like subtraction we can use the multiplication table to help us divide Remember that 3 3 so we can say that 3 is the number n such that 3n Example: Since 3 6 (mod 5) (mod 5) 3 Example: Since 3 (mod 5) 3 (mod 5) You try: Calculate the following in modulo 5 arithmetic 3 FX 3 then use the multiplication table! 3 3 Ex 3 : + El!! 5

But 6 What s So Special About 5? Why should 5 have all the fun? You know from your last homework that you can play these games with 6 too Why not any integer? Fill in the following tables for modulo 6 arithmetic: + 0 3 5 0 3 5 0 0 3 0 0 0 0 0 0 0 5 3 5 5 0 0 3 3 5 0 0 0 3 3 5 0 3 0 3 0 3 0 3 I 5 0 3 O Y 0 5 0 3 5 0 5 3 I g Questions: What patterns are the same as the modulo 5 world? What are di erent? The addition tables au similar! But every the how very the mod 6 MWH table not has have 3 numbers number! Some rows way and the row has Zhumbosl What is 5 (mod 6)? We Want EX so 5 Is no such X! Ez DOES modulo 6! in Not there EXIST 6

3 In general it is not always fastest to solve a modular arithmetic problem by writing out an entire table We want to use the fact that two integers are equivalent modulo n if they di er by a multiple of n We write that in algebra by the following formula: Ab lmodn ) If A btkn Example: To calculate + 3 (mod 7) I first know that + 3 5 Then 5 (7) + 8 so 5 8 (mod 7) Therefore + 3 8 (mod 7) for some K You try: 6 3 (mod 7) 5 7 (mod 3) + 9 (mod3) 6 37 5 735 35 +9 ( mod 7 7+70 ) C mod 3 ) 33 33 3 0 ( mod 3 ) 7 Calculations in Modular Arithmetic There is more than one way to solve these problems Sometimes one method is faster and sometimes the other Example: Calculate 376 (mod 7) Method Method (calculate then reduce) (reduce then calculate) 376 8 (7) + 3 376 33 (b) + 8795+6 I 6 ( mod 7 ) zzy } 6 3 6 ( mod 7 ) ( mod 7 ) ( mod 'D Example: Calculate 39 63 (mod 633) Since 63 (mod 633) 39 63 3 3 3 + 633 9 (mod 633) 7

) You try: Calculate the following: 639 37 (mod 7) 507 37 (mod 509) 639 37 3 6(mod7 ) 367 (mod 369) 7 6 (mod D 5) 507 ( mod 509 ) 3 903 + 63 97 (mod 00) 507 37 05 37 (mod 7) ) 76(773 367 ( mod 369 ) 33 367 ( 39033 ( mod 369 ( 6399 7) + ( mod > ) 37 63+3 3 ( mod 7) 37 77+507 L mod 509 ) 79 ( mod 5 ) Lmod 00 ) 76 f)3 I E 6397 7 ( mod 00 ) 3 ( mod 5 ) 3903+6397 3+777 ( modloo ) 8 0575 ) 0 50 05 37 ( mod 7) 0 370 ( mod 7) 8

Then a) 8 Modular Division To solve an equation like x 5 (mod 6) we need division Indeed in this case x 5 (mod 6) But we saw earlier that there is no such number! What s going on? For division to be possible we need: to have every number in every row Fta m Theorem: If p is prime then division is always possible in modulo p arithmentic Proof: Suppose division isn't possible in some how inmate tmminsaomenyauenanapaear So nb " na In ba) 0 That means n ( b So Since is P Prime p But kp for some K is a factor of n or (b a) < and 0 b at p O< n < p that's impossible! 9

Question: What if p is not prime? (Hint: Look at the times table for modulo 6 arithmetic and make a hypothesis) Theorem: In arithmetic modulo n for any n we can divide by a if: ( n a) 0

9 Modular Division Now that we know when we can divide we want to be able to actually do it If we have a multiplication table it s not too hard But in general this is tricky! Example: Suppose I want to find 7 (mod ) Method : List all the possibilities until you find a solution: 7 7 3 7 7 5 7 6 7 7 7 8 7 9 7 56# 0 7 : 3 0 8 I 6 since 87 ( mod " ) 35 8 ( mod 9 95 )

Method : Find the number congruent to modulo which is also a multiple of 7: () + ( not a multiple of 7) () + 3 sits : 3() + () + 5() + Since 8756 El ( mod ) 8 mod )

CB 97 7 8) (6037) 5 55 3( }_ 3E8x8x+By Method 3: Do both at once! We want a number which is a multiple of 7 and is congruent to modulo That means we need to solve How do you solve this? 7x y + You try: Calculate the following fractions: 7 6 3 8 5 7 (mod 69) (mod 3) EUCLIDEAN ALGORITHM Ex so (mod 60) # 69 3 ( 6 )! 76 X so 76 +69 y 6 5 ( 5 ) + 5 + 569 6 ( mod b) 66 38 ) +5 538 (5) +3 385 5 (3) + so X 8 ) 6 So 767 ) And 6 ) ) (6936) 6 569 569 3 6± EhzYmod q#8 () HD 3 Ex mod 60 ) 57 7 +60 y F_xE35lmodbtIS 60 37 ) + 9 7 L 9) +8 9 (8) HD 960 87 9 (3) 7 60 (760) 8 (6037) 60 707 So : 5060 3 and 357 Cmod 60 )

IM Her 0 Powers in Modular Arithmetic Remember that x a x b x a+b and (x a ) b x ab Calculating large powers is usually very di cult because the numbers quickly get very large But in modular arithmetic we don t have that problem! Example: Calculate 7 (mod ) We could calculate this and then reduce but 7 397388537303303897609 which is a really big number so that seems like a bad plan Instead let s try to use modular arithmetic to make this a little easier I can write as a sum of powers of : 3 + 8 + So 7 7 3 7 8 7 7 7 8 7 7 6 7 7 3 So: 7 7 3 +7 8 +7 You try: a D 55 (mod 9) 65 (mod 7) 7 39 95 lmodh) 9 8 553 6 5 * 5 9 555 ( mod ") 656+ + 553+6 8++ I % E 7 ( and 9 ) EZ ( mod 7) ' ( mod 9 ) " iii 7 l mod 9 It ± ) 9 EH E 9 (mod 9) " I 7 l mod " ) 36 E 553 E 7 (77) 656 7H I I D 77 EH 'll 7Cmodl9D ( mod 7) 8 H)E l mod > ) " 36 / ( mod > ' 3

3+7 68 3 ' Theorem (Fermat): If p is prime and p is not a factor of a then a p (modp) Example: Calculate 55 (mod 9) Since 9 is prime and 9 is not a factor of we can use Fermat s Theorem Since 55 3(8) + we get 55 3(8)+ ( 8 ) 3 3 (mod 9) You try: Calculate the following: 6 373 (mod ) 7 86 (mod 3) 83 (mod 3) 373 370 ) +3 6373 ( 6 " ) " 633 ' 7lmodD) 63366 3 ' +0 86 3 ) 786(7 ) 370 787 @9) 9 (3) 8 3 3 83 You can also use Fermat s Theorem to find reciprocals Example: Find 8 (mod 9) By Fermat s Theorem 88 (mod 9) so 8 8 7 and 8 87 (mod 9) 83(93736) ' ( 6 ) 56 z (6 3 3 ( 9) z 3 9µ@odT) 6(mod3)) 5