Elementary Number Theory. Franz Luef

Similar documents
Elementary Number Theory Review. Franz Luef

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

CHAPTER 3. Congruences. Congruence: definitions and properties

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

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

Lecture Notes. Advanced Discrete Structures COT S

3 The fundamentals: Algorithms, the integers, and matrices

4 Number Theory and Cryptography

Math 109 HW 9 Solutions

Part V. Chapter 19. Congruence of integers

M381 Number Theory 2004 Page 1

Elementary Number Theory MARUCO. Summer, 2018

Outline. Number Theory and Modular Arithmetic. p-1. Definition: Modular equivalence a b [mod n] (a mod n) = (b mod n) n (a-b)

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

NOTES ON SIMPLE NUMBER THEORY

3.2 Solving linear congruences. v3

Mathematics for Cryptography

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.

Applied Cryptography and Computer Security CSE 664 Spring 2018

This exam contains 5 pages (including this cover page) and 4 questions. The total number of points is 100. Grade Table

Simultaneous Linear, and Non-linear Congruences

Number Theory Solutions Packet

Number theory lectures

Integers and Division

4. Congruence Classes

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

Chapter 5. Modular arithmetic. 5.1 The modular ring

MATH 361: NUMBER THEORY FOURTH LECTURE

Notes on Systems of Linear Congruences

Chapter 5. Number Theory. 5.1 Base b representations

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Modular Arithmetic Instructor: Marizza Bailey Name:

Basic elements of number theory

Basic elements of number theory

Number Theory Proof Portfolio

4 Powers of an Element; Cyclic Groups

ax b mod m. has a solution if and only if d b. In this case, there is one solution, call it x 0, to the equation and there are d solutions x m d

Our Number Theory Textbook

1 Overview and revision

The Chinese Remainder Theorem

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Number Theory Homework.

For your quiz in recitation this week, refer to these exercise generators:

Number Theory and Algebra: A Brief Introduction

Wilson s Theorem and Fermat s Little Theorem

Divisibility. Chapter Divisors and Residues

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

MODULAR ARITHMETIC KEITH CONRAD

Number Theory Notes Spring 2011

ELEMENTS OF NUMBER THEORY

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

MATH 145 Algebra, Solutions to Assignment 4

cse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Elementary Properties of the Integers

Number Theory and Group Theoryfor Public-Key Cryptography

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

ICS141: Discrete Mathematics for Computer Science I

Summary Slides for MATH 342 June 25, 2018

Lecture 7: Number Theory Steven Skiena. skiena

Finite Fields. Mike Reiter

Chapter 5: The Integers

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

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

Ch 4.2 Divisibility Properties

10 Problem 1. The following assertions may be true or false, depending on the choice of the integers a, b 0. a "

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Introduction to Number Theory

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn

MATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST

7. Prime Numbers Part VI of PJE

MATH Fundamental Concepts of Algebra

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

The Chinese Remainder Theorem

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

LEGENDRE S THEOREM, LEGRANGE S DESCENT

A Guide to Arithmetic

The Chinese Remainder Theorem

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

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

MATH 3240Q Introduction to Number Theory Homework 4

Math From Scratch Lesson 20: The Chinese Remainder Theorem

CMPUT 403: Number Theory

Lecture 7 Number Theory Euiseong Seo

Number Theory. Modular Arithmetic

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

Introduction to Cryptology. Lecture 19

Congruence of Integers

Chapter 2. Divisibility. 2.1 Common Divisors

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Tomáš Madaras Congruence classes

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

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Transcription:

Elementary Number Theory

Congruences Modular Arithmetic Congruence The notion of congruence allows one to treat remainders in a systematic manner. For each positive integer greater than 1 there is an arithmetic mod n that mirrors ordinary arithmetic, but is finite, since it involves only the remainders 0, 1,..., n 1 occuring on division by n. Definition Integers a and b are said to be congruent mod n, written a b mod n, if they leave the same remainder on division by n. In other words, a b mod n, if n divides a b.

Congruences Definition The set of remainders {0, 1,..., n 1} is called the least sytem of residues modulo n. We denote the system of residues modulo n bu Z n. A set of integers a 1,..., a n form a complete system of residues modulo n if these are congruent to {0,..., n 1} modulo n. The integers that leave remainder r on division by n form what is called the congruence class of a, {nk + a : k Z}, denoted by nz + a. For example, 2Z is {even numbers} and 2Z + 1 is {ood numbers}. Each congruence class is a set of equally spaced points along the real line.

