Integers and Mathematical Induction

Similar documents
Math Introduction to Advanced Mathematics

1 Elementary number theory

Discrete Mathematics Lecture 4. Harper Langston New York University

4&5 Binary Operations and Relations. The Integers. (part I)

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

1 Elementary number theory

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

AXIOMS FOR THE INTEGERS

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Topic 10 Part 2 [474 marks]

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Mathematical Induction

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Chapter 1: Number and Operations

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple.

CSE 20 DISCRETE MATH. Winter

Solutions to the Second Midterm Exam

Lecture Notes, CSE 232, Fall 2014 Semester

Power Set of a set and Relations

SECTION 5.1. Sequences

Chapter 4. Number Theory. 4.1 Factors and multiples

Section 1.2 Fractions

Summary of Course Coverage

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

UCT Algorithm Circle: Number Theory

9 abcd = dcba b + 90c = c + 10b b = 10c.

9.5 Equivalence Relations

Assertions & Verification & Example Loop Invariants Example Exam Questions

Algebra 1 Review. Properties of Real Numbers. Algebraic Expressions

Course Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System

Assertions & Verification Example Exam Questions

COP 4516: Math for Programming Contest Notes

9 abcd = dcba b + 90c = c + 10b b = 10c.

A.1 Numbers, Sets and Arithmetic

Introduction to Sets and Logic (MATH 1190)

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH WINTER

Computable Euclidean Domains

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

r=1 The Binomial Theorem. 4 MA095/98G Revision

Odd-Numbered Answers to Exercise Set 1.1: Numbers

CGF Lecture 2 Numbers

Quadratic Equations over Matrices over the Quaternions. By Diana Oliff Mentor: Professor Robert Wilson

Mathematical preliminaries and error analysis

Euclid's Algorithm. MA/CSSE 473 Day 06. Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

EE292: Fundamentals of ECE

DIGITAL SYSTEM DESIGN

One of the most important areas where quantifier logic is used is formal specification of computer programs.

MAT 243 Test 2 SOLUTIONS, FORM A

DISCRETE MATHEMATICS

CS321 Introduction To Numerical Methods

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

UNIT-II NUMBER THEORY

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

Infinity and Uncountability. Countable Countably infinite. Enumeration

CS Network Security. Nasir Memon Polytechnic University Module 7 Public Key Cryptography. RSA.

in this web service Cambridge University Press

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD

Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4.

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

Section 5.5. Greatest common factors

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London

Rational numbers as decimals and as integer fractions

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

EDAA40 At home exercises 1

Formal Languages and Automata

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

Ch 3.4 The Integers and Division

MAT 090 Brian Killough s Instructor Notes Strayer University

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4

Finite Math - J-term Homework. Section Inverse of a Square Matrix

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

CUT VERTICES IN ZERO-DIVISOR GRAPHS OF FINITE COMMUTATIVE RINGS

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Introduction to Modular Arithmetic

Final Test in MAT 410: Introduction to Topology Answers to the Test Questions

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Definition. A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity.

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Modular Arithmetic. is just the set of remainders we can get when we divide integers by n

Prepared by Sa diyya Hendrickson. Package Summary

CMSC Honors Discrete Mathematics

Section A Arithmetic ( 5) Exercise A

Module 1: Information Representation I -- Number Systems

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures

Programming Techniques in Computer Algebra

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

CS321. Introduction to Numerical Methods

Transcription:

IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about the basic properties of integers Become aware how integers are represented in computer memory Explore how addition and subtraction operations are performed on binary numbers Learn how the principle of mathematical induction is used to solve problems Learn about loop invariants and how they are used to prove the correctness of loops Explore various properties of prime numbers Learn about linear Diophantine equations and how to solve them Outline Integers Representation of Integers in Computer Mathematical Induction Prime Numbers Linear Diophantine Equations 3 1

