Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Similar documents
Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

3 The fundamentals: Algorithms, the integers, and matrices

Ch 4.2 Divisibility Properties

Discrete Mathematics GCD, LCM, RSA Algorithm

4 Number Theory and Cryptography

5: The Integers (An introduction to Number Theory)

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

Mathematical Induction

CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD

1. (16 points) Circle T if the corresponding statement is True or F if it is False.

2.5 정수와알고리즘 (Integers and Algorithms)

Base-b representations of integers. (b 진법표현 ) Algorithms for computer arithmetic: Euclidean algorithm for finding GCD s.

With Question/Answer Animations. Chapter 4

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

Induction and Recursion

Chapter 5. Number Theory. 5.1 Base b representations

Conversions between Decimal and Binary

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Chapter 5: The Integers

Induction and recursion. Chapter 5

NOTES ON SIMPLE NUMBER THEORY

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

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

The Euclidean Algorithm and Multiplicative Inverses

Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some. Notation: b Fact: for all, b, c Z:

Remainders. We learned how to multiply and divide in elementary

ICS141: Discrete Mathematics for Computer Science I

a the relation arb is defined if and only if = 2 k, k

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

4. Number Theory (Part 2)

Applied Cryptography and Computer Security CSE 664 Spring 2017

2. THE EUCLIDEAN ALGORITHM More ring essentials

Beautiful Mathematics

The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:

4 Powers of an Element; Cyclic Groups

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

Senior Math Circles Cryptography and Number Theory Week 2

Induction. Induction. Induction. Induction. Induction. Induction 2/22/2018

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing

Some Facts from Number Theory

M381 Number Theory 2004 Page 1

Intermediate Math Circles February 26, 2014 Diophantine Equations I

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

INDUCTION AND RECURSION. Lecture 7 - Ch. 4

Introduction to Sets and Logic (MATH 1190)

Mathematics for Computer Science Exercises for Week 10

MATH FINAL EXAM REVIEW HINTS

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Fall 2017 Test II review problems

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

1 Overview and revision

The Euclidean Algorithm

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Binary addition example worked out

Chapter 1 A Survey of Divisibility 14

MATH 215 Final. M4. For all a, b in Z, a b = b a.

18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.

2 Elementary number theory

8 Primes and Modular Arithmetic

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

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Basic elements of number theory

Basic elements of number theory

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse

CISC-102 Fall 2017 Week 3. Principle of Mathematical Induction

Introduction to Number Theory. The study of the integers

Algorithms (II) Yu Yu. Shanghai Jiaotong University

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

Integers and Division

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

ENGIN 112 Intro to Electrical and Computer Engineering

Mathematical Induction

CS250: Discrete Math for Computer Science

Numbers. Çetin Kaya Koç Winter / 18

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

CISC 1400 Discrete Structures

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

MAT 243 Test 2 SOLUTIONS, FORM A

NOTES ON INTEGERS. 1. Integers

Chapter 5.1: Induction

Climbing an Infinite Ladder

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)

Section Summary. Division Division Algorithm Modular Arithmetic

hexadecimal-to-decimal conversion

Chapter 3: The Euclidean Algorithm and Diophantine. Math 138 Burger California State University, Fresno

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Elementary Number Theory Review. Franz Luef

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

Number Theory and Cryptography

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

ENGIN 112 Intro to Electrical and Computer Engineering

Transcription:

Fall 2013

Student Responsibilities Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Proof Worksheets Attendance: Strongly Encouraged Overview 3.6 Integers and Algorithms 3.7 Applications of Number Theory 4.1 Mathematical

Section 3.6 Integers and Algorithms Euclidean Algorithm: an efficient method of finding the greatest common divisor, rather than factoring both numbers. An example of how it works: Find gcd(91,287) 1. Divide the larger number by the smaller one: 287 / 91 = 3 R 14, so 287 = 91 (3) + 14 2. Any divisor of 91 and 287 must also be a divisor of 287-91(3) = 14 Also, any divisor of 91 and 14 must also be a divisor of 287 = 91(3) + 14 3. Thus, gcd(91,287) = gcd(14,91); so divide 91 by 14 91 = 14(6) + 7 4. Same argument applies, so find gcd(14,7) 5. Hence, gcd(91,287) = gcd(14,91) = gcd(7,14) = 7

Algorithm to Find Lemma. Let a = bq + r, where a, b, q, and r are integers. Then gcd(a,b) = gcd(b, r). The Euclidean Algorithm function gcd(a, b: positive integers) x <- a y <- b while (y!= 0) { r <- x mod y x <- y y <- r } // end of loop to find gcd return x //the last non-zero remainder } // end of gcd function

Find: gcd(414, 662)

