Modular Arithmetic ICS 6D Sandy Irani.

Slides:



Advertisements
Similar presentations
Mod arithmetic.
Advertisements

1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.
Finite Fields Rong-Jaye Chen. p2. Finite fields 1. Irreducible polynomial f(x)  K[x], f(x) has no proper divisors in K[x] Eg. f(x)=1+x+x 2 is irreducible.
Cryptography and Network Security
Chapter 4 Finite Fields. Introduction of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key concern operations on “numbers”
Cryptography and Network Security Chapter 4 Fourth Edition by William Stallings.
Chapter 4 – Finite Fields. Introduction will now introduce finite fields of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key.
Number Theory and Cryptography
Session 4 Asymmetric ciphers.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
3.Growth of Functions Hsu, Lih-Hsing.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
Chapter 4: Elementary Number Theory and Methods of Proof
CSE 504 Discrete Mathematics & Foundations of Computer Science
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
CPSC 3730 Cryptography and Network Security
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Copyright © Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory.
Chapter 3 Elementary Number Theory and Methods of Proof.
Monoids, Groups, Rings, Fields
Chapter The Integers and Division Division
Expressions, Equations, and Functions Chapter 1 Introductory terms and symbols: Variable – A letter or symbol to represent an unknown – Examples: Algebraic.
Chapter 4 – Finite Fields
Arithmetic in Pascal A Short Glance We will learn the followings in this chapter Arithmetic operators Order of precedence Assignment statements Arithmetic.
Rational Numbers and Fields
Chapter Integers and Algorithms Representations of integers
PSAT MATHEMATICS 9-A Basic Arithmetic Concepts. Set A collection of “things” that have been grouped together in some way. “things” – elements or members.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Chapter 13 Mathematic Structures 13.1 Modular Arithmetic Definition 1 (modulo). Let a be an integer and m be a positive integer. We denoted by a mod m.
1 CMSC 250 Chapter 3, Number Theory. 2 CMSC 250 Introductory number theory l A good proof should have: –a statement of what is to be proven –"Proof:"
Discrete Mathematics
Divisibility and Modular Arithmetic
Chapter 4 With Question/Answer Animations 1. Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their.
Sequences and Summations ICS 6D Prof. Sandy Irani.
Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.
Number-Theoretic Algorithms
Dividing a Polynomial by a Binomial
Properties of Real Numbers
Distributive Property
Integers and Division Section 3.4.
5.1 – Basic Properties & Reducing to Lowest Terms
Number Theory and Cryptography
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Assignment statement and Arithmetic operation 2
Applied Discrete Mathematics Week 3: Algorithms
Cryptography Lecture 22.
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Direct Proof and Counterexample IV
CSE 311: Foundations of Computing
Modular Arithmetic and Change of Base
Sequences & Modular Arithmetic
More Maths Programming Guides.
Modular Arithmetic and Elliptic Curves
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Section 10.3 Modular Arithmetic
Direct Proof and Counterexample IV
Quotient-Remainder Theorem
Lecture 5 Number Theory & Proof Methods
CLOCK ARITHMETIC.
Miniconference on the Mathematics of Computation
Cryptography Lecture 17.
Exercise Find the following products mentally. 5(20) 100 5(7) 35 5(27)
Cryptography Lecture 19.
SKILLS PRACTICE SHEET RULES OF ARITHMETIC
Section 9.3 Modular Arithmetic.
Properties and Algebraic Expressions
Presentation transcript:

Modular Arithmetic ICS 6D Sandy Irani

DIV and MOD functions d an integer d ≥ 1 n an integer There are unique integers q for “quotient” r for “remainder” Such that r ∈ {0, 1, 2,…,d-1} n = d·q + r

DIV and MOD functions for n < 0 q = floor(n/d) r = n - q·d Example: n = -25, d = 6

DIV and MOD functions for n < 0 q = floor(n/d) r = n - q·d Example n = -75, d = 12

DIV and MOD functions for n < 0 q = 0 while (r < 0) r = r + d q = q - 1 Example n = -25, d = 6

DIV and MOD functions for n < 0 q = 0 while (r < 0) r = r + d q = q -1 Example n = -75, d = 12

Modular Arithmetic “Mod n” is a function from ℤ to {0, 1, …, n-1} Addition mod n: (x + y) mod n Multiplication mod n: xy mod n

Modular Arithmetic In computing arithmetic expressions mod n, can compute partial results mod n and the result is the same: ((x mod n) + (y mod n)) mod n = (x + y) mod n (158 + 219) mod 5 = ((x mod n) · (y mod n)) mod n = (x · y) mod n (158 · 219) mod 5 =

Modular Arithmetic (3474 + 120) mod 11 (56·72 + 62) mod 7

Modular Arithmetic 210 mod 7 = (25 mod 7) (25 mod 7) mod 7

Modular Arithmetic Any multiple of n acts like 0 mod n:

Rings A ring is a closed mathematical system with addition and multiplication operations that Obeys certain laws (associative, distributive, etc.) Has identities: 0 + x = x 1·x = x The elements of a ring can be different kinds of objects: Polynomials, sequences, numbers, etc.

The ring ℤn The ring ℤn is the set {0, 1, 2, …, n-1} along with Addition mod n Multiplication mod n Example: ℤ5 + 0 1 2 3 4 x 0 1 2 3 4 01234 01234

Equivalence mod n x mod n = y mod n ↔ (x-y) = integer multiple of n ↔ x ≡ y mod n ↔ “x is equivalent to y mod n” Example: n = 5 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9