Integers Recall that N : The set of all natural numbers (i.e., all positive integers) Z : The set of all integers Z*: The set of all nonzero integers 4 Properties of Integer Set (1) Let a, b, c Z. Closure: a + b Z a b Z Commutative laws: a+b = b+a a b= b a Associative laws: a+(b+c) = (a+b)+ c a (b c) = (a b) c Identity elements: additive identity: 0 multiplicative identity: 1 5 Properties of Integer Set () Additive inverse: For each integer a, there exists an integer b such that a+b=0=b+a. This integer b is called the additive inverse of a and is denoted by a. Distributive laws: a (b+c) = a b+ a c (b+c) a = b a+ c a Cancellation laws: Suppose that a 0. Then a b = a c implies that b=c; and b a= c aimplies that b=c. 6

Theorem.1.1 7 Comparisons Definition: (greater than) Let a and b be integers. Then a is said to be greater than b, written a>b, if a-b is a positive integer. If a>b, then sometimes we also write b>a. 8 Theorem.1.3 Let a and b be integers such that a>b. Then 1) a+c > b+c for any integer c, and ) ad > bd for any positive integer d. 3) ad < bd for any negative integer d. 9 3

Well-Ordering Principle Axiom: Any nonempty subset of nonnegative integers has a least (i.e., smallest) element. That is, if S is a nonempty subset of the set of nonnegative integers, then there exists n S such that n m for all m S. 10 Theorem.1.5 Let a and b be two positive integers. Then, there exists a positive integer n such that b<na. (p.s. The proof is made by contradiction using the well-ordering principle) 11 Division Algorithm Theorem.1.6: (division algorithm) Let a and b ( 1) be integers. Then there exist unique integers q and r such that a=bq+r The quotient on dividing a by b. The remainder on dividing a by b. where 0 r < b. Corollary: If a and b are two integers with b 0, then there exist unique integers q and r such that a=qb+r, where 0 r < b. 1 4

Example Problem: Any integer is one of the forms 3k, 3k+1, or 3k+, and the square of any integer is one of the forms 3k or 3k+1, where k is an integer. 13 div and mod Operators div a div b = the quotient of a and b on dividing a by b. Examples: 8 div 5 = 1 13 div 3 = 4 mod a mod b = the remainder of a and b on dividing a by b. Example 8 mod 5 = 3 13 mod 3 = 1 14 Divisibility Definition: (divisibility) Let a and b be two integers such that a 0. If there exists an integer c such that b=ac, then a is said to divide b or a is said to be a divisor of b and we write a b. Note: 1. The notation a b means that a does not divide b.. For any integer a, we have a=1a and so 1 a. 3. For an integer b 0, we have b 0 and b b. 15 5

Theorem.1.14 Let a, b, and c be integers. 1) Suppose a 0 and c 0. If a b, then ca cb and ac bc. ) Suppose a 0 and b 0. If a b and b c, then a c. 3) Suppose a 0. If a b and a c, then a (bx+cy) for any integers x and y. 4) Suppose a 0. If a b and a (b+c), then a c. 5) Suppose a 0 and b 0, if a b and b a, then a=±b. 16 Common Divisors Definition: (common divisors) A nonzero integer d is said to be a common divisor of integers a and b if d a and d b. Definition: (greatest common divisors, gcd) A nonzero integer d is said to be a greatest common divisor (gcd) of integers a and b 1. if d is a common divisor of a and b; and. if c is a common divisor of a and b, then c b. 17 gcd(a, b) Let d 1 and d be two greatest common divisor of integers a and b. Then d 1 d and d d 1 according to the definition and d 1 = ± d. Two different gcd s differ in their sign only. The positive one is denoted by gcd(a, b). Example: Consider 8 and 14. ± are the gcd s gcd(8, 14) = 18 6

