Number Theory Fall 2023-2024 Lecture Notes (PDF)
Document Details

Uploaded by ArticulateArcticTundra9680
Beirut Arab University
Dr. Lama Affara
Tags
Summary
These lecture notes cover various topics within number theory, including divisibility, modular arithmetic, and congruences. They detail algorithms such as the Euclidean algorithm and delve into examples to demonstrate the calculation and application of these concepts. Mathematical proofs are also included.
Full Transcript
Number Theory Fall 2023-2024 Dr. Lama Affara Last Lecture Number Theory Modular Divisibility Primes Arithmetic Congruence De...
Number Theory Fall 2023-2024 Dr. Lama Affara Last Lecture Number Theory Modular Divisibility Primes Arithmetic Congruence Definition and Modulo Relation properties Properties of Congruence GCD and LCM Modulo Arithmetic Euclidean Modulo ๐ Algorithm The Division Algorithm ๐ รท ๐ = ๐ with remainder ๐ ๐ is an integer ๐ is a positive integer there exists unique integers ๐ and ๐, with 0 โค ๐ < ๐, such that ๐ = ๐๐ + ๐ Quotient ๐ = ๐ ๐ ๐๐ ๐ Remainder ๐ = ๐ ๐๐๐ ๐ 12/4/2023 Discrete Structures II 3 Divisibility b รท ๐ = ๐ with remainder 0 ๐ is an integer where ๐ โ ๐ ๐ is an integer there exists an integer ๐ such that ๐ = ๐๐ โ ๐ divides ๐ denoted as ๐|๐ We write ๐ โค ๐ when a does not divide b 12/4/2023 Discrete Structures II 4 Properties of Divisibility Theorem 1 Let ๐, ๐, and ๐ be integers, where ๐ โ 0 i. If ๐ | ๐ and ๐ | ๐, then ๐ | (๐ + ๐) ii. If ๐ | ๐, then ๐ | ๐๐ for all integers ๐ iii. If ๐ | ๐ and ๐ | ๐, then ๐ | ๐ Congruence Relation Notice (๐๐๐ m) here refers to the notation of the relation ๐ โก ๐ (๐๐๐ ๐) Notice ๐๐๐ here refers to the modulus operator ๐ and ๐ are integers ๐ is congruent to ๐ modulo ๐ ๐ is a positive integer ๐ ๐๐๐ ๐ = ๐ ๐๐๐ ๐ ๐ and ๐ have the same remainder ๐ divides ๐ โ ๐ when divided by ๐ If a is not congruent to b modulo m, we write ๐ โข ๐ (๐๐๐ ๐) Algebraic Manipulation of Congruences Thus, By theorem 4, ๐ + ๐ โก (๐ ๐๐๐ ๐) + ๐ ๐๐๐ ๐ (๐๐๐ ๐) ๐๐ โก (๐ ๐๐๐ ๐)(๐ ๐๐๐ ๐) (๐๐๐ ๐) Thus, (๐ + ๐) ๐๐๐ ๐ = ๐ ๐๐๐ ๐ + ๐ ๐๐๐ ๐ ๐๐๐ ๐ ๐๐ ๐๐๐ ๐ = ๐ ๐๐๐ ๐ ๐ ๐๐๐ ๐ ๐๐๐ ๐ 12/4/2023 Discrete Structures II 7 Arithmetic Modulo m Let Zm = {0, 1,... , m โ 1} Addition modulo ๐: ๐ +๐ ๐ = (๐ + ๐) ๐๐๐ ๐ Multiplication modulo ๐: ๐.๐ ๐ = (๐๐) ๐๐๐ ๐ Finding GCD Using Prime Factorizations Suppose the prime factorizations of a and b are: where each exponent is a nonnegative integer, and where all primes occurring in either prime factorization are included in both. Then: Greatest Common Divisor The integers ๐1 , ๐2 , โฆ , ๐๐ are pairwise relatively prime if gcd(๐๐ , ๐๐ ) = 1 whenever 1 โค ๐ < ๐ โค ๐. 77 7 11 77 Finding LCM Using Prime Factorizations Suppose the prime factorizations of a and b are: where each exponent is a nonnegative integer, and where all primes occurring in either prime factorization are included in both. Then: Euclidean Algorithm The Euclidian algorithm is an efficient method for computing the greatest common divisor of two integers. Let r = gcd(a,b) so, r|a and r|b Let c = a mod b, so r|c If a and b have a common divisor, then the remainder of their division have the same divisor Thus gcd(a,b) = gcd(b,c) = gcd(a,c) Todayโs Lecture Number Theory Solving Primes congruences gcd as linear Linear combinations Congruences Extended Chinese Euclidean Remainder Algorithm Theorem Fermatโs Little Theorem GCDs as Linear Combinations Bezoutโs Theorem If a and b are positive integers, then there exist integers s and t such that gcd(a,b) = sa + tb. This is a linear combination with integer coefficients of a and b. s and t are called Bรฉzout coefficients of a and b. The equation gcd(a,b) = sa + tb is called Bรฉzoutโs identity. Letโs Solve Write the gcd of ๐ = 6 and ๐ = 14 using linear combination of ๐ and ๐ i.e. What are integers ๐ and ๐ก such that gcd(6,14) = 6(๐ ) + 14(๐ก)? gcd(6,14) = 2 = 6(โ2) + 14(1) So ๐ = โ2 and ๐ก = 1 12/4/2023 Discrete Structures II 15 GCDs as Linear Combinations How to compute The Bรฉzout coefficients? 1. Use the Euclidian algorithm to find the gcd 2. work backwards (by division and substitution) to express the gcd as a linear combination of the original two integers. 12/4/2023 Discrete Structures II 16 Letโs Solve Write the gcd of ๐ = 252 and ๐ = 198 using linear combination of ๐ and ๐ 1. Euclidean Algorithm 2. Working Backward 252 = 198 (1) + 54 18 = 54 (1) - 36 198 = 54 (3) + 36 = 54(1) - (198 โ 54(3)) = 198(-1) + 54(4) 54 = 36 (1) + 18 = 198(-1) + 4(252โ 198) = 252(4) + 198(-5) 36 = 18(2) + 0 So gcd(252,198)=18 So gcd(252,198)=252(4) + 198(-5) โ Extended Euclidean Algorithm 12/4/2023 Discrete Structures II 17 Dividing Congruences by an Integer Dividing both sides of a valid congruence by an integer does not always produce a valid congruence. But dividing by an integer relatively prime to the modulus does produce a valid congruence: Theorem Let ๐ be a positive integer and let ๐, ๐, and ๐ be integers. If ๐๐ โก ๐๐ (๐๐๐ ๐) and gcd(๐, ๐) = 1, then ๐ โก ๐ (๐๐๐ ๐). Todayโs Lecture Number Theory Solving Primes congruences gcd as linear Linear combinations Congruences Extended Chinese Euclidean Remainder Algorith Theorem Fermatโs Little Theorem Linear Congruence Just as solving linear equations plays an important role in calculus and linear algebra, linear congruence is an essential task in number theory ๐๐ฅ โก ๐ ๐๐๐ ๐ ๐ is a positive integer ๐, ๐ are integers ๐ฅ is a variable Solving Linear Congruence Solving linear congruence โ Finding all ๐ฅ that satisfy below equation ๐๐ฅ โก ๐ ๐๐๐ ๐ Can we divide by ๐ to find ๐ฅ? No! Congruence is not close under division. We can multiply by a number that cancels out ๐ (if exists) โ inverse modulo ฤ: Integer ฤ such that ฤ๐ โก 1( ๐๐๐ ๐) Inverse Modulo Theorem If ๐ and ๐ are relatively prime integers, then a unique inverse of ๐ modulo ๐ exists. Proof: ๐ and ๐ are relatively prime gcd(๐, ๐) = 1 ๐ ๐ + ๐ก๐ = 1 ๐ ๐ + ๐ก๐ โก 1 (๐๐๐ ๐) But, ๐ก๐ โก 0 (๐๐๐ ๐) Then ๐ ๐ โก 1 (๐๐๐ ๐) So ๐ is an inverse of ๐ modulo m 12/4/2023 Discrete Structures II 23 Letโs Solve! Find the inverse of 3 modulo 7 3 5 โก 1 (๐๐๐ 7) So, 5 is the inverse of 3 modulo 7 Note that every integer congruent to 5 modulo 7 is also an inverse of 3, such as โ 2,โ9, 12, and so on. โ look for a multiple of ๐ that exceeds a multiple of ๐ by 1 12/4/2023 Discrete Structures II 24 Letโs Solve! Find the inverse of 8 modulo 15 8 2 โก 1 (๐๐๐ 15) So, 2 is the inverse of 8 modulo 15 Note that every integer congruent to 2 modulo 15 is also an inverse of 8, such as -28,-13,17โฆ 12/4/2023 Discrete Structures II 25 Letโs Solve Find the inverse of 101 modulo 4620 101 โก 1 (๐๐๐ 4620) Not straightforward!! 12/4/2023 Discrete Structures II 26 Finding Inverses The Euclidean algorithm and Bรฉzout coefficients gives us a systematic approaches to finding inverses. Using the Euclidian algorithm: 7 = 2โ3 + 1. 1 as linear combination: 3(โ2) + 7(1) = 1, โ โ2 and 1 are Bรฉzout coefficients of 3 and 7. So, โ2 is an inverse of 3 modulo 7. Letโs Solve Find an inverse of 101 modulo 4620. 1. Euclidean Algorithm 2. Working Backward 4620 = 101 (45) + 75 1 = 3 - 2(1) 101 = 75 (1) + 26 = 3- (23 โ 3(7))=-23+8(3) 75 = 26 (2) + 23 = -23 + 8(26-23)=8(26)-9(23) 26 = 23(1) + 3 = 8(26)-9(75-26(2))=-9(75)+26(26) 23 = 3(7) + 2 = -9(75)+26(101-75)=26(101)-35(75) 3 = 2(1) + 1 = 26(101)-35(4620-101(45))=-35(4620)+1601(101) So gcd(4620,101)=1 So, 1601 is the inverse of 101 modulo 4620 12/4/2023 Discrete Structures II 28 Letโs Solve Find the inverse of 5 modulo 15 5 โก 1 (๐๐๐ 15) 5 does not have any inverse modulo 15! 12/4/2023 Discrete Structures II 29 Using Inverses to Solve Congruences Solving linear congruence โ Finding all ๐ฅ that satisfy below equation ๐๐ฅ โก ๐ ๐๐๐ ๐ โ inverse modulo ฤ: Integer ฤ such that ฤ๐ โก 1( ๐๐๐ ๐) solve the congruence ๐๐ โก ๐( ๐๐๐ ๐) by multiplying both sides by ฤ. Letโs Solve! What are the solutions of the congruence 3๐ฅ โก 4( ๐๐๐ 7) We found that โ2 is an inverse of 3 modulo 7. We multiply both sides of the congruence by โ2 giving โ2 โ 3๐ฅ โก โ2 โ 4(๐๐๐ 7) So, if x is a solution, then ๐ฅ โก โ8 (๐๐๐ 7) But, 6 โก -8 (mod 7). So x = 6 Verify: 3x โก 3 โ 6 = 18 โก 4( mod 7) which shows that all such x satisfy the congruence. โ The solutions are the integers x such that x โก 6 (mod 7), namely, 6,13,20 โฆ and โ1, โ 8, โ 15,โฆ 12/4/2023 Discrete Structures II 31 System of Linear Congruences basis for a method that can be used to perform arithmetic with large integers can be found as word puzzles in the writings of ancient Chinese and Hindu mathematicians In the first century, the Chinese mathematician Sun-Tsu asked: There are certain things whose number is unknown. When divided by 3, the remainder is 2; when divided by 5, the remainder is 3; and when divided by 7, the remainder is 2. What will be the number of things? 12/4/2023 Discrete Structures II 32 The Chinese Remainder Theorem Let ๐1 , ๐2 , โฆ , ๐๐ be pairwise relatively prime positive integers greater than one and ๐1 , ๐2 , โฆ , ๐๐ arbitrary integers. Then the system ๐ฅ โก ๐1 ( ๐๐๐ ๐1 ) ๐ฅ โก ๐2 ( ๐๐๐ ๐2 ) โ โ โ ๐ฅ โก ๐๐ ( ๐๐๐ ๐๐ ) has a unique solution modulo ๐ = ๐1 ๐2 โ โ โ ๐๐. The Chinese Remainder Theorem ๐ฅ โก ๐1 ( ๐๐๐ ๐1 ) ๐ฅ โก ๐2 ( ๐๐๐ ๐2 ) โ โ ๐ฅ โก ๐๐ ( ๐๐๐ ๐๐ ) 1. ๐ = ๐1 ๐2 โ โ โ ๐๐ 2. Let ๐๐ = ๐/๐๐ 3. Find ๐ฆ๐ , an inverse of ๐๐ modulo ๐๐ , i.e. ๐๐ ๐ฆ๐ โก 1 ( ๐๐๐ ๐๐ ) 4. The sum ๐ฅ = ๐1 ๐1 ๐ฆ1 + ๐2 ๐2 ๐ฆ2 + โ โ โ + ๐๐ ๐๐ ๐ฆ๐ Is the simultaneous solution for the system of linear congruences The Chinese Remainder Theorem 1. ๐ = 3 โ 5 โ 7 = 105 2. ๐1 = ๐/3 = 35, ๐2 = ๐/5 = 21, ๐3 = ๐/7 = 15. 3. Find ๐ฆ๐ , inverse of ๐๐ modulo ๐๐ 2 is an inverse of ๐1 modulo 3 since 35 (2) โก 1 (mod 3) 1 is an inverse of ๐2 modulo 5 since 21 (1) โก 1 (mod 5) 1 is an inverse of ๐3 modulo 7 since 15(1) โก 1 (mod 7) 4. Hence, ๐ฅ = ๐1 ๐1 ๐ฆ1 + ๐2 ๐2 ๐ฆ2 + ๐3๐3 ๐ฆ3 = 2 โ 35 โ 2 + 3 โ 21 โ 1 + 2 โ 15 โ 1 = 233 โก 23 (๐๐๐ 105) Then 23 is the smallest positive integer that is a simultaneous solution Fermatโs Little Theorem If ๐ is prime and ๐ is an integer not divisible by ๐, then ๐ ๐โ1 โก 1 (๐๐๐ ๐) Furthermore, for every integer ๐ we have ๐๐ โก ๐ (๐๐๐ ๐) โ Fermatโs little theorem is useful in computing the remainders modulo p of large powers of integers. Letโs Solve! Find 7222 mod 11. By Fermatโs little theorem, we know that 710 โก 1 (mod 11), so (710 )k โก 1 (mod 11), for every positive integer k. Therefore, โ 10 + 2 7222 = 7 22 = 710 2272 โก 1 22 โ 49 โก 5 ๐๐๐ 11 Hence, 7222 mod 11 = 5. Todayโs Lecture Number Theory Solving Primes Cryptography congruences gcd as linear Linear Caesar Cipher combinations Congruences Extended Chinese Euclidean Remainder Shift Ciphers Algorith Theorem Fermatโs Little Affine Ciphers Theorem RSA Cryptosystem Cryptography transforming information so that it cannot be easily recovered without special knowledge Number theory is the basis of many classical ciphers, first used thousands of years ago used extensively until the 20th century ciphers encrypt messages by changing each letter to a different letter, or each block of letters to a different block of letters 12/4/2023 Discrete Structures II 40 Caesar Cipher Julius Caesar created secret messages shifting each letter three letters forward in the alphabet (sending the last three letters to the first three letters.) For example, the letter B is replaced by E and the letter X is replaced by A. Caesar Cipher Replace each letter by an integer from ๐26 that is 0 to 25 The encryption function is ๐(๐) = (๐ + 3) ๐๐๐ 26 โ replace each integer ๐ โ {0,1,2,โฆ,25} by ๐(๐) โ {0,1,2,โฆ,25} Letโs Solve Encrypt the message โMEET YOU IN THE PARKโ using the Caesar cipher. Replace each letter by its position - 1 12 4 4 19 24 14 20 8 13 19 7 4 15 0 17 10 Now replace each of these numbers p by f(p) = (p + 3) mod 26 15 7 7 22 1 17 23 11 16 22 10 7 18 3 20 13 Translate the numbers back to letters โPHHW BRX LQ WKH SDUN.โ Caesar Cipher The encryption function is ๐(๐) = (๐ + 3) ๐๐๐ 26 What is the decryption function? ๐ โ1 (๐) = (๐ โ 3) ๐๐๐ 26 Each letter in the coded message is shifted back three letters in the alphabet, with the first three letters sent to the last three letters 12/4/2023 Discrete Structures II 44 Shift Cipher The Caesar cipher is one of a family of ciphers called shift ciphers. Letters can be shifted by an integer ๐, such as 3 The encryption function is ๐(๐) = (๐ + ๐) ๐๐๐ 26 and the decryption function is ๐ โ1 (๐) = (๐ โ ๐) ๐๐๐ 26 โ The integer ๐ is called a key. Letโs Solve Encrypt the message โSTOP GLOBAL WARMINGโ using the shift cipher with k = 11. Replace each letter with the corresponding element of ๐26 18 19 14 15 6 11 14 1 0 11 22 0 17 12 8 13 6 Apply the shift ๐(๐) = (๐ + 11) ๐๐๐ 26, yielding 3 4 25 0 17 22 25 12 11 22 7 11 2 23 19 24 17 Translate the numbers back to letters โDEZA RWZMLW HLCXTYR.โ Letโs Solve Decrypt the message โLEWLYPLUJL PZ H NYLHA ALHJOLYโ that was encrypted using the shift cipher with k = 7. Replace each letter with the corresponding element of Z26. 11 4 22 11 24 15 11 20 9 11 15 25 7 13 24 11 7 0 0 11 7 9 14 11 24 Shift each of the numbers by โ๐ = โ7 ๐๐๐๐ข๐๐ 26, yielding 4 23 15 4 17 8 4 13 2 4 8 18 0 6 17 4 0 19 19 4 0 2 7 4 17 Translate the numbers back to letters โEXPERIENCE IS A GREAT TEACHER.โ Affine Ciphers Shift ciphers are a special case of affine ciphers which use functions of the form ๐(๐) = (๐๐ + ๐) ๐๐๐ 26 where ๐ and ๐ are integers, chosen so that ๐ is a bijection The function is a bijection if and only if gcd(๐, 26) = 1. Letโs Solve! Example: What letter replaces the letter K when the function ๐(๐) = (7๐ + 3) ๐๐๐ 26 is used for encryption. 10 represents K ๐(10) = (7 โ 10 + 3) ๐๐๐ 26 = 21 21 corresponds to V So K is replaced by V Letโs Solve! To decrypt a message encrypted by an affine cipher, the congruence c โก ap + b (mod 26) needs to be solved for p. Subtract b from both sides to obtain cโ b โก ap (mod 26). Multiply both sides by the inverse of a modulo 26, which exists since gcd(a,26) = 1. ฤ(cโ b) โก ฤap (mod 26), which simplifies to ฤ(cโ b) โก p (mod 26). p โก ฤ(cโ b) (mod 26) is used to determine p in Z26. Private Key Cryptography All classical ciphers, including shift and affine ciphers, are private key cryptosystems. Knowing the encryption key allows one to quickly determine the decryption key. All parties who wish to communicate using a private key cryptosystem must share the key and keep it a secret. Public Key Cryptography In public key cryptosystems, first invented in the 1970s, knowing how to encrypt a message does not help one to decrypt the message. Therefore, everyone can have a publicly known encryption key. The only key that needs to be kept secret is the decryption key. The RSA Cryptosystem A public key cryptosystem, now known as the RSA system was introduced in 1976 by three researchers at MIT. Ronald Rivest Adi Shamir Leonard Adelman (Born 1948) (Born 1952) (Born 1945) The public encryption key is ๐, ๐ ๐ = ๐๐ (the modulus) is the product of two large (200 digits) primes ๐ and ๐, exponent ๐ relatively prime to (๐ โ 1)(๐ โ 1) RSA Encryption To encrypt a message using RSA using a key (๐, ๐): Translate the plaintext message M into sequences of two digit integers representing the letters. Use 00 for A, 01 for B, etc. Concatenate the two digit integers into strings of digits. Divide this string into equally sized blocks of 2N digits where 2N is the largest even number 2525โฆ25 with 2N digits that does not exceed n. The plaintext message M is now a sequence of integers ๐1 , ๐2 , โฆ , ๐๐. Each block (an integer) is encrypted using the function ๐ถ = ๐๐ ๐๐๐ ๐. RSA Encryption Encrypt the message STOP using the RSA cryptosystem with key(2537,13). Note that 2537 = 43โ 59, p = 43 and q = 59 are primes and gcd(13, 42โ 58) = 1. Translate the letters in STOP to their numerical equivalents 18 19 14 15. Divide into blocks of four digits (because 2525 < 2537 < 252525) to obtain 1819 1415. Encrypt each block using the mapping ๐ถ = ๐13 ๐๐๐ 2537. Since 181913 ๐๐๐ 2537 = 2081 and 141513 ๐๐๐ 2537 = 2182, the encrypted message is 2081 2182. RSA Decryption To decrypt a RSA ciphertext message, the decryption key d, an inverse of e modulo (pโ1)(q โ1) is needed. The inverse exists since gcd(e,(pโ1)(q โ1)) = gcd(13, 42โ 58) = 1. With the decryption key d, we can decrypt each block with the computation ๐ = ๐ถ ๐ ๐๐๐ ๐ โ ๐. RSA works as a public key system since the only known method of finding d is based on a factorization of n into primes. There is currently no known feasible method for factoring large numbers into primes. RSA Decryption Example: The message 0981 0461 is received. What is the decrypted message if it was encrypted using the RSA cipher from the previous example. The message was encrypted with n = 43โ 59 and exponent 13. An inverse of 13 modulo 42โ 58 = 2436 is d = 937. To decrypt a block C, ๐ = ๐ถ 937 ๐๐๐ 2537. Since 0981937 ๐๐๐ 2537 = 0704 and 0461937 ๐๐๐ 2537 = 1115, the decrypted message is 0704 1115. Translating back to English letters, the message is HELP.