Numbers (8A) Young Won Lim 6/21/17

Similar documents
Numbers (8A) Young Won Lim 5/24/17

Numbers (8A) Young Won Lim 5/22/17

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

Solutions for the Practice Questions

Math 412: Number Theory Lecture 6: congruence system and

Modular Arithmetic. claserken. July 2016

b) Find all positive integers smaller than 200 which leave remainder 1, 3, 4 upon division by 3, 5, 7 respectively.

The congruence relation has many similarities to equality. The following theorem says that congruence, like equality, is an equivalence relation.

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

Data security (Cryptography) exercise book

6. Find an inverse of a modulo m for each of these pairs of relatively prime integers using the method

Carmen s Core Concepts (Math 135)

NUMBER THEORY AMIN WITNO

Number Theory/Cryptography (part 1 of CSC 282)

Math 255 Spring 2017 Solving x 2 a (mod n)

ALGEBRA: Chapter I: QUESTION BANK

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 4 October 2013

Exam 1 7 = = 49 2 ( ) = = 7 ( ) =

Linear Congruences. The solutions to a linear congruence ax b (mod m) are all integers x that satisfy the congruence.

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 24 February 2012

Solutions to Exam 1. Problem 1. a) State Fermat s Little Theorem and Euler s Theorem. b) Let m, n be relatively prime positive integers.

Discrete Math Class 4 ( )

Fermat s little theorem. RSA.

Solutions for the 2nd Practice Midterm

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

Introduction to Modular Arithmetic

Collection of rules, techniques and theorems for solving polynomial congruences 11 April 2012 at 22:02

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Distribution of Primes

Applications of Fermat s Little Theorem and Congruences

Example Enemy agents are trying to invent a new type of cipher. They decide on the following encryption scheme: Plaintext converts to Ciphertext

Modular Arithmetic. Kieran Cooney - February 18, 2016

Modular Arithmetic: refresher.

The Chinese Remainder Theorem

Cryptography, Number Theory, and RSA

SOLUTIONS FOR PROBLEM SET 4

Assignment 2. Due: Monday Oct. 15, :59pm

University of British Columbia. Math 312, Midterm, 6th of June 2017

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

Math 127: Equivalence Relations

Solutions for the Practice Final

Multiples and Divisibility

Public Key Cryptography Great Ideas in Theoretical Computer Science Saarland University, Summer 2014

Number Theory. Konkreetne Matemaatika

Overview. The Big Picture... CSC 580 Cryptography and Computer Security. January 25, Math Basics for Cryptography

MATH 135 Algebra, Solutions to Assignment 7

Lecture 8. Outline. 1. Modular Arithmetic. Clock Math!!! 2. Inverses for Modular Arithmetic: Greatest Common Divisor. 3. Euclid s GCD Algorithm

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

Math 1111 Math Exam Study Guide

Practice Midterm 2 Solutions

Math 1111 Math Exam Study Guide

Grade 6 Math Circles March 1-2, Introduction to Number Theory

MATH 324 Elementary Number Theory Solutions to Practice Problems for Final Examination Monday August 8, 2005

Discrete Mathematics & Mathematical Reasoning Multiplicative Inverses and Some Cryptography

Discrete Square Root. Çetin Kaya Koç Winter / 11

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

Class 8: Factors and Multiples (Lecture Notes)

Sheet 1: Introduction to prime numbers.

p 1 MAX(a,b) + MIN(a,b) = a+b n m means that m is a an integer multiple of n. Greatest Common Divisor: We say that n divides m.

1.6 Congruence Modulo m

LECTURE 3: CONGRUENCES. 1. Basic properties of congruences We begin by introducing some definitions and elementary properties.

SESAME Modular Arithmetic. MurphyKate Montee. March 2018 IN,Z, We think numbers should satisfy certain rules, which we call axioms:

Two congruences involving 4-cores

Foundations of Cryptography