Integer Representations Theorem. Let b be a positive integer greater than 1. Then if n is a positive integer, it can be expressed uniquely in the form: n = a k b k + a k 1 b k 1 + + a 1 b + a 0 where k is a non negative integer, a 0, a 1,..., a k are non negative integers less than b, and a k 0 The above representation of n is called the base b expansion of n, denoted by (a k a k 1... a 1 a 0 ) b Example I (octal): (734) 8 = 7(8 2 ) + 3(8 1 ) + 4(8 0 ) = 476 10 Example II (binary): 1011001 = 2 6 + 2 4 + 2 3 + 2 0 = 89 10

Hexadecimal Base 16 Hexadecimal or Base 16 digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A (10), B (11), C (12), D (13), E (14), and F (15) Given 4 bits, we can represent 16 different values, 0 F: 0-0000 4-0100 8-1000 C - 1100 1-0001 5-0101 9-1001 D - 1101 2-0010 6-0110 A - 1010 E - 1110 3-0011 7-0111 B - 1011 F - 1111 One byte is 8 bits, so a byte of information can be represented with two hexadecimal digits. For example: 0101 1101 2 = 5D 16 Example III: (2AE0B) 16 = 2(16 4 ) + 10(16 3 ) + 14(16 2 ) + 0(16 1 ) + 11(16 0 ) = 175, 627 10

Conversion from Base 10 Process to convert n 10 to base b 1. Divide n by b to obtain a quotient and remainder: n = bq 0 + a 0, 0 a 0 < b This remainder, a 0, is the rightmost digit in the base b expansion of n. 2. Divide q 0 by b: q 0 = bq 1 + a 1, 0 a 1 < b This remainder, a 1, is the second digit from the right-hand side in the base b expansion of n. 3. Continue this process, successively dividing the quotients by b, obtaining additional base b digits as the remainders. 4. The process terminates when we obtain a quotient equal to zero