Theorem.1.19 Let a and b be two integers such that not both are zero. Then gcd(a, b) exists. Moreover, if d=gcd(a, b), then there exist integers s and t such that d=sa+tb. Lemma.1.0: If a and b are positive integers such that a=qb+r, 0 r < b, then gcd(a, b) = gcd(b, r), 19 Euclidean Algorithm (1) According to Lemma.1.0 Given two positive integers, one can obtain the followings recursively: a=q 1 b+r 1, 0 r 1 <b. If r 1 0, b=q r 1 +r, 0 r <r 1. If r 0, r 1 =q 3 r +r 3, 0 r 3 <r. M The remainders r 1, r, r 3,, form a decreasing sequence of nonnegative integers 0 Euclidean Algorithm () Note that: since b is a fixed positive integer, one must encounter the remainder 0 after a finite number of steps. Suppose after (k+1) steps the process terminates, i.e. r k-1 =q k+1 r k +0. Then, gcd(a, b)=gcd(b, r 1 ) =gcd(r 1, r ) M =gcd(r k-1, r k ) = r k, because r k-1 =q k+1 r k. 1 7

Example Let x=13 and y=108. Find the gcd(x, y). Relatively Prime Integers Definition: (relatively prime integer) Two integers a and b are said to be relatively prime if gcd(a, b)=1. Theorem.1.5 Let a and b be two integers not both zero. Then a and b are relatively prime if and only if 1=ra+tb for some integers r and t. 3 Least Common Multiples (lcm) Definition: (lease common multiple, lcm) A nonzero integer m is said to be a least common mulitple (lcm) of integers a and b, lcm[a,b], 1.if m is a common multiple of a and b; and.if c is a common multiple of a and b, then c is a multiple of m. Theorem.1.7 Let a and b be two integers not both zero. Then gcd(a, b) lcm[a, b]= ab. 4 8

Outline Integers Representation of Integers in Computer Mathematical Induction Prime Numbers Linear Diophantine Equations 5 Two Types of Signals Electrical signals are used inside the computer to process information Two types of signals Analog Continuous wave forms used to represent such things as sound Examples: audio tapes, older television signals, etc. Digital Represent information with a sequence of 0s and 1s Examples: compact discs, newer digital HDTV signals 6 Digital Signals 0s and 1s : 0s represent low voltage, 1s high voltage Digital signals are more reliable carriers of information than analog signals Can be copied from one device to another with exact precision Machine language is a sequence of 0s and 1s The digit 0 or 1 is called a binary digit, or bit A sequence of 0s and 1s is sometimes referred to as binary code 7 9

Number Systems Decimal (Base-10) System The digits that are used to represent numbers in base 10 are 0,1,,3,4,5,6,7,8, and 9. Binary (Base-) System Computer memory stores numbers in machine language, i.e., as a sequence of 0s and 1s Octal (Base-8) System Digits that are used to represent numbers in base 8 are 0,1,,3,4,5,6, and 7 Hexadecimal (Base-16) System Digits and letters that are used to represent numbers in base 16 are 0,1,,3,4,5,6,7,8,9,A,B,C,D,E, and F 8 Positional Number Systems Example: 9 Unique Representation The unique representation of N in the previous slide is called the representation of N in base β (or base β representation of N), and we write the representation as N=(a m a m-1 a m- La 1 a 0 ) β 30 10

Positional Number Systems Example: Decimal system: (0.413) 10 numbers represented real-world number set 31 Conversion between Number Systems (1) Conversion between number systems Example 1: binary to decimal Example : decimal to binary 3 Decimal to Binary Method 1 33 11

Decimal to Binary Method 418 09 104 5 6 13 5 3 1 0 1 0 0 0 1 0 1 0 10 010 0010 00010 100010 0100010 110100010 The whole process is the reverse of the Horner s rule 34 Conversion between Number Systems () Not all decimal fractions are exactly represented in the binary system. Example 1: (decimal to binary) 35 Conversion between Number Systems (3) Example : (binary to decimal) 36 1