Examples Examples 8 3 mod 5, since 8 3 = 1 5 Complete set of residues modulo 5: {0, 1, 2, 3, 4} but also { 5, 11, 32, 13, 24} Fact: A set of n integers a 1,..., a n forms a complete set of residues modulo n if and only if NO two integers a i and a j are congruent modulo n, i.e. a i a j = k n does not hold for a k Z. One can add and multiply congruences very much like one can add and multiply integers:modular Arithmetic.

Modular Arithmetic Basic Rules a a mod n Example If a b mod n, then b a mod n. If a b mod n and b c mod n, then a c mod n. If a b mod n and c d mod n, then a + c b + d mod n and ac bd mod n. If a b mod n, then a k b k mod n. 3 8 mod 5 and 8 23 mod 5 gives 3 23 mod 5 3 8 mod 5 and 1 11 mod 5 gives 4 19 mod 5 3 8 mod 5 and 1 11 mod 5 gives 3 88 mod 5

Modular Arithmetic Division If a b mod n and c d ac bd mod n. mod n, then In particular: If a b mod n, then ac bc mod n. In contrast to the integers, one has to be careful about cancelling common factors in modular arithmetic! 15 2 20 2 mod 10 BUT 15 20 mod 10. 6 16 mod 5 is 2 3 2 8 mod 5 is the same as 3 8 mod 5. 6 4 0 mod 12, BUT 6 6 mod 12 and 4 4 mod 12.

Cancellation of factors in modular arithmetic Lemma Suppose a b mod n. Then a b mod n gcd(c,n). Check it in our example: 15 2 20 2 mod 10, gcd(2, 10) = 2 15 20 mod 5. Corollary Suppose gcd(d, n) = 1. Then a c b c a b mod n. mod n implies Suppose p is a prime number. If c is not a multiple of p, then Then a c b c mod p implies a b mod p. Moral: Congruences modulo a prime number p behave very differently from congruences modulo a composite number.

Congruences Modular Arithmetic Definition Integers a and b are said to be congruent mod n, written a b mod n, if they leave the same remainder on division by n. In other words, a b mod n, if n divides a b. Remark What is 3 x mod 7? Answer: x = 4. General case: k mod n is n k k mod n n 0 mod n is the same as n k + k 0 mod n. Therefore, n k k mod n.

Congruences Modular Arithmetic Cancelling Factors in congruences Suppose ac bc mod n. Then a b mod Special case Suppose gcd(c, n) = 1. Then a c b c a b mod n. n gcd(c,n). mod n implies Suppose p is a prime number and c is not a multiple of p. Then a c b c mod p implies a b mod p.

Linear congruences Linear congruences The equation ax b mod n has a solution if and only if d = gcd(a, n) divides b. If d = gcd(a, n) divides b, then it has d mutually incongruent solutions modulo n: x 0, x 0 + n d, x 0 + 2n d,..., x 0 + (d 1)n d, where x 0 is the particular solution determined from the Euclidean algorithm. Corollary Suppose gcd(a, n) = 1. Then ax b mod n has a unique solution.

Linear congruences Solution Find y Z such that ay 1 mod n, i.e. find the multiplicative inverse of a modulo n. Use the Euclidean algorithm to find such an y. Multiply the linear congrunce ax b mod n with the multiplicative inverse y. Then yax yb mod n, which yields x yb mod n.

Linear congruences Example 37x 15 mod 49. gcd(37, 49) = 1 implies that the equation has exactly ONE solution. Find the multiplicative inverse of 37 modulo 49, i.e. 37y 1 mod 49. Euclidean algorithm: 49 = 37 + 12, 37 = 3 12 + 1. Thus 1 = 37 3.12 = 37 3(49 37) = 4 37 3 49. 4 is the multiplicative inverse of 37 modulo 49. 37x 15 mod 49, therefore 4 37x 15 mod 49, i.e. x 11 mod 49.

