A Quick Introduction to Modular Arithmetic

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

Applications of Fermat s Little Theorem and Congruences

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

Modular arithmetic Math 2320

1.6 Congruence Modulo m

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

6.2 Modular Arithmetic

Modular Arithmetic. claserken. July 2016

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

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

Distribution of Primes

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

Groups, Modular Arithmetic and Geometry

Grade 7 & 8 Math Circles October 12, 2011 Modular Arithmetic

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

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

Math 127: Equivalence Relations

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

MAT Modular arithmetic and number theory. Modular arithmetic

Introduction To Modular Arithmetic

Modular Arithmetic. Kieran Cooney - February 18, 2016

Two congruences involving 4-cores

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

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

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

Wilson s Theorem and Fermat s Theorem

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Number Theory/Cryptography (part 1 of CSC 282)

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

Introduction to Modular Arithmetic

Practice Midterm 2 Solutions

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

Fermat s little theorem. RSA.

Modular Arithmetic: refresher.

4. Subtracting an even number from another even number gives an odd number. 5. Subtracting an odd number from another odd number gives an even number

Carmen s Core Concepts (Math 135)

Number Theory. Konkreetne Matemaatika

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

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

Diophantine Equations and Modulo 11.

CHAPTER 2. Modular Arithmetic

MATH 13150: Freshman Seminar Unit 15

Modular Arithmetic and Doomsday

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

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

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

Grade 7/8 Math Circles February 9-10, Modular Arithmetic

NUMBER THEORY AMIN WITNO

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015

Congruence properties of the binary partition function

NIM Games: Handout 1

Cryptography Lecture 1: Remainders and Modular Arithmetic Spring 2014 Morgan Schreffler Office: POT 902

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

Visualizing Integers TEACHER NOTES MATH NSPIRED. Math Objectives. Vocabulary. About the Lesson. TI-Nspire Navigator System

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

Solutions for the 2nd Practice Midterm

Logarithmic Functions and Their Graphs

Foundations of Cryptography

LUCAS-SIERPIŃSKI AND LUCAS-RIESEL NUMBERS

MATH CIRCLE, 10/13/2018

Solutions to the problems from Written assignment 2 Math 222 Winter 2015

Goldbach Conjecture (7 th june 1742)

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

1 Introduction to Cryptology

Grade 6 Math Circles March 8-9, Modular Arithmetic

On Modular Extensions to Nim

Solutions for the Practice Questions

Math 1111 Math Exam Study Guide

Rational Points On Elliptic Curves - Solutions. (i) Throughout, we ve been looking at elliptic curves in the general form. y 2 = x 3 + Ax + B

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

Arithmetic of Remainders (Congruences)

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

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

Fall. Spring. Possible Summer Topics

Determine the intercepts of the line and ellipse below: Definition: An intercept is a point of a graph on an axis. Line: x intercept(s)

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

MST125. Essential mathematics 2. Number theory

2. Nine points are distributed around a circle in such a way that when all ( )

Implementation / Programming: Random Number Generation

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

Data security (Cryptography) exercise book

An Enhanced Fast Multi-Radio Rendezvous Algorithm in Heterogeneous Cognitive Radio Networks

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

Quadratic Residues. Legendre symbols provide a computational tool for determining whether a quadratic congruence has a solution. = a (p 1)/2 (mod p).

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.

Algorithmic Number Theory and Cryptography (CS 303)

Math 1111 Math Exam Study Guide

An elementary study of Goldbach Conjecture

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

Congruences Modulo Small Powers of 2 and 3 for Partitions into Odd Designated Summands

Discrete Math Class 4 ( )

MCAS/DCCAS Mathematics Correlation Chart Grade 4

Primitive Roots. Chapter Orders and Primitive Roots

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

Mark Kozek. December 7, 2010

Sheet 1: Introduction to prime numbers.

SOLUTIONS FOR PROBLEM SET 4

1999 Gauss Solutions 11 GRADE 8 (C) 1 5

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

Public Key Cryptography

Transcription:

A Quick Introduction to Modular Arithmetic Art Duval University of Texas at El Paso November 16, 2004 1 Idea Here are a few quick motivations for modular arithmetic: 1.1 Sorting integers Recall how you sort all integers into odd and even. Every number is either odd or even, but not both. This is a partition of the integers into two classes. One way to think of this partition is that we are sorting numbers based on whether or not they are divisible by 2. If we replace the 2 in the odd/even definition by, say, 3, we could sort numbers based on whether or not they are divisible by 3. It turns out to be better (you ll see why soon, I hope) to sort an integer based on which remainder it leaves when it s divided by 3. In this settting, we think of even numbers as those whose remainder is 0 when divided by 2, and odd numbers as those whose remainder is 1 when divided by 2. And then, when we replace 2 by 3, we d be sorting the integers into 3 classes, those whose remainder is 0 when divided by 3, those whose remainder is 1 when divided by 3, and those whose remainder is 2 when divided by 3. From now on, we ll call the number we re dividing by the modulus, and denote it by m. So, in the odd and even case, m = 2, and the next case we talked about, m = 3. We can set m to be any positive integer. (If m = 1, something funny happens. Try it!) When m = 2, the integers are sorted into 2 parts, {..., 4, 2, 0, 2, 4, 6, 8,...} and {..., 3, 1, 1, 3, 5, 7,...}. (Note that negative integers are included as 1

well.) When m = 3, the integers are sorted into 3 parts, {..., 6, 3, 0, 3, 6, 9, 12,...}, {..., 5, 2, 1, 4, 7, 10, 13,...}, {..., 4, 1, 2, 5, 8, 11, 14,...}. 1.2 Remainders Closely related to the above idea is the idea of assigning to every integer its remainder when its divided by m. So, for instance, when m = 5, we d assign 17 to 2, since 17 leaves a remainder of 2 when divided by m = 5. When m = 2, every odd number would be assigned to 1, and every even number would be assigned to 0. What s the difference between sorting and assigning by remainders? It seems like the same thing, and they are very closely related. When we sort by remainders, we think of all the integers in the same class as being related to one another when they have the same remainder. When we assign, we think of a function assigning to every integer its remainder. These two different perspectives will come up again. 1.3 Last digit A special case of assigning or sorting by remainder when dividing by m is when m = 10. Then, the remainder when dividing a non-negative integer by m = 10 is simply its last digit! 1.4 Clock arithmetic A quick example looking ahead to a simple use of modular arithmetic. When it s 11 o clock, and you want to know what time it will be 7 hours later, you don t simply add 7 to 11 to get 18 o clock. We do start with the 18, but then we subtract 12. More generally, if you wanted to know what time it will be 70 hours later, you d add 70 to 11, get 81, and keep subtracting 12 s (six times, as it turns out) until you are left with 9, so it will be 9 o clock (some days later). In modular arithmetic, using notation we ll get to soon, you are computing 11 + 70 9 (mod 12). Note that here, we are using the function idea of modular arithmetic. Also note that if you are computing on military time, just replace all the 12 s by 24 s. 2

2 Definitions Now let s take some of these ideas and make them more precise. 2.1 Sorting; equivalence relation The idea is that we want to say that a and b are equivalent when they leave the same remainder upon division by m. Say this remainder is r. Then a = ms + r b = mt + r for some integers s and t. Subtracting the second equation from the first, we get a b = m(s t), which leads to what turns out to be a useful form of the definition of this equivalence: a b (mod m) when a b is a multiple of m. (The advantage of this form is that it only involves a, b, m, and does not need to mention r.) We say a is congruent to b mod m. We call an equivalence relation because it satisfies the following three rules: a a (mod m) if a b (mod m), then b a (mod m) if a b (mod m) and b c (mod m), then a c (mod m). 2.2 Remainders; binary operation Most computer programs are like Mathematica in using mod as a function, not a relation: In[1] := Mod[81, 12] Out[1] = 9 The output is 9 because when 81 is divided by 12, the remainder is 9. Note that this means 81 9 (mod 12). The difference is that, while 81 is congruent to many numbers (mod 12), the Mod function returns only the special number, 9, from this class that is the unique remainder when you divide by 12. 3

3 Modular arithmetic What makes these ideas valuable is how congruence behaves nicely with respect to addition, subtraction, and multiplication (division is a little harder, and beyond the scope of these notes). In short, if then, as we d hope, a b (mod m) c d (mod m) a + c b + d (mod m) a c b d (mod m) a c b d (mod m) Note how, in the special case m = 10, this just confirms last-digit arithmetic. For instance, 17 7 (mod 10) and 23 3 (mod 10), so 17 23 7 3 = 21 1 (mod 10), which is just a fancy way of saying that the last digit of 17 23 is 1 because the last digit of 7 3 is 1. We now sketch the details of why these arithmetic facts are true. 3.1 Addition Since a b (mod m) and c d (mod m), we know that a b and c d are multiples of m, so a b = ms and c d = mt for some integers s and t. Then (a + c) (b + d) = (a b) + (c d) = ms + mt = m(s + t), so a + c b + d (mod m), since (a + c) (b + d) is a multiple of m. 3.2 Subtraction This is entirely similar to addition, and so the details are left to you to work out. 4

3.3 Multiplication Since a b (mod m) and c d (mod m), we know that a b and c d are multiples of m, so a b = ms and c d = mt for some integers s and t. We can rewrite these two equations as a = ms + b and c = mt + d. Then ac bd = (ms + b)(mt + d) bd = (m 2 st + dms + bmt + bd) bd = m(mst + ds + bt) + bd bd = m(mst + ds + bt), so ac bd (mod m), since ac bd is a multiple of m. 5