Modular Arithmetic. claserken. July 2016

Similar documents
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.

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

1.6 Congruence Modulo m

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

Discrete Math Class 4 ( )

Applications of Fermat s Little Theorem and Congruences

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

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

Fermat s little theorem. RSA.

Solutions for the Practice Questions

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

SOLUTIONS FOR PROBLEM SET 4

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

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

The Chinese Remainder Theorem

Modular arithmetic Math 2320

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

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

Carmen s Core Concepts (Math 135)

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

Introduction to Modular Arithmetic

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

NUMBER THEORY AMIN WITNO

Modular Arithmetic. Kieran Cooney - February 18, 2016

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

Grade 6/7/8 Math Circles April 1/2, Modular Arithmetic

Number Theory/Cryptography (part 1 of CSC 282)

MAT Modular arithmetic and number theory. Modular arithmetic

6.2 Modular Arithmetic

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

Solutions for the 2nd Practice Midterm

Algorithmic Number Theory and Cryptography (CS 303)

Distribution of Primes

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

The Chinese Remainder Theorem

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

Solutions for the Practice Final

SOLUTIONS TO PROBLEM SET 5. Section 9.1

The Chinese Remainder Theorem

Math 127: Equivalence Relations

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

A Quick Introduction to Modular Arithmetic

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

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

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

ALGEBRA: Chapter I: QUESTION BANK

MST125. Essential mathematics 2. Number theory

Data security (Cryptography) exercise book

To be able to determine the quadratic character of an arbitrary number mod p (p an odd prime), we. The first (and most delicate) case concerns 2

An elementary study of Goldbach Conjecture

CHAPTER 2. Modular Arithmetic

Foundations of Cryptography

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

Modular Arithmetic and Doomsday

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

Power = 36² mod 99 Power = 9 5 a 5 = 0 x = 81 Power = 9² mod 99 Power = 81 6 a 6 = 1 x = 81 x 81 mod 99 x = 27 7 a 7 = 1 x = 27 x 27 mod 99 x = 36

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

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

Number Theory. Konkreetne Matemaatika

Modular Arithmetic: refresher.

Wilson s Theorem and Fermat s Theorem

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.

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

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

An interesting class of problems of a computational nature ask for the standard residue of a power of a number, e.g.,

Sheet 1: Introduction to prime numbers.

Primitive Roots. Chapter Orders and Primitive Roots

Math 1111 Math Exam Study Guide

Practice Midterm 2 Solutions

Math 1111 Math Exam Study Guide

Congruence properties of the binary partition function

Algorithmic Number Theory and Cryptography (CS 303)

Cryptography, Number Theory, and RSA

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

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

Math 412: Number Theory Lecture 6: congruence system and

Consecutive Numbers. Madhav Kaushish. November 23, Learning Outcomes: 1. Coming up with conjectures. 2. Coming up with proofs

Goldbach Conjecture (7 th june 1742)

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

ON MODULI FOR WHICH THE FIBONACCI SEQUENCE CONTAINS A COMPLETE SYSTEM OF RESIDUES S. A. BURR Belt Telephone Laboratories, Inc., Whippany, New Jersey

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,...

Number Theory for Cryptography

Tilings with T and Skew Tetrominoes

Implementation / Programming: Random Number Generation

MATH 135 Algebra, Solutions to Assignment 7

LUCAS-SIERPIŃSKI AND LUCAS-RIESEL 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.

#A3 INTEGERS 17 (2017) A NEW CONSTRAINT ON PERFECT CUBOIDS. Thomas A. Plick

STRATEGY AND COMPLEXITY OF THE GAME OF SQUARES

Arithmetic of Remainders (Congruences)

Warm-Up Up Exercises. 1. Find the value of x. ANSWER 32

DUBLIN CITY UNIVERSITY

ON SPLITTING UP PILES OF STONES

Goldbach conjecture (1742, june, the 7 th )

Number Theory. Applications of Congruences. Francis Joseph Campena Mathematics Department De La Salle University-Manila