Linear congruences Example 18x 8 mod 14. gcd(14, 18) = 2 implies that the equation has TWO solutions. 2 9x 2 4 mod 2 7 is equivalent to 9x 4 mod 7 because gcd(2, 14) = 2. Find the multiplicative inverse of 9 modulo 7, i.e. 9y 1 mod 7. Euclidean algorithm: 9 = 7 + 2, 7 = 3 2 + 1. Thus 1 = 4 7 3 9. 3 is the multiplicative inverse of 9 modulo 7, i.e. 3 4 mod 7. 9x 4 mod 7, therefore 4 9x 4 4 mod 7, i.e. x 0 2 mod 49. The second solution: x 1 = x 0 + 14/2 = 2 + 7 = 9.

Pascal s triangle

Pascal s triangle modulo 2 Pascal s Triangle mod 2

Binary representation of integers Motivation G. W. Leibniz, one of the inventors of calculus and contempary of Newton, was the first to express integers in terms of powers of 2. In 1671 Leibniz invented a machine that could execute all four arithmetical operations, which later was actually build. Binary representations are ubiquitious nowadays, because that s the way computers operate and all our data are stored on DVD, flashdrive,...! In other words our digital world has only two fingers or in Latin: two digits. We are going to use them in our computations of congruences!

Binary Representation Procedure Instead of powers of 10 we want to write a number in terms of powers of 2. The first few powers of 2 are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,... Let us write 984 = 9 10 2 + 8 10 + 4 10 0 in powers of 2: Find the largest power of 2 that does not exceed 984 (that is 512 = 2 9 in this case), and then procede successively with smaller powers of 2 as follows: 984 = 512 + 472, 472 = 256 + 216, 216 = 128 + 88, 88 = 64 + 24, 24 = 16 + 8. 984 = 2 9 +2 8 +2 7 +2 6 +0 2 5 +2 4 +2 3 +0 2 2 +0 2 1 +0 2 0 (984) 2 = 1111011000

Binary Representation Summary A 1 in our binary representation means we are including the power of 2 and a 0 that we are excluding this power of 2. Examples What are the binary expansion of 7, 11, 15, 25 and of 6, 10, 14, 20? The answers are as follows: (7) 2 = 111, (11) 2 = 1011, (15) 2 = 1111, (25) 2 = 11001 (6) 2 = 110, (10) 2 = 1010, (14) 2 = 1110, (20) 2 = 10100. What is the emerging pattern? odd numbers have a 1 as last digit and even numbers a 0 in the last digit of their binary expansions.

Linear congruences and Chinese Remainder Theorem Linear congruences The equation ax b mod n has a solution if and only if d divides b, where d is the gcd(a, n). If d divides b, then it has d mutually incongruent solutions modulo n: x 0, x 0 + n d, x 0 + 2n d,..., x 0 + (d 1)n d. Corollary Suppose gcd(a, n) = 1. Then ax b mod n has a unique solution. Idea The linear congruence is equivalent to the linear Diophantine equation ax ny = b.

Linear congruences and Chinese Remainder Theorem Idea By the result about linear Diophantine equations we have that it is soluble if and only if d b. Furthermore, the solutions are in this case: Suppose x 0, y 0 are solutions, then any other solution is of the form x = x 0 + n d t and y = y 0 + n d t for t = 0, 1,..., d 1. Example 18x 8 mod 14 We have to find integers x, y such that 18x 14y = 8. gcd(18, 14) = 2 Therefore we can solve 18x 14y = 2 with particular solution is x 0 = 4 and y 0 = 5. Thus 18 16 8 mod 14 and the other solution is 2 14/2 = 5 9 mod 14.

Linear congruences and Chinese Remainder Theorem Chinese Remainder Theorem Let n 1 and n 2 be two integers with gcd(n 1, n 2 ) = 1. Suppose a 1 and a 2 are integers. Then the simultaneous congruences x a 1 mod n 1 and x a 2 mod n 2 has exactly one solution x with 0 x < n 1 n 2. The proof provides the method to solve these kind of equations. Therefore, we discuss it in a particular example. Example What are the solutions to x 8 mod 11 and x 3 mod 19?

Linear congruences and Chinese Remainder Theorem Example x 8 mod 11 and x 3 mod 19 The solution to the first congruence are numbers of the form x = 11y + 8. Substitute this into the second congruence: 11y + 8 3 mod 19 11y 14 mod 19. The solution is y 1 3 mod 19. Solutions to the original congrunence via x 1 = 11y 1 + 8 = 11 3 + 8 = 41. Check our solution: (41 8)/11 = 3 and (41 3)/19 = 2.