Ways to Represent Integers (1) In computer memory, integers are represented as binary numbers in fixed-length bit strings. Suppose integers are represented as fixedlength strings of 8 bits One way to distinguish between negative and positive integers is to reserve the leftmost bit as the sign bit, i.e. the Most Significant Bit (MSB). Leftmost bit (MSB) = 0, number is positive Leftmost bit (MSB) = 1, number is negative The remaining 7 bits represent a nonnegative number 37 Ways to Represent Integers () The drawbacks when using the previous approach Leading to complicated methods of addition and subtraction The representation of 0 is not unique A convenient way is to use two s complement to represent negative numbers 38 Two s Complement Definition: (two s complement) Let n be a fixed positive integer and let x be a positive integer that can be represented as an n-bit binary number. The binary representation of n -x is called the two s complement of x with respect to n. Example: Let n=8 and x=45. Then 8-45=56-45=11. Now 11 10 =11010011 is the binary representation of the two s complement if 45 as an 8-bit string. 39 13

One s Complements Definition: (one s complement) Let s be an n-bit string, where n 1. The one s complement of s is the n-bit binary string obtained from s by changing 1 s to 0 s and 0 s to 1 s. Example: Let n=8 and s=11=01111001. Then the one s complement of s is 10000110. 40 Finding the Two s Complements Steps for finding the n-bit binary representation of the two s complement of a number x: Find the n-bit binary representation of x Find the one s complement of x Add 1 Example: Let n=8 and x=11. 41 Solution to the Example 4 14

Theorem..4 Let x be a positive integer that can be expressed as an n-bit binary number, say (x n-1 x n- Lx 1 x 0 ). Let (y n-1 y n- Ly 1 y 0 ) be such that y i =1-x i for all i=0, 1, L n-1. Then, the binary representation of the two s complement of x is the number whose binary representation is given by (y n-1 y n- Ly 1 y 0 ) +(0 01) where (0 01) is the n-bit representation of 1. 43 Example Let x=5536 10 and n=16. Please determine the 16-bit binary representation of the two s complement of x. 44 Remarks Let n 1 be an integer and x be an integer that can be represented as an n-bit binary string. Then the two s complement of the two s complement of x is x. The n-bit binary representation of the two s complement of 0 10 is 0 10. 45 15

Leading Bit Definition: (leading bit) Let n 1 be an integer and x be a nonnegative integer that can be expressed as an n-bit binary number. The first digit, i.e., first bit, of the n- bit binary string representing x is called the leading bit of x. Example: Let n=8. The leading bit of 00111010 is 0 and the leading bit of 10101100 is 1. 46 Theorem..30 Let n=8, x an integer with 1 x 17, and y an integer with 18 y 55. The following assertions hold 1. x and y can be expressed as 8-bit binary strings.. the leading bits of x and y are 0 and 1 respectively. 3. the leading bits of the two s complements of x and y are 1 and 0 respectively. 47 Theorem..31 Let n 1 be an integer and x be a nonnegative integer that can be expressed as an n-bit binary number. 1. If x= n-1 (resp. x=0), then the leading bit of x and the leading bit of the two s complement of x is 1 (resp. 0).. If 1 x < n-1, the leading bits of x is 0 and the leading bit of the two s complement of x is 1. 3. If n-1 < x n -1, the leading bits of x is 1 and the leading bit of the two s complement of x is 0. 48 16

Represent Integers Using 8-bit binary strings as example If 1 x 17, then the leading bit of x is 0. Consider y such that -17 y -1. Then, y is a negative number and 1 y 17. The leading bit of y is 0 and the leading bit of the two s complement of y is 1. We can make negative numbers represented as the two s complement of their absolute number 8 bits can be used to represents integers in the range -18 to 17. 49 Remarks It can be shown that n bits are sufficient to represent any integer x such that - n-1 x n-1-1 as an n-bit string. 50 Examples Operations Let n=8. x=67 and y=38. Add x and y. x=67 and y=-38. Add x and y. x=-67 and y=38. Add x and y. x=-67 and -y=38. Add x and y. 51 17

