Discrete Mathematics Section 3.7 Applications of Number Theory 大葉大學 資訊工程系 黃鈴玲.

Slides:



Advertisements
Similar presentations
Chapter 3 Determinants and Eigenvectors 大葉大學 資訊工程系 黃鈴玲 Linear Algebra.
Advertisements

Divide-and-Conquer. 什麼是 divide-and-conquer ? Divide 就是把問題分割 Conquer 則是把答案結合起來.
布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
密碼學與網路安全 第4章 有限體.
1.1 線性方程式系統簡介 1.2 高斯消去法與高斯-喬登消去法 1.3 線性方程式系統的應用(-Skip-)
Review of Chapter 3 - 已學過的 rules( 回顧 )- 朝陽科技大學 資訊管理系 李麗華 教授.
代數概論 劉兆樑.
: OPENING DOORS ? 題組: Problem Set Archive with Online Judge 題號: 10606: OPENING DOORS 解題者:侯沛彣 解題日期: 2006 年 6 月 11 日 題意: - 某間學校有 N 個學生,每個學生都有自己的衣物櫃.
Chapter 2 聯立線性方程式與矩陣 緒言 線性方程式組 (systems of linear equations) 出現 在多數線性模式 (linear model) 中。根據以往解 題的經驗,讀者們也許已發現方程式的解僅與 該方程式的係數有關,求解的過程也僅與係數 的運算有關,只要係數間的相關位置不改變,
5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程 5.4 數學模型與最小平方分析
8.1 何謂高度平衡二元搜尋樹 8.2 高度平衡二元搜尋樹的加入 8.3 高度平衡二元搜尋樹的刪除
: The Playboy Chimp ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10611: The Playboy Chimp 解題者:蔡昇宇 解題日期: 2010 年 2 月 28 日 題意:給一已排序的數列 S( 升冪.
基礎物理總論 基礎物理總論 熱力學與統計力學(三) Statistical Mechanics 東海大學物理系 施奇廷.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
3.1 矩陣的行列式 3.2 使用基本運算求行列式 3.3 行列式的性質 3.4 特徵值介紹 3.5 行列式的應用
結構學(一) 第七次作業 97/05/15.
Fugacity Coefficient and Fugacity
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
: Beautiful Numbers ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11472: Beautiful Numbers 解題者:邱經達 解題日期: 2011 年 5 月 5 日 題意: 若一個 N 進位的數用到該.
: THE SAMS' CONTEST ☆☆★★★ 題組: Problem Set Archive with Online Judge 題號: 10520: THE SAMS' CONTEST 解題者:陳相廷,林祺光 解題日期: 2006 年 5 月 22 日 題意:依以下式子,給定 n.
Theory of Computation Transparency No. 1-1 Chapter 2 Introduction to Number Theory and Its applications Cheng-Chia Chen October 2002.
: GCD - Extreme II ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11426: GCD - Extreme II 解題者:蔡宗翰 解題日期: 2008 年 9 月 19 日 題意: 最多 20,000 組測資,題目會給一個數字.
-Antidifferentiation- Chapter 6 朝陽科技大學 資訊管理系 李麗華 教授.
2015/6/ : Simple division ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10407: Simple division 解題者:侯沛彣、柯名澤 解題日期: 2006 年 5 月 16 日 題意: 給一個不為零的整數數列,請找出除以每個數字後能.
Chapter 10 m-way 搜尋樹與B-Tree
演算法課程 (Algorithms) 國立聯合大學 資訊管理學系 陳士杰老師 Course 7 貪婪法則 Greedy Approach.
第五章 內積空間 5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程
第4章 有限體.
: Help My Brother ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11033: Help My Brother 解題者: 呂明璁 解題日期: 2007 年 5 月 14 日.
2005/7 Linear system-1 The Linear Equation System and Eliminations.
連續隨機變數 連續變數:時間、分數、重量、……
Factoring Algorithms Ref: D. Stinson, Cryptography - Theory and Practice, 2001.
: Searching for Nessy ★☆☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 11044: Searching for Nessy 解題者:王嘉偉 解題日期: 2007 年 5 月 22 日 題意: 給定 case 數量.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2008.
11 Ch05 遞迴 淡江大學 周清江 1. 2  遞迴函數乃是一個自己反覆呼叫自己的函數  一個典型的遞迴演算法 n! = n * (n-1)! = n * (n-1) * (n-2)! = n * (n-1) * (n-2) * (n-3)! = … = n * (n-1) * (n-2)
:Count the Trees ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10007:Count the Trees 解題者:楊家豪 解題日期: 2006 年 3 月 題意: 給 n 個點, 每一個點有自己的 Label,
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
:Problem E.Stone Game ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10165: Problem E.Stone Game 解題者:李濟宇 解題日期: 2006 年 3 月 26 日 題意: Jack 與 Jim.
1 Knapsack Cryptosystems 2 ◎ Merkle-Hellman Knapsack Cryptosystem 觀察: (1) 0/1 knapsack problem (i.e. sum of subset) 例:已知 C = 14, A = (1, 10, 5, 22, 3)
結構學 ( 一 ) 第八次作業 97/05/22. 題目一 題目一 (a) 先決定放鬆哪個束制,成為靜定結構 以支承 C 之水平反力為贅力,則 C 點滾支 承變成自由端,即形成靜定基元結構 C 點滿足變位諧和  Δ CH =0.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2009.
: How many 0's? ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11038: How many 0’s? 解題者:楊鵬宇 解題日期: 2007 年 5 月 15 日 題意:寫下題目給的 m 與 n(m
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
Discrete Mathematics Chapter 4 Induction and Recursion 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 3 The Fundamentals : Algorithms, the Integers, and Matrices 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Chapter 5 Laplace Transforms
Discrete Mathematics Chapter 1 The Foundations : Logic and Proofs 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 3 Mathematical Reasoning, Induction, and Recursion 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
1 Consider a system of linear equations.  The variables, or unknowns, are referred to as x 1, x 2, …, x n while the a ij ’s and b j ’s are constants.
Graph Theory Chapter 7 Eulerian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 7 Advanced Counting Techniques 大葉大學 資訊工程系 黃鈴玲.
CompSci 102 Discrete Math for Computer Science
Chapter 4. Finite Fields 書名: Cryptography and Network Security Principles and Practices, Fourth Edition 作者: By William Stallings 報告者:陳盈如 2008/04/03.
Discrete Mathematics Chapter 2 Basic Structures : Sets, Functions, Sequences, and Sums 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Chinese Remainder Theorem Dec 29 Picture from ………………………
Chapter 4 With Question/Answer Animations. Section 4.1.
Discrete Mathematics Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder.
Discrete Mathematics Chapter 5 Counting 大葉大學 資訊工程系 黃鈴玲.
Discrete Mathematics Chapter 6 Advanced Counting Techniques.
Chinese Remainder Theorem Ying Ding Junru Chen. Chinese Remainder Theorem Sun Zi suanjing ( 孫子算經 The Mathematical Classic by Sun Zi) Shushu Jiuzhang (
大葉大學 資訊工程系 黃鈴玲  G. Agnarsson and R. Greenlaw, Graph Theory: Modeling, Applications, and Algorithms, Pearson,  G. Chartrand and O. R. Oellermann,
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
BASIC Programming Language. Overview Install Just BASIC Run BASIC Programs Syntax of BASIC –Data, Variables, and Calculations –Input/Output –Decisions.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Chapter Applications of Number Theory Some Useful Results
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Presentation transcript:

Discrete Mathematics Section 3.7 Applications of Number Theory 大葉大學 資訊工程系 黃鈴玲

Ch Integers and Algorithms ※ The Euclidean Algorithm ( 輾轉相除法求 gcd ) Example : Find gcd(91,287) Sol: 287 = 91  = 14  = 7  2 ∴ gcd(91,287) = 7 Lemma 1 Let a = bq + r, where a, b, q, and r  Z. Then gcd(a, b) = gcd (b, r). if x |91 & x |287  x |14 ∴ gcd (91,287) = gcd(91,14) gcd (91,14) = gcd (14,7) gcd (14,7) = 7

Ch Applications of Number Theory Theorem 1. If a and b are positive integers, then there exist integers s and t such that gcd(a,b) = sa+tb. gcd(a,b) can be expressed as a linear combination with integer coefficients of a and b. ※將 gcd(a,b) 寫成 a 跟 b 的線性組合: The extended Euclidean Algorithm

Ch3-4 Example 1 Express gcd(252, 198) =18 as a linear combination of 252 and 198. Sol: 252 = 1  = 3  = 1  = 2  18 ∴ gcd(252, 198) = = 54 – 1  =198 – 3  =252 – 1  = 54 – 1  36  = 54 – 1  (198 – 3  54 ) = 4  54 – 1  198= 4  (252 – 1  198) – 1  198 = 4  252 – 5  198 Exercise : 1(g)

Ch3-5 Lemma 1. If a, b and c are positive integers 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 is an integer, then p | a i for some i. Example 2 14  8 (mod 6), 但  的左右兩邊同除以 2 後不成立 because 14/2=7, 8/2=4, but 7  4(mod 6). Q: 何時可以讓  的左右同除以一數後還成立呢? 另, 14  8 (mod 3), 同除以 2 後, 7  4 (mod 3) 成立

Ch3-6 Theorem 2. Let m be a positive integer and let a, b, and c be integers. If ac  bc (mod m) and gcd(c, m) = 1, then a  b (mod m). ※ Linear Congruences A congruence ( 同餘式 ) of the form ax  b (mod m), where m is a positive integer, a and b are integers, and x is a variable, is called a linear congruence. How can we solve the linear congruence ax  b (mod m) ? Def: If ax  1 (mod m), and let a be an answer of x, a is called an inverse ( 反元素 ) of a modulo m

Ch3-7 Theorem 3. If a and m are relatively prime integers and m>1, then an inverse of a modulo m exists. Furthermore, this inverse is unique modulo m. Proof. (existence) (unique 的部分是 exercise) By Thm 1, because gcd(a, m) = 1, there exist integers s and t such that sa + tm =1.  sa + tm  1 (mod m). Because tm  0 (mod m), sa  1 (mod m),  s is an inverse of a modulo m.

Ch3-8 Example 3 Find an inverse of 3 modulo 7. Sol. Because gcd(3, 7) = 1, find s, t such that 3s + 7t =1.   2 is an inverse of 3 modulo 7.  7 = 2   1 =  2   7 (Note that every integer congruent to  2 modulo 7 is also an inverse of 3, such as 5,  9, 12, and so on. ) Exercise : 5

Ch3-9 Example 4 What are the solutions of the linear congruence 3x  4 (mod 7) ? Sol. By Example 3   2 is an inverse of 3 modulo 7  If x is a solution, then x   8  6 (mod 7).   2  3x   2  4 (mod 7) Because  6  1 (mod 7), and  8  6 (mod 7), We need to determine whether every x with x  6 (mod 7) is a solution. Assume x  6 (mod 7), then 3x   6 = 18  4 (mod 7). Therefore every such x is a solution: x = 6, 13, 20, …, and  1,  8,  15, …. Exercise : 11 將 3x  4 (mod 7) 左右同乘  2   6x   (mod 7)  3  (  2)  1 (mod 7)

Ch3-10 Example 5. 孫子算經 : 「某物不知其數,三三數之餘二,五五數之 餘三,七七數之餘二,問物幾何 ? 」 ( 又稱為「韓信點兵」問題 ) i.e. x ≡ 2 (mod 3) x ≡ 3 (mod 5) x = ? x ≡ 2 (mod 7) Theorem 4. (The Chinese Remainder Theorem) Let m 1,m 2,…,m n be pairwise relatively prime positive integers and a 1, a 2, …, a n arbitrary integers. Then the system x ≡ a 1 (mod m 1 ) x ≡ a 2 (mod m 2 ) : x ≡ a n (mod m n ) has a unique solution modulo m = m 1 m 2 …m n. ( 即有一解 x, where 0  x < m, 且所有其他解 mod m 都等於 x ) The Chinese Remainder Theorem ( 中國餘數定理 )

Ch3-11 Proof of Thm 4: Let M k = m / m k  1  k  n ∵ m 1, m 2,…, m n are pairwise relatively prime ∴ gcd ( M k, m k ) = 1  integer y k s.t. M k y k ≡ 1 (mod m k ) ( by Thm. 3)  a k M k y k ≡ a k (mod m k ),  1  k  n Let x = a 1 M 1 y 1 +a 2 M 2 y 2 +…+a n M n y n ∵ m i | M j,  i ≠ j ∴ x ≡ a k M k y k ≡ a k (mod m k )  1  k  n x is a solution. All other solution y satisfies y ≡ x (mod m k ). x ≡ a 1 (mod m 1 ) x ≡ a 2 (mod m 2 ) : x ≡ a n (mod m n ) m = m 1 m 2 …m n

Ch3-12 Example 6. (Solve the system in Example 5) Let m = m 1 m 2 m 3 = 3  5  7 = 105 M 1 = m / m 1 = 105 / 3 = 35 ( 也就是 m 2 m 3 ) M 2 = m / m 2 = 105 / 5 = 21 M 3 = m / m 3 = 105 / 7 = ≡ 2 (mod 3)  35  2 ≡ 2  2 ≡ 1 (mod 3) 21 ≡ 1 (mod 5)  21  1 ≡ 1 (mod 5) 15 ≡ 1 (mod 7)  15  1 ≡ 1 (mod 7) ∴ x = a 1 M 1 y 1 + a 2 M 2 y 2 + a 3 M 3 y 3 = 2  35   21   15  1 = 233 ≡ 23 (mod 105) ∴ 最小的解為 23 ,其餘解都等於 t for some t  Z + M1M1 y1y1 M2M2 y2y2 M3M3 y3y3 x ≡ 2 (mod 3) x ≡ 3 (mod 5) x = ? x ≡ 2 (mod 7) 找 y 1 使得 M 1 y 1 = 1 (mod 3)

Ch3-13 Exercise 18. Find all solutions to the system of congruences x ≡ 2 (mod 3) x ≡ 1 (mod 4) x ≡ 3 (mod 5) Sol : a 1 =2, a 2 =1, a 3 =3, m 1 =3, m 2 =4, m 3 =5 m=3  4  5=60 M 1 =20, M 2 =15, M 3 =12 20≡2 (mod 3)  20  2≡1 (mod 3) 15≡3 (mod 4)  15  3≡1 (mod 4) 12≡2 (mod 5)  12  3≡1 (mod 5) ∴ x = 2  20  2+1  15  3+3  12  3 = =233≡53 (mod 60)

Ch3-14 ※ 補充: (when m i is not prime) Ex 20. Find all solutions, if any, to the system of congruences. x≡5 (mod 6) x≡3 (mod 10) x≡8 (mod 15) Sol. Rewrite the system as the following: x ≡ 1 (mod 2)x≡2 (mod 3) i.e., x≡1 (mod 2) x≡2 (mod 3) … x≡3 (mod 5) Exercise : 做完此題 x ≡ 1 (mod 2) x ≡ 2 (mod 3) x≡3 (mod 5)

Ch3-15 ※ 補充: (when m i is a prime power) Ex 21. Find all solutions, if any, to the system of congruences. x≡7 (mod 9) x≡4 (mod 12) x≡16 (mod 21) Sol. Rewrite the system as the following: x≡7 (mod 9) ( 不能拆! ) x≡0 (mod 4) i.e., x≡7 (mod 9) ( 此式取代 x≡1 (mod 3) 式子 ) x≡0 (mod 4) … x≡2 (mod 7) x≡1 (mod 3) x≡2 (mod 7)

Ch3-16 Computer Arithmetic with Large Integers Suppose that m 1,m 2,…,m n be pairwise relatively prime integers greater than or equal to 2 and let m = m 1 m 2 … m n. By the Chinese Remainder Theorem, we can show that an integer a with 0  a < m can be uniquely represented by the n -tuple ( a mod m 1, a mod m 2, …, a mod m n ). Example 7 What are the pairs used to represent the nonnegative integers x<12 when they are represented by the order pair ( x mod 3, x mod 4 )? Sol 0=(0, 0), 1=(1, 1), 2=(2, 2), 3=(0, 3), 4=(1, 0), 5=(2, 1), 6=(0, 2), 7=(1, 3), 8=(2, 0), 9=(0, 1), 10=(1, 2), 11=(2, 3). Exercise : 37

Ch3-17 To perform arithmetic with larger integers, we select moduli (modulus 的複數 ) m 1,m 2,…,m n, where each m i is an integer greater than 2, gcd(m i, m j )=1 whenever i  j, and m=m 1 m 2 …m n is greater than the result of the arithmetic operations we want to carry out.

Ch3-18 Example 8 Suppose that performing arithmetic with integers less than 100 on a certain processor is much quicker than doing arithmetic with larger integers. We can restrict almost all our computations to integers less than 100 if we represent integers using their remainders modulo pairwise relatively prime integers less than 100. For example, 99, 98, 97, and 95 are pairwise relatively prime. every nonnegative integer less than 99  98  97  95 = can be represented uniquely by its remainders when divided by these four moduli. E.g., = (33, 8, 9, 89), and = (32, 92, 42, 16) = (33, 8, 9, 89) + (32, 92, 42, 16) = (65 mod 99, 100 mod 98, 51 mod 97, 105 mod 95) = (65, 2, 51, 10) Use Chinese Remainder Thm to find this sum 

Ch3-19 Theorem 5 (Fermat’s Little Theorem) If p is prime and a is an integer not divisible by p, then a p  1  1 (mod p) Furthermore, for every integer a we have a p  a (mod p) Exercise 27(a) Show that  1 (mod 11) by Fermat’s Little Theorem and noting that = (2 10 ) 34. Proof 11 is prime and 2 is an integer not divisible by 11.  2 10  1 (mod 11)   1 (mod 11) by Thm 5 of Sec. 3.4 (a  b (mod m) and c  d (mod m)  ac  bd (mod m) ) Exercise : Compute (mod 7)