Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2014 - Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory.

Similar presentations


Presentation on theme: "Copyright © 2014 - Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory."— Presentation transcript:

1 Copyright © 2014 - Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory

2 Copyright © 2014 - Curt Hill Number Theory Study of integers and their properties –Originally known as arithmetic Operations and algorithms Prime numbers and factorization Among other things

3 Divisibility When we divide an integer by a non- zero integer we get two integers: –Quotient –Remainder 15  3 produces quotient 5 and remainder 0 15  2 produces quotient 7 and remainder 1 –We could also consider the result 7.5 –However, this is not an integer Copyright © 2014 - Curt Hill

4 Definitions Copyright © 2014 - Curt Hill

5 Theorems A,B,C are integers and A is not zero If A|B and A|C then A|(B+C) If A|B then A|BC If A|B and B|C then A|C Copyright © 2014 - Curt Hill

6 Proof 1 Prove that if A|B and A|C then A|(B+C) A|B means that B=AI for some integer I A|C means that C=AJ for some integer J B+C = AI + AJ B+C = A(I+J) Thus A|(B+C) Copyright © 2014 - Curt Hill

7 Division ‘Algorithm’ If A is an integer and D a positive integer There are unique integers Q and R where 0  R<D, such that A =DQ+R D is divisor A is dividend Q is quotient R is remainder This is a restatement of A  D gives quotient Q and remainder R Copyright © 2014 - Curt Hill

8 Div and Mod Rosen’s flavor of pseudo-code is definitely Pascal based Pascal used / for real division and div and mod for integer division Thus: –17 div 3 gives the quotient which is 5 –17 mod 3 gives remainder, 2 The two, div and mod, will be used like operators Copyright © 2014 - Curt Hill

9 Examples -19 and 4 –-19 div 4 = -4 –-19 mod 4 = -3 –-19 = 4  -4 + -3 26 and 4 –26 div 5 = 5 –26 mod 5 = 1 –26 = 5  5 + 1 Copyright © 2014 - Curt Hill

10 Clock Arithmetic When we add 8 hours to 6 o’clock we do not get 14:00 –Rather we get 2:00 Clock arithmetic is a bit odd –12 and 0 are the same –No negatives You do arithmetic and then mod it by 12 –If the result is 0, make it 12 We now move towards modular arithmetic Copyright © 2014 - Curt Hill

11 Military Time Military time uses a 24 hour clock and it works without the exceptions of clock arithmetic 0 is midnight 12 is noon 16 is 4PM 23:59 is the highest time All arithmetic operations are modded by 24 Copyright © 2014 - Curt Hill

12 Modular Arithmetic If we take a time and add 24 hours we have not changed it all Moreover if we take a time and add 4 fours or 28 hours or 52 hours it all ends with the same time of day This is the notion of congruence in modular arithmetic Two numbers are congruent if they are equal after being modded by a particular integer Copyright © 2014 - Curt Hill

13 Congruence More Formally Suppose that a and be are integers and m is some positive integer We say that a is congruent to b modulo m if a mod m = b mod m –The notation is a  b (mod m) If a  b (mod m) then m|(a-b) –The negation of congruence uses the symbol  In congruence we refer to m as the modulus (plural is moduli) Copyright © 2014 - Curt Hill

14 Two Mods a  b (mod m) expresses a relation a mod m is a function What is the difference? Copyright © 2014 - Curt Hill

15 Another Theorem a  b (mod m) iff there is an integer k such that a=b+km Proof: –From a=b+km we get a-b = km –Then (a-b)/m = k which we know to be an integer –We know that if a  b (mod m) then m|(a- b) which simply means that m divides a- b evenly Copyright © 2014 - Curt Hill

16 Congruence Class An set of integers congruent with an integer mod m This is the set of integers b where a  b (mod m) The evens are a congruence class mod 2 as are the odds –16  20 (mod 2) and any even could be substituted for either 16 or 20 –17  31 (mod 2) and any odd could be substituted for either 17 or 31 What are four elements of the congruence class of 26 mod 5? Copyright © 2014 - Curt Hill

17 Arithmetic and Congruence Classes If a  b (mod m) and c  d (mod m) Then a+c  b+d (mod m) Also ac  bd (mod m) How would such a proof be done? The corollary is (a+b) mod m = ((a mod m)+(b mod m))mod m And ab mod m = ((a mod m)(b mod m))mod m Copyright © 2014 - Curt Hill

18 a+c  b+d (mod m) a  b (mod m) then a mod m = b mod m Thus a mod m = b mod m = i for some i Also c mod m = d mod m = j for some j Thus i+j = i+j Can you do the other one? Copyright © 2014 - Curt Hill

19 Modulo m Arithmetic Suppose we take the first m integers: {0, 1, 2, … m-1} We may now define arithmetic on this set + m and  m Addition a + m b = (a+b) mod m Multiplication a  m b = (a  b) mod m Copyright © 2014 - Curt Hill

20 Example 15 Our set of numbers is {0, 1, …13, 14} 8 + 15 12 = 20 mod 15 = 5 8 + 15 4 = 12 mod 15 = 12 13 + 15 12 = 25 mod 15 = 10 6  15 12 = 72 mod 15 = 12 6  15 11 = 66 mod 15 = 6 6  15 10 = 60 mod 15 = 0 Copyright © 2014 - Curt Hill

21 Modulo m Arithmetic Has several properties Closure –a + m b and a  m b will be in the set {0..m-1} provided a and b in the set Associativity –(a  m b)  m c = a  m (b  m c) –(a + m b) + m c = a + m (b + m c) Commutativity –a  m b = b  m a –a + m b = b + m a Copyright © 2014 - Curt Hill

22 More Properties Identity elements –0 is identity for addition and 1 for multiplication –Sometimes called the unit –a  m 1 = a –a + m 0 = a Additive inverse –If a  0 is a member of the set then m-a is the additive inverse –a + m (m-a) = 0 Distributivity –a  m (b + m c) = a  m b + m a  m c Copyright © 2014 - Curt Hill

23 Exercises 4.1 –3, 7, 13, 23, 29, 33 Copyright © 2014 - Curt Hill


Download ppt "Copyright © 2014 - Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory."

Similar presentations


Ads by Google