Outline Integers Representation of Integers in Computer Mathematical Induction Prime Numbers Linear Diophantine Equations 5 A Way to Prove Consider the following well-known formula n n( n+ 1) P( n) = i= 1+ + L+ n=, for all integers n 1. i= 1 How to prove this formula is correct for all integer n? Proving it pair by pair Using Mathematical Induction 53 First Principle of Mathematical Induction Let P(n) be a sentence containing nonnegative integer n, and let n 0 be a fixed nonnegative integer. 1. Suppose P(n 0 ) is true (i.e., P(n) is true for n= n 0 ).. Whenever k is an integer such that k n 0 and P(k) is true, then P(k+1) is true. Then P(n) is true for all integers n n 0. 54 18

Example Recall our previous example n n( n+ 1) P( n) = i= 1+ + L+ n=, for all integers n 1. i= 1 1. Start by verifying that P(n) is true when n=1. 1(1+ 1) P(1) = 1=. Assume that P(k) is true when k 1. i. e., P( k) k = i= 1 k( k+ 1) i= 1+ + L+ k =, for some integer k 1. 55 Example 3. Need to verify P(k+1) is still true. k 1 ( + 1)( + ).., ( + 1) = + k k i e P k i= 1+ + L+ k+ ( k+ 1) = i= 1 P( k+ 1) = 1+ + L+ k+ ( k+ 1) = P( k) + ( k+ 1) Because P(k) k( k+ 1) = + ( k+ 1) is true. k = ( k+ 1)( + 1) ( k+ 1)( k+ ) = 56 Three Steps Proof of a mathematical statement by the principle of mathematical induction consists of three steps: 1. Basic Step: To show that P(n 0 ) is true. Inductive Hypothesis: Let k be an integer such that k n 0 and P(k) is true 3. Inductive Step: To show that P(k+1) is true. 57 19

Example Please show that 7 n +5 is divisible by 3 for all integers n 0. 58 Remarks The basic step is usually simple but important During the inductive step, one can not use the properties which hold for n k+1 to prove. 59 Example Consider the following statement 5 divides 5n+3 for all positive integers n. Suppose we skip the basic step and directly use an inductive hypothesis to proceed with the inductive step. What will go wrong? 60 0

Second Principle of Mathematical Induction Let P(n) be a sentence containing nonnegative integer n, and let n 0 be a fixed nonnegative integer. 1. Suppose P(n 0 ) is true. If for any integer k n 0, P(n 0 ), P(n 0 +1) P(n 0 +),, P(k) are true imply that P(k+1) is true, then P(n) is true for all integers n n 0. 61 Example Problem: Any postage charges of n cents can be made by using 3- and 5-cent stamps, where n 8. 6 Program Correctness Proving that a program is correct is a major issue in software industry. One way to verify the correctness is to run the program through a set of test cases. Mathematical tools are available to prove the correctness Verify the correctness of each statement in the program Easy for assignment statement and selection statement Using mathematical induction on showing the correctness of loops 63 1

Preconditions and Postconditions User of algorithm need not be concerned with how the algorithm is implemented He or she must know how to use the algorithm and what the algorithm does Precondition: Assertion (set of statements) that remains true before algorithm executes Postcondition: Assertion that is true after algorithm executes 64 Loop Invariant Set of statements that remains true each time the loop body is executed Example: the syntax of a while loop is: while booleanexpression do loopbody The booleanexpression is evaluated. If the booleanexpression evaluates to true,the loopbody executes. After executing the loopbody, the booleanexpression is evaluated again. Then the loopbody continues to execute as long as the booleanexpression evaluates to true. 65 Loop Invariant (cont.) ThebooleanExpression is either true or false. (It is a statement.) Let q denote the booleanexpression We can associate a predicate P(n) with a loop 66