NIM Games: Handout 1

MATH 13150: Freshman Seminar Unit 15

Number-Theoretic Algorithms

Math 319 Problem Set #7 Solution 18 April 2002

Transcription:

Modular Arithmetic claserken July 2016 Contents 1 Introduction 2 2 Modular Arithmetic 2 2.1 Modular Arithmetic Terminology.................. 2 2.2 Properties of Modular Arithmetic.................. 2 2.3 An Interesting Modular Arithmetic Problem............ 3 2.4 Modular Arithmetic Exercises.................... 3 3 The Chinese Remainder Theorem (CRT) 3 3.1 Example 1(With two congruences)................. 3 3.2 Example 2(With three congruences)................ 4 3.3 The Extended Euclidean Algorithm................. 5 1

1 Introduction This is a crash course into modular arithmetic, the Chinese Remainder Theorem, and the extended Euclidean Algorithm. The only things you need to know are algebra and school 5th grade NT. Have fun! 2 Modular Arithmetic I start off with a formal definition and from there I will break it apart and explain it. Formal Definition: a b (mod c) if a b is a multiple of c and a b is a multiple of c if a b (mod c). What I mean here is this: If a b (mod c), then a is b more than some multiple of c. Let me give some examples. 22 2 (mod 10) because 22 = 2+10 2, 28 6 (mod 11) because 28 = 6+11 2, 17 2 (mod 5) because 17 = 2 + 5 3. Also, you could flip each of those statements. By that I mean, since 22 = 2 + 10 2 that means 22 2 (mod 10) and you can apply the same thing to the other examples previously. Additionally, let me introduce some definitions. If you are wondering how to pronounce a b (mod c), it is a is congruent to b modulo c. 2.1 Modular Arithmetic Terminology Residue: In the congruence a b (mod c), b is known as the residue. In modular arithmetic, the residue can be negative. For example, 5 2 (mod 7) because 5 = 2 + 7 1. Modulo: In the congruence a b (mod c), c is known as the modulo. 2.2 Properties of Modular Arithmetic I leave the following properties for the reader to think about. Addition: a b (mod c) = a + d b + d (mod c) Subtraction: a b (mod c) = a d b d (mod c) Multiplication: a b (mod c) = ad bd (mod c) Division: If a = jk, b = jd, and a b (mod c), then k d (mod c gcd(c,j) ) Exponentiation: a b (mod c) = a e b e (mod c) Note that the gcd(a, b) is the greatest integer that divides both a and b. 2

2.3 An Interesting Modular Arithmetic Problem Problem: Prove that a number and the sum of the digits of a number are congruent modulo 3. Proof : Let this number be x. Then, x = a n 10 n + a n 1 10 n 1 + + a 0, where each a i is the corresponding digit to x. Therefore, this problem is equivalent to proving that a n 10 n + a n 1 10 n 1 + + a 0 (mod 3) = a n + a n 1 +... + a 0 (mod 3), but since 10 1 (mod 3), so then the problem is equivalent to a n 1 n + a n 1 1 n 1 + + a 0 (mod 3) = a n + a n 1 +... + a 0 (mod 3), which is obviously true. 2.4 Modular Arithmetic Exercises 1. Write 3 numbers that are congruent to 5 modulo 7. 2. What modulo does a clock work on? 3. Prove that a number and the sum of the digits of a number are congruent modulo 9(Use the same argument as the one I did for modulo 3) 4. Prove that a number and number formed by the last two digits or that number(assume it has at least two digits) are congruent modulo 4 5. Convince yourself that the Properties of Modular Arithmetic are true. 6. Prove that there exists no positive integer solutions to the modular equation x 2 + y 2 3 (mod 4) 7. Prove that n 15 n 5 is divisible by 264 for all integers n 8. Prove that the product of the side lengths of a right triangle is divisible by 60 3 The Chinese Remainder Theorem (CRT) The Chinese Remainder Theorem is a way of solving a set of congruences under a certain condition. I will dive right into an example, as I think that is the easiest to learn the Chinese Remainder Theorem. 3.1 Example 1(With two congruences) Problem: Find all x, such that x 3 (mod 7) and x 2 (mod 5). 3