Implementation / Programming: Random Number Generation

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

6.2 Modular Arithmetic

Algorithmic Number Theory and Cryptography (CS 303)

Number-Theoretic Algorithms

CHAPTER 2. Modular Arithmetic

The covering congruences of Paul Erdős. Carl Pomerance Dartmouth College

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 7 November, CS1800 Discrete Structures Midterm Version C

Modular arithmetic Math 2320

Section 5.4. Greatest Common Factor and Least Common Multiple. Solution. Greatest Common Factor and Least Common Multiple

Mark Kozek. December 7, 2010

Wilson s Theorem and Fermat s Theorem

Constructions of Coverings of the Integers: Exploring an Erdős Problem

Number Theory for Cryptography

EE 418 Network Security and Cryptography Lecture #3

Grade 6 Math Circles. Divisibility

Primitive Roots. Chapter Orders and Primitive Roots

Lecture 32. Handout or Document Camera or Class Exercise. Which of the following is equal to [53] [5] 1 in Z 7? (Do not use a calculator.

Public Key Encryption

Cryptography Math 1580 Silverman First Hour Exam Mon Oct 2, 2017

LUCAS-SIERPIŃSKI AND LUCAS-RIESEL NUMBERS

Multiple : The product of a given whole number and another whole number. For example, some multiples of 3 are 3, 6, 9, and 12.

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

The Chinese Remainder Theorem

Goldbach conjecture (1742, june, the 7 th )

MST125. Essential mathematics 2. Number theory

Outline Introduction Big Problems that Brun s Sieve Attacks Conclusions. Brun s Sieve. Joe Fields. November 8, 2007

Goldbach Conjecture (7 th june 1742)

The Chinese Remainder Theorem

DUBLIN CITY UNIVERSITY

MATH 13150: Freshman Seminar Unit 15

Degree project NUMBER OF PERIODIC POINTS OF CONGRUENTIAL MONOMIAL DYNAMICAL SYSTEMS

Classical Cryptography

Chapter 4 Number Theory

12. Let Rm = {0,1,2,..., m 1} be a complete residue system modulo ra. Let a be an integer. When is a Rm = {0,1 a, 2 a,...

Transcription:

Numbers (8A

Copyright (c 2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Please send corrections (or suggestions to youngwlim@hotmail.com. This document was produced by using OpenOffice and Octave.

GCD A 24-by-60 rectangle is covered with ten 12-by-12 square tiles, where 12 is the GCD of 24 and 60. 24 = 2 12 12 24 24 mod 12 = 0 60 = 5 12 12 60 60 mod 12 = 0 More generally, an a-by-b rectangle can be covered with square tiles of side-length d only if d is a common divisor of a and b d a d b d : common divisor the largest d : gcd (greatest common divisor https://en.wikipedia.org/wiki/greatest_common_divisor Numbers (8A 3

LCM What is the LCM of 4 and 6? Multiples of 4 are: 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76,... and the multiples of 6 are: 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72,... Common multiples of 4 and 6 are simply the numbers that are in both lists: 12, 24, 36, 48, 60, 72,... So, from this list of the first few common multiples of the numbers 4 and 6, their least common multiple is 12. https://en.wikipedia.org/wiki/least_common_multiple Numbers (8A 4

GCD * LCM a = p 1 a 1 p2 a 2 pn a n Prime Factorization b = p 1 b 1 p2 b 2 pn b n gcd(a,b = p 1 min(a 1, b 1 p 2 min(a 2, b 2 p n min(a n,b n lcm(a,b = p 1 Max(a 1, b 1 p 2 Max (a 2, b 2 p n Max(a n, b n gcd(a, b lcm(a,b = p 1 a 1 +b 1 p2 a 2 +b 2 pn a n +b n = a b Numbers (8A 5

Finding common unit length Euclid's method for finding the greatest common divisor (GCD of two starting lengths BA and DC, both defined to be multiples of a common "unit" length. The length DC being shorter, it is used to "measure" BA, but only once because remainder EA is less than DC. EA now measures (twice the shorter length DC, with remainder FC shorter than EA. Then FC measures (three times length EA. Because there is no remainder, the process ends with FC being the GCD. https://en.wikipedia.org/wiki/euclidean_algorithm On the right Nicomachus' example with numbers 49 and 21 resulting in their GCD of 7 (derived from Heath 1908:300. Numbers (8A 6

Euclid Algorithm Steps remainder remainder zero divisor divisor divisor gcd https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 7

Euclid Algorithm 1071 = 3 2 7 17 462 = 2 3 7 11 gcd (1071,462 = 3 7 = 21 1071 = 2 462 + 147 462 = 3 147 + 21 147 = 7 21 + 0 https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 8

Common Divisor 1071 = 2 462 + 147 462 = 3 147 + 21 147 = 7 21 + 0 common divisor d d 1071 and d 462 1071 mod d = 0 d 1071 462 mod d = 0 d 462 https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 9

Common Divisor Properties common divisor d? d 1071 and d 462 1071 mod d = 0 and 462 mod d = 0 1071 = 2 462 + 147 remainder (2 462 + 147 mod d = 0 2 (462 mod d + 147 mod d = 0 1071 mod d = 0 462 mod d = 0 2 0 + 147 mod d = 0 147 mod d = 0 147 mod d = 0 d 462 and d 147 https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 10

Reducing GCD Problems 1071 = 2 462 + 147 d 1071 and d 462 gcd (1071, 462 462 = 3 147 + 21 d 462 and d 147 gcd (462, 147 147 = 7 21 + 0 d 147 and d 21 gcd (147, 21 1071 462 147 https://en.wikipedia.org/wiki/euclidean_algorithm 21 Numbers (8A 11

Linear Combination of gcd(1071, 462=21 1071 = 2 462 + 147 1071 2 462 = 147 462 = 3 147 + 21 462 3 147 = 21 462 3 (1071 2 462 = 21 7 462 3 1071 = 21 147 = 7 21 + 0 gcd(1071, 462 = 21 = 3 1071 + 7 462 gcd (a,b = sa + t b https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 12

Linear Combination of gcd(252, 198=18 252 = 1 198 + 54 252 1 198 = 54 198 = 3 54 + 36 198 3 54 = 36 54 = 1 36 + 18 54 1 36 = 18 36 = 2 18 (252 1 198 1 (198 3 (252 1 198 = 18 252 1 198 (4 198 3 252 = 18 4 252 5 198 = 18 https://en.wikipedia.org/wiki/euclidean_algorithm gcd (a,b = sa + t b Numbers (8A 13

Bezout s Identity gcds as linear combinations a, b Z + x, y Z x a + y b = gcd (a,b Bezout s coefficients (not unique Bezout s identities Generally, a linear combination of a & b must be unique and its coefficients x & y need not be integers. https://en.wikipedia.org/wiki/euclidean_algorithm Numbers (8A 14

Pairs of Bézout Coefficients Examples 42 = 3 12 + 6 12 = 2 6 42 3 12 = 6 (1 42 3 12 = 6 ( -3 12 + 1 42 = 6 x a + y b = gcd (a,b x 12 + y 42 = gcd (12, 42 Generally, x & y are not unique unless a & b are relatively prime https://en.wikipedia.org/wiki/b%c3%a9zout%27s_identity Numbers (8A 15

Pairs of Bézout Coefficients not unique -10 3 +7-3 1 +7 4-1 11 +7-3 18 +7-5 +2 +2 +2 +2 42/6=7-3 < 7 4 < 7 12/6=2 1 < 2-1 < 2 https://en.wikipedia.org/wiki/b%c3%a9zout%27s_identity Numbers (8A 16

Pairs of Bézout Coefficients 2 minimal pairs x a + y b = gcd (a,b 42/6=7 12/6=2 Among these pairs of Bézout coefficients, exactly two of them satisfy -3 < 7 4 < 7 1 < 2-1 < 2 https://en.wikipedia.org/wiki/b%c3%a9zout%27s_identity The Extended Euclidean Algorithm always produces one of these two minimal pairs. Numbers (8A 17

Pairs of Bézout Coefficients all pairs x a + y b = gcd (a,b all pairs can be represented in the form 42/6=7 12/6=2-3 + 7k 1 + 2k The Extended Euclidean Algorithm always produces one of these two minimal pairs. https://en.wikipedia.org/wiki/b%c3%a9zout%27s_identity Numbers (8A 18

Extended Euclid Algorithm Given a & b, the extended Euclid algorithm produce the same coefficients. Uniquely, one is chosen among many possible Bézout s coefficients https://en.wikipedia.org/wiki/extended_euclidean_algorithm Numbers (8A 19

Relatively Prime Numbers gcd (a,n = 1 Relatively prime numbers a & n s a + t n = 1 s a + t n 1 (mod n t n mod n = 0 s a 1 (mod n āa 1 (mod n the inverse of a exists : s linear combination of gcd(a, n=1 Numbers (8A 20

Finding an modulo inverse Finding an inverse of a modulo n Relatively prime numbers a & n Euclid Algorithm gcd (a,n = 1 Linear Combination s a + t n 1 (mod n The inverse of a s s a 1 (mod n Numbers (8A 21

Linear Combination of gcd(101, 4620=1 From Rosen s book 4620 = 45 101 + 75 4620 45 101 = 75 26 101 35 (4620 45 101 = 35 4620+1601 101 101 = 1 75 + 26 101 1 75 = 26 9 75+26 (101 1 75 = 26 101 35 75 75 = 2 26 + 23 75 2 26 = 23 8 26 9 (75 2 26 = 9 75+26 26 26 = 1 23 + 3 26 1 23 = 3 1 23+8 (26 1 23 = 8 26 9 23 23 = 7 3 + 2 23 7 3 = 2 3 (23 7 3 = 1 23+8 3 3 = 1 2 + 1 3 1 2 = 1 3 1 2 = 1 2 = 2 1 Numbers (8A 22

Inverse of 101 modulo 4620 4620 = 45 101 + 75 1601 35 4620 + 1601 101 = 1 1601 101 = 1 (mod 4620 1601 is an inverse of 101 modulo 4620 Numbers (8A 23

Congruence Etymology Middle English, from Latin congruentia ( agreement, from congruēns, present active participle of congruō ( meet together, agree. Noun: congruence (plural congruences The quality of agreeing or corresponding; being suitable and appropriate. (mathematics, number theory A relation between two numbers indicating they give the same remainder when divided by some given number. (mathematics, geometry The quality of being isometric roughly, the same measure and shape. (algebra More generally: any equivalence relation defined on an algebraic structure which is preserved by operations defined by the structure. https://en.wiktionary.org/wiki/congruence Numbers (8A 24

Congruence in Geometry congruent congruent similar https://en.wikipedia.org/wiki/congruence_(geometry Numbers (8A 25

Congruent modulo n a b (mod n a is congruent to b modulo n n (a b n divides (a-b (a b mod n = 0 (a mod n = (b mod n the same remainder A remainder is positive (0,.. n-1 Numbers (8A 26

Congruence Relation https://en.wikipedia.org/wiki/modular_arithmetic Numbers (8A 27

Properties of a Congruence Relation https://en.wikipedia.org/wiki/modular_arithmetic Numbers (8A 28

Remainders https://en.wikipedia.org/wiki/modular_arithmetic Numbers (8A 29

Linear Congruence Problems a x b (mod n find x =? A linear congruence a x = b find x =? A linear equation A remainder is positive (0,.. n-1 Numbers (8A 30

Modular Multiplicative Inverse A linear congruence a x b (mod n āa x āb (mod n x ā b (mod n A linear equation a x = b a 1 a x = a 1 b x = a 1 b āa 1 (mod n a 1 a = 1 A remainder is positive (0,.. n-1 Numbers (8A 31

Chinese Remainder Theorem x 2 (mod 3 and x 3 (mod 5 and x 2 (mod 7 https://en.wikipedia.org/wiki/chinese_remainder_theorem Sunzi's original formulation: x 2 (mod 3 3 (mod 5 2 (mod 7 with the solution x = 23 + 105k where k Z Numbers (8A 32

Chinese Remainder Theorem x a 1 x a 2 (mod m 1 and (mod m 2 and m 1, m 2, m n pairwise relatively prime x a n (mod m n x b (mod m 1 m 2 m n has a unique solution https://en.wikipedia.org/wiki/chinese_remainder_theorem Numbers (8A 33

m i, m, and M i x 2 (mod 3 x 3 (mod 5 x 2 (mod 7 m 1 = 3 m 2 = 5 m 3 = 7 m = 3 5 7 = 105 = m/m 1 = 3 5 7 /3 = 35 = m/m 2 = 3 5 7/5 = 21 = m/m 3 = 3 5 7/7 = 15 x a 1 (mod m 1 x a 2 (mod m 2 x a 3 (mod m 3 m = m 1 m 2 m 3 = m/m 1 = m 2 m 3 = m/m 2 = m 1 m 3 = m/m 3 = m 1 m 2 mod m 2 = mod m 3 = 0 mod m 1 = mod m 3 = 0 mod m 1 = mod m 2 = 0 M i mod m j = M j mod m i = 0 for i j Numbers (8A 34

Inverse of M i m 1, m 2, m 3 : pairwise relatively coprime gcd (, m 1 = 1 = 1 (mod m 1 y 1 : the inverse of m 2 m 3 gcd (, m 2 = 1 = 1 (mod m 2 y 2 : the inverse of m 1 m 3 gcd (, m 3 = 1 = 1 (mod m 3 y 3 : the inverse of m 1 m 2 = 1 (mod m 1 = 0 (mod m 1 = 0 (mod m 1 = 0 (mod m 2 = 1 (mod m 2 = 0 (mod m 2 = 0 (mod m 3 = 0 (mod m 3 = 1 (mod m 3 m 2 m 3 m 1 m 3 m 1 m 2 Numbers (8A 35

Sum of a i M i y i a 1 a 2 a 3 = 1 (mod m 1 = 0 (mod m 1 = 0 (mod m 1 = 0 (mod m 2 = 1 (mod m 2 = 0 (mod m 2 = 0 (mod m 3 = 0 (mod m 3 = 1 (mod m 3 a 1 = a 1 (mod m 1 a 2 = 0 (mod m 1 a 3 = 0 (mod m 1 a 1 = 0 (mod m 2 a 2 = a 2 (mod m 2 a 3 = 0 (mod m 2 a 1 = 0 (mod m 3 a 2 = 0 (mod m 3 a 3 = a 3 (mod m 3 a 1 + a 2 + a 3 = a 1 = a 1 (mod m 1 a 1 + a 2 + a 3 = a 2 = a 2 (mod m 2 a 1 + a 2 + a 3 = a 3 = a 3 (mod m 3 Numbers (8A 36

X = Sum of a i M i y i x a 1 (mod m 1 x a 2 (mod m 2 x a 3 (mod m 3 a 1 + a 2 + a 3 = a 1 = a 1 (mod m 1 a 1 + a 2 + a 3 = a 2 = a 2 (mod m 2 a 1 + a 2 + a 3 = a 3 = a 3 (mod m 3 x = a 1 + a 2 + a 3 Numbers (8A 37

Chinese Remainder Examples (1 x 2 (mod 3 x 3 (mod 5 x 2 (mod 7 m 1 = 3 m 2 = 5 m 3 = 7 3 5 7 = 105 = m = m/m 1 = 3 5 7 /3 = 35 = m/m 2 = 3 5 7/5 = 21 = m/m 3 = 3 5 7/7 = 15 m 2 m 3 m 1 m 3 m 1 m 2 = 2 (mod m 1 = 0 (mod m 1 = 0 (mod m 1 = 0 (mod m 2 = 1 (mod m 2 = 0 (mod m 2 = 0 (mod m 3 = 0 (mod m 3 = 1 (mod m 3 m 2 m 3 m 1 m 3 m 1 m 2 = 35 2 = 2 2 = 1 (mod 3 = 21 1 = 1 1 = 1 (mod 5 = 15 1 = 1 1 = 1 (mod 7 y 1 ( =2 : the inverse of ( =35 y 2 ( =1 : the inverse of ( =21 y 3 ( =1 : the inverse of ( =15 = 1 (mod m 1 = 0 (mod m 1 = 0 (mod m 1 = 0 (mod m 2 = 1 (mod m 2 = 0 (mod m 2 = 0 (mod m 3 = 0 (mod m 3 = 1 (mod m 3 Numbers (8A 38

Chinese Remainder Examples (2 = 35 2 = 2 2 = 1 (mod 3 = 21 1 = 1 1 = 1 (mod 5 = 15 1 = 1 1 = 1 (mod 7 y 1 ( =2 : the inverse of ( =35 y 2 ( =1 : the inverse of ( =21 y 3 ( =1 : the inverse of ( =15 = 35 35=11 3 + 2 35 11 3 = 2 3=1 2 + 1 3 1 2 = 1 y 1 = 1+3 k 3 1 (35 11 3 = 1 35 + 12 3 3 1 2 = 1 = 21 y 2 = 1+5 k 21=4 5 + 1 21 4 5 = 1 1 21 4 5 = 1 = 15 y 3 = 1+7 k 15=2 7 + 1 15 2 7 = 1 1 15 2 7 = 1 Numbers (8A 39

Chinese Remainder Examples (3 a 1 a 2 a 3 = 1 (mod m 1 = 0 (mod m 1 = 0 (mod m 1 = 0 (mod m 2 = 1 (mod m 2 = 0 (mod m 2 = 0 (mod m 3 = 0 (mod m 3 = 1 (mod m 3 x = a 1 + a 2 + a 3 x = a 1 = a 1 (mod m 1 x = a 2 = a 2 (mod m 2 x = a 3 = a 3 (mod m 3 m 1 = 3 m 2 = 5 m 3 = 7 = 3 5 7/3 = 5 7 = 35 = 3 5 7 /5 = 3 7 = 21 = 3 5 7/7 = 3 5 = 15 x = 2 35 2 + 3 21 1 + 2 15 1 = 233 x = 233 = 23 (mod 105 m = 3 5 7 = 105 Numbers (8A 40

Chinese Remainder Summary x a 1 (mod m 1 x a 2 (mod m 2 x a 3 (mod m 3 m = m 1 m 2 m 3 = m/m 1 = m 2 m 3 = m/m 2 = m 1 m 3 = m/m 3 = m 1 m 2 m 1, m 2, m 3 : pairwise relatively coprime gcd (, m 1 = 1 gcd (, m 2 = 1 gcd (, m 3 = 1 = 1 (mod m 1 = 1 (mod m 2 = 1 (mod m 3 y 1 : the inverse of y 2 : the inverse of y 3 : the inverse of x = a 1 + a 2 + a 3 Numbers (8A 41

Chinese Remainder Theorem https://en.wikipedia.org/wiki/chinese_remainder_theorem Numbers (8A 42

Upper and Lower Bounds https://en.wikipedia.org/wiki/algorithm Numbers (8A 43

References [1] http://en.wikipedia.org/ [2]