Predicate P(n) 1. P(0) is true before the loop executes. When the loop terminates, q is false and ~q is true. Hence, if the loop executes N times, then P(N) ~q is true after the loop terminates. 3. If P(k) q is true before the (k+1)st iteration of the loop and k<n, then P(k +1) q is true after the (k+1)st iteration and (k+1) n. The predicate P(n) is called the loop invariant for the loop 67 Outline Integers Representation of Integers in Computer Mathematical Induction Prime Numbers Linear Diophantine Equations 68 Prime Numbers Definition: (Prime Numbers) An integer p>1 is called a prime number, or prime, if the only positive divisors of p are 1 and p. Definition: (Composite Numbers) An integer q>1 that is not prime is called composite. 69 3

Trivial Positive Divisors Definition: (Trivial Positive Divisors) For any positive integer n>1, the integers 1 and n are called the trivial positive divisors of n. Remarks: An integer n is prime if and only n has only trivial positive divisors. An integer n is composite if and only if n has a nontrivial positive divisor. 70 Theorem Theorem: An integer p>1 is prime if and only if for all integers a and b, p divides ab implies either p divides a or p divides b. Example: consider 1. 1 divides 10=30 4 but 1 30 and 1 4. Hence, 1 is not prime. Corollary: If a prime number p divides a 1 a a n, n>1, then p divides one of the integers a 1, a,, a n. 71 Theorem: Theorems Every integer n has a prime factor. Theorem: There are infinitely many primes. Theorem: if n is a composite integer, then n has a prime factor not exceeding n 7 4

Determining a Prime Number 1. If n is, then n is prime and return.. If divides n, n is not a prime and return. 3. Find all odd primes p n. If there is no such odd prime, then n is prime and return. 4. Check whether p divides n, where p is a prime obtained in step 3. If p divides n, then n is not prime; otherwise, n is a prime. 73 Example Consider the integer 131. Observe that does not divide 131. We now find all odd primes p such that p 131. These primes are 3, 5, 7, and 11. Now none of 3, 5, 7, and 11 divides 131. Hence, 131 is a prime. 74 Fundamental Theorem of Arithmetic Fundamental Theorem of Arithmetic Every integer n can be expressed uniquely as a product of (one or more) primes, up to the order of the factor. More precisely, any integer n can be expressed as n=p 1 p p r where p 1, p,, p r are primes. Moreover, if n=p 1 p p r and n=q 1 q q s are two factorizations of n as a product of primes, then r=s and the q j can be relabeled so that p i =q j for all i=1,,,r. 75 5

Factoring a Positive Integer The standard factorization of n is r r r n= p k 1 1 p L pk where r i >0, i=1,,,k, each p i is a prime integer, and p i p j for i j. 76 Fermat s Factoring Method Consider to factor a number n such that n=ab for some integers a and b. Fermat s Factoring Method: 1. If n is even, one can express n= r m, where m is odd. If n is odd, we can have two integers x and y such that n=x -y =(x+y)(x-y) and x and y can be determined as a. Find the smallest integer k, such that k n. b. Continuously look the numbers k -n, (k+1) -n until x n to find the one which makes x -n a square. 77 Outline Integers Representation of Integers in Computer Mathematical Induction Prime Numbers Linear Diophantine Equations 78 6

Diophantine Equation Definition: (Diophantine Equation) A Diophantine Equation is an algebraic equation in one or more unknowns with integer coefficients for which integer solutions are sought. Example: 3x+5y=80 Such an equation may have no solution, a finite number of solutions, or an infinite number of solutions The famous equation x n +y n = z n of Fermat s Last Theorem is also a Diophantine equation 79 Linear Diophantine Equations Definition: A linear equation of the form ax+by=c, where a, b, c are integers and x, y are variables such that the solutions are restricted to integers, is called a linear Diophantine equation in two variables. Note: if (x 0, y 0 ) is a pair of integers such that a ax 0 +by 0 =c, then (x 0, y 0 ) is said to be an integral solution of this equation. 80 Theorem 81 7