Conversion Algorithm Constructing Base b Expansions procedure base_b_expansion (n: positive integer){ q <- n k <- 0 while (q!= 0) { a[k] <- q mod b q <- floor(q / b) k <- k + 1 } // end conversion loop return a } // end expansion

Conversion Practice Find the base 8 expansion of (532) 10 Find the base 2 expansion of (532) 10 Find the base 16 expansion of (532) 10

Arithmetic Operations Addition Addition in various bases is accomplished in a manner similar to base 10 addition binary octal hex 101100 7340 29AC + 011010 + 521 + A131 ------- ----- -----

Representing Values in a Computer Unsigned Integers non negative integer representation used for such things as counting and memory addresses with k bits, exactly 2 k integers, ranging from 0 to 2 k 1 can be represented Signed Integers If integers are stored in 8 bits, how many different bit patterns are there available to assign to various values? If we assign the bit pattern 0000 0000 to the value 0, how many are left for other values? There are different methods to deal with the extra bit pattern.

Signed Integer Representation Use the high order (leftmost) bit to represent the sign of the number: 0 for positive, 1 for negative. All positive numbers (beginning with a 0 bit) are simply evaluated as is. If the first bit is 1 (signifying a negative number), there are several representation methods to consider.

Signed Integer Representation Schemes 1. Signed Magnitude the other bits are evaluated to find the magnitude of the number (then make it negative). 2. 1 s Complement flip (complement) the other bits before evaluating them to find the magnitude (then make it negative). 3. 2 s Complement flip all the bits and add 00... 01 before evaluating them to find the magnitude (then make it negative) The following table is based upon a 4 bit representation. What happen when we add 1 and -1 in each representation?

bit pattern Signed Magnitude 1 s Complement 2 s Complement 0000 0 0 0 0001 1 1 1 0010 2 2 2 0011 3 3 3 0100 4 4 4 0101 5 5 5 0110 6 6 6 0111 7 7 7 1000-0 -7-8 1001-1 -6-7 1010-2 -5-6 1011-3 -4-5 1100-4 -3-4 1101-5 -2-3 1110-6 -1-2 1111-7 -0-1

Section 3.7 Applied Number Theory Theorem 1. (linear combination): If a, b Z +, then s, t Z gcd(a,b) = sa + tb s & t can be found by working backward through the divisions of the Euclidean Algorithm Express gcd(154,105) as linear combination of 252 and 198 Using the Euclidean Algorithm: (2) 154 = 1(105) + 49 (1) 105 = 2(49) + 7 (0) 49 = 7(7) + 0 so gcd(154,105) = 7 Working Backwards: by (1) 7 = 105-2(49) by (2) 49 = 154-105 so 7 = 105-2(154-105) = 3(105) - 2(154)

Combination Example II Find a linear combination of 252 and 198 which equals their gcd. Using the Euclidean Algorithm: (3) 252 = 1(198) + 54 (2) 198 = 3(54) + 36 (1) 54 = 1(36) + 18 (0) 36 = 2(18) + 0 so gcd(252,198) = 18 Working Backwards: by (1) 18 = 54-1(36) by (2) 36 = 198-3(54) so 18 = 54-1(198-3(54)) = 4(54) - 198 by (3) 54 = 252-1(198) so 18 = 4(252-198) - 198 = 4(252) - 5(198)

Combination Example III Find a linear combination of 124 and 323 which equals their gcd. Using the Euclidean Algorithm: (7) 323 = 2(124) + 75 (6) 124 = 1(75) + 49 (5) 75 = 1(49) + 26 (4) 49 = 1(26) + 23 (3) 26 = 1(23) + 3 (2) 23 = 7(3) + 2 (1) 3 = 1(2) + 1 (0) 2 = 2(1) + 0 so gcd(124,323) = 1

You can make your life simpler by next rewriting the equations in terms of the remainders: (7) 323 = 2(124) + 75 75 = 323-2(124) (6) 124 = 1(75) + 49 49 = 124-1(75) (5) 75 = 1(49) + 26 26 = 75-1(49) (4) 49 = 1(26) + 23 23 = 49-1(26) (3) 26 = 1(23) + 3 3 = 26-1(23) (2) 23 = 7(3) + 2 2 = 23-7(3) (1) 3 = 1(2) + 1 1 = 3-1(2) (0) 2 = 2(1) + 0

Using Those Equations, We Obtain: by (1) 1 = 3-1(2) by (2) 2 = 23-7(3) so 1 = 3-1(23-7(3)) = 8(3) - 23 by (3) 3 = 26-1(23) so 1 = 8(26-1(23)) - 23 = 8(26) - 9(23) by (4) 23 = 49-1(26) so 1 = 8(26) - 9(49-26) = 17(26) - 9(49)

by (5) 26 = 75-1(49) so 1 = 17(75-49) - 9(49) = 17(75) - 26(49) by (6) 49 = 124-1(75) so 1 = 17(75) - 26(124-75) = 43(75) - 26(124) by (7) 75 = 323-2(124) so 1 = 43(323-2(124)) - 26(124) = 43(323) - 112(124)

Combination Example IV Find a linear combination of 2002 and 2339 equal to their gcd. Find gcd(2002, 2339):

Working Backwards...

Other Integer Results Lemma 1. If a, b, and c Z + such that gcd(a,b) = 1 and a bc, then a c. Lemma 2. If p is a prime and p a 1 a 2... a n where each a i Z, then p a i for some i. Theorem 2. Let m Z + and let a, b, and c Z. If ac = bc (mod m) and gcd(c, m) = 1, then a b(mod m).

4.1 Mathematical Similar to an infinite line of people, Person 1, Person 2, etc. A secret is told to Person 1, and each person tells the secret to the next person in line if the former person hears it. Let P(n) be the proposition that Person n knows the secret. Then P(1) is true since the secret is told to Person 1. P(2) is true since Person 1 tells Person 2, and so on. By the Principle of Mathematical, every person in line learns the secret.

Mathematical Another Example Consider an infinite row of dominoes labeled 1, 2, 3,..., n, where each domino is positioned to knock the next one over when it falls. Let P(n) be the proposition that domino n is knocked over. If the first domino is knocked over, i.e., P(1) is true, and if whenever the n th domino is knocked over, it also knocks over the (n+1) st domino [i.e., P(n) P(n+1) is true], then all the dominoes are knocked over.

Proof Big Picture Prove the proposition for the lower bound of n, say n = 1; i.e., show P(1) is true Assume for an arbitrary k that P(k) is true Set up a proof machine that demonstrates how to prove P(k+1) true when P(k) is true You have then set up a way to bootstrap from P(1) as far as anyone would want to go. We could simply keep applying the proof machine over and over, moving from P(1) to P(2) to P(3) to... well, as long as we wanted to!

Parts of an Proof (Required in MAT 2345) Label each section: Basis or Base Case (BC) Show the proposition is true for the lower bound of n Inductive Hypothesis (IH) Assume the proposition is true for an arbitrary k Inductive Step (IS) Show the proposition is true for (k+1), using the inductive hypothesis give reasons for each step in the proof usually begin with the LHS and show logical steps to reach the RHS

Prove using : Theorem. n i=0 i = n(n+1) 2, n 0

Prove using : Theorem. n i=0 i 2 = n(n+1)(2n+1) 6, n 0

Prove using : Theorem. n i=0 2i = 2 n+1 1, n 0

Prove using : Theorem. n n(n+1)(n+2)(n+3) i=1 i(i + 1)(i + 2) = 4, n 1

Prove using : Theorem. 5 (n 5 n), n N

Prove using : Theorem. n i=0 i(i!) = (n + 1)! 1, n 1

Prove using : Theorem. 6 (8 n 2 n ), n N

Prove using : Theorem. (x y) (x n y n ), n, x, y N, and y 0, x y

Prove using : Theorem. n! > 2 n, n 4, n N

The Pigeon hole Principle Theorem. If n + 1 balls (n 1) are put inside n boxes, then at least one box will contain more than one ball.

Example of Strong Theorem. All integers n 2 can be written as a product of prime numbers (and 1)