Solution: We first check that we are able to apply the CRT here. It states that every pair of the modulos have to be relatively prime. In this case, the only modulos are 5 and 7, so the only pair is 5 and 7 and they are relatively prime. Note that if two numbers, a and b are relatively prime, then the gcd(a, b) = 1 and vice versa. Now, we continue with CRT. We start off by writing x like this x = 7a + 5b (The reason we write x like this is a lemma known as Bezout s Lemma, but that is for a different article. You can learn more about it here: https://www.artofproblemsolving.com/wiki/index. php?title=bezout%27s_lemma) realize the residue when x is take (mod 7) is the rightmost number (the 5b) and also realize that the residue when x is taken (mod 5) is the leftmost number (7a). The important takeaway from that realization is this: If I change a that will only affect x modulo 5 and if I change b it will only affect x modulo 7. That means we can work on trying to satisfy one of the problems given congruences without having to worry about messing up the other one, so we continue by trying to make x 3 (mod 7). x is currently 5b (mod 7), which we want to make 3 (mod 7), so we try to find the minimum natural b, such that 5b (mod 7) = 3 (mod 7), by incrementing b by 1 from 1, we get b = 2. Now, we continue by trying to make x 2 (mod 5). x is currently 7a (mod 5), which we want to make 2 (mod 5), so we try to find the minimum natural a, such that 7a (mod 5) = 2 (mod 5), by incrementing a by 1 from 1, we get a = 1. Now, by substituting b = 2 and a = 1, we get x = 17. We are not done yet however, because we could add or subtract 35 = 7 5 to x and it would still satisfy both of the congruences. This means x = 17 + 35y, where y is any integer. Realize that x 17 (mod 35). This means our answer is all x that satisfy x 17 (mod 35). Phew, that was a lot. From the example above, it sounds like CRT is a method of solving congruences. CRT actually only states that there exists x(x is from the above example) The method used to solve the congruences is known as Gauss s Algorithm. 3.2 Example 2(With three congruences) Problem: Find all x, such that x 3 (mod 11), x 6 (mod 7), and x 2 (mod 4). Solution: We first check that we are able to apply CRT here. There are 3 pairs, namely 11 and 7, 11 and 4, and 7 and 4. All of those pairs are relatively prime, so we are able to apply CRT here. Now, we let x = 28a + 44b + 77c(In general, for each of the modulos you multiply the other modulos together and then assign it a variable that hasn t been used) Like in the above example, we can work on trying to satisfy one of the congruences without having to worry about messing up any of the other ones. We work on trying to satisfy x 3 (mod 11) first. Currently, x 28a (mod 11), so we try to finding the smallest positive a such that 28a (mod 11) = 3 (mod 11), or 6a (mod 11) = 3 (mod 11) because 28 6 (mod 11). By incrementing by 1 from 1, we get a = 6. Now 4

we work on trying to satisfy x 6 (mod 7). x is currently 44b (mod 7), so we try the smallest positive integer b such that 44b (mod 7) = 6 (mod 7) = 2b (mod 7) = 6 (mod 7). By incrementing by 1 from 1 we get b = 3. Now we work on trying to satisfy our final congruence, which is x 2 (mod 4). Currently x 77c (mod 4), so we try finding the smallest positive integer c such that 77c (mod 4) = 2 (mod 4) = c (mod 4) = 2 (mod 4). By incrementing by 1 from 1, we get c = 2. Now, we have a = 6, b = 3, and c = 2. This means that x = 454. We are not done yet because we could add or subtract 11 7 4 = from x and x would still satisfy the congruences, this means that x = 454 + 308y. This means x 454 (mod 308) = x 146 (mod 308) 3.3 The Extended Euclidean Algorithm 5