MATH 224 – Discrete Mathematics

Slides:



Advertisements
Similar presentations
Cryptography and Network Security
Advertisements

Section 4.1: Primes, Factorization, and the Euclidean Algorithm Practice HW (not to hand in) From Barr Text p. 160 # 6, 7, 8, 11, 12, 13.
The Integers and Division. Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest.
22C:19 Discrete Structures Integers and Modular Arithmetic
BY : Darshana Chaturvedi.  INTRODUCTION  RSA ALGORITHM  EXAMPLES  RSA IS EFFECTIVE  FERMAT’S LITTLE THEOREM  EUCLID’S ALGORITHM  REFERENCES.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
CSE115/ENGR160 Discrete Mathematics 03/13/12 Ming-Hsuan Yang UC Merced 1.
Number Theory and Cryptography
CSE115/ENGR160 Discrete Mathematics 03/17/11 Ming-Hsuan Yang UC Merced 1.
Introduction to Programming with Java, for Beginners
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
1 Integers and Division CS/APMA 202 Rosen section 2.4 Aaron Bloomfield.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 2): The Fundamentals: Algorithms, the.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Numbering systems.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 3): The Fundamentals: Algorithms, the.
Mathematics of Cryptography Part I: Modular Arithmetic
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
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.
Numeral Systems Subjects: Numeral System Positional systems Decimal
RSA and its Mathematics Behind
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Integer Representation for People Computer Organization and Assembly Language: Module 3.
Implementing RSA Encryption in Java
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Number systems, Operations, and Codes
Elements of Coding and Encryption Continuation 1.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Chapter 28 Number.
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
RSA and its Mathematics Behind July Topics  Modular Arithmetic  Greatest Common Divisor  Euler’s Identity  RSA algorithm  Security in RSA.
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
Chapter 2 (Part 1): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 2.4)
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Module #9 – Number Theory 1/5/ Algorithms, The Integers and Matrices.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
AF2. Turn off your phones Primes, gcd, some examples, reading.
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
Discrete Mathematics
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Slide Copyright © 2009 Pearson Education, Inc. Slide Copyright © 2009 Pearson Education, Inc. Chapter 1 Number Theory and the Real Number System.
CSE 311 Foundations of Computing I Lecture 12 Modular Arithmetic and Applications Autumn 2012 CSE
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
CS 2210:0001Discrete Structures Modular Arithmetic and Cryptography
CMSC Discrete Structures
CSE 504 Discrete Mathematics & Foundations of Computer Science
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Foundations of Discrete Mathematics
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Number Theory.
Divisibility and Modular Arithmetic
Presentation transcript:

MATH 224 – Discrete Mathematics Integers and Computers Integers and number theory are important building blocks for computer science. (Number theory deals with the properties of integers.) Why are integers so important in computer science? Consider the memory of a computer. What does it store? Just sequences of zeros and ones. When put all together the total memory may be interpreted as one large binary integer. How are integers most commonly represented in memory? What is the 32 bit representation of 500? What is the 32 bit representation of -500? 4/21/2017

MATH 224 – Discrete Mathematics Integers and Computers How are letters (characters) stored inside a computer’s memory? How are floating point numbers (i.e. numbers with fractional parts) stored? How are text files; Word documents; C++ programs; and machine instructions stored in memory? At the lowest level, digital computers can only work with numbers. How is audio stored with integers? How are photographs stored with integers? Can color be represented by an integer? How are videos stored as integers? 4/21/2017

MATH 224 – Discrete Mathematics Integer Terminology Integers may be classified as either prime numbers or composite numbers. What is a prime number, and what is a composite number? The following is often referred to as the Fundamental Theorem of Arithmetic. Every positive integer larger than 1 may be expressed as a single prime number or a unique product of primes. This product is called the prime factorization of an integer. Those numbers that are not primes, having two or more primes in their prime factorization, are called composite numbers. What about negative integers less than 1. Do they have a unique prime factorization? Is there a way to make the factorization unique? 4/21/2017

MATH 224 – Discrete Mathematics Division Algorithm (uniqueness of modulus) The so called division algorithm is not really an algorithm, but instead states a property of integers. It states that when an integer a is divided by a positive integer d, the non-negative remainder r is unique. Note that d may not be equal to zero and r is restricted to a value 0 ≤ r < d. What if d is negative? Also note that r = a modulus d or in C++, r = = a % d. If d is a divisor of a what is the value of a % d? 4/21/2017

MATH 224 – Discrete Mathematics Other Important Terminology Greatest common divisor: Given two integers, the largest number that divides both evenly is called the greatest common divisor. Give an example of the use of the greatest common divisor. Relatively prime: Two numbers that do not have any common divisor other than 1 are said to be relatively prime. Least common multiple: Given two integers, the smallest number that is divisible by both of the integers is called the least common multiple. Give an example of the use of the least common multiple. 4/21/2017

MATH 224 – Discrete Mathematics Modular Arithmetic (the % operator in C++) Modular Arithmetic deals with the remainder when one integer is divided by another. So for example 12 ≡ 5 mod 7. Or in C++ (12 % 7 = = 5) is a true proposition. There is an entire theory built on the modulus operator. In fact a set of values modulus a prime number is sometimes called a field under the operations of addition and multiplication. For example 5*3 ≡ 1 mod 7, which implies that 3 is equivalent to 1/5 in arithmetic modulo 7, and is called the multiplicative inverse. What is the multiplicative inverse of 4 in mod 7 arithmetic? And 5 + 2 ≡ 0 mod 7, which implies that 2 is equivalent to –5 in arithmetic modulo 7. Thus 2 is the additive inverse of 5 in mod 7 arithmetic. 4/21/2017

MATH 224 – Discrete Mathematics Modular Arithmetic Applications in CS Some of these concepts related to modular arithmetic are used in CS. Modular arithmetic is used to specify negative integers in a way that makes computation easier for computers, In the area of security, modular arithmetic is used for encryption and authentication. What is encryption? Give an example of where it is used. Simple modular arithmetic is used to create hash tables for storing data such as the symbol table for a program in C++. Modular arithmetic is used to create circular arrays to implement queues. What is a circular array and what is a queue in computer science? Modular arithmetic is used to generate random numbers by most random number generators. These are called pseudo-random since they are not truly random. 4/21/2017

MATH 224 – Discrete Mathematics Integer Representation Using Base Two Why is base 2 used by most computers? Negative integers are represented using the twos complement of the positive number. For example, with an eight bit integer negative 32 corresponds to 224. Eight bit numbers are viewed as numbers mod 256 since the integers from 0 to 255 may be presented. Note that 32 + 224 % 256 = = 0. As binary numbers 32 is 0010 0000 and 224 is 1110 0000. Now if we add these together we have 0010 0000 +1110 0000 1 0000 0000 With eight bit numbers the one on the left is just dropped. To make this work all integers with a leading one are interpreted as negative numbers. Why does mod 256 not work for the multiplicative inverse? 4/21/2017

MATH 224 – Discrete Mathematics Integer Representation Using Octal and Hexadecimal For humans it is often easier to work with either octal, base 8, or hexadecimal, base 16 numbers. Every digit of an octal number represents three bits in a binary representation and every bit of a hexadecimal representation represents four bits in a binary representation. Can you explain why these statements are true? For example the binary number 0101 0001 has the hexadecimal representation of 5116, and 1111 1011 has hexadecimal representation FB16 . What are these numbers in decimal? Finally, how are floating point numbers represented? If binary is used to represent them? In what way does it make sense to say that they look like integers in memory? 4/21/2017

MATH 224 – Discrete Mathematics The Euclidean Algorithm for the GCD The Euclidean Algorithm is named after the Greek mathematician Euclid who is most well know for his axioms of plane geometry. Euclid’s algorithm finds, the greatest common divisor for two positive integers. Below is a version of this algorithm in C++ int function gcd (int a, int b) { int x = a, y = b, r; while (!(y = = 0)) { r = x % y; x = y; y = r } return x; } // end gcd Lets apply this function to 60 and 210. What happens to the values of x and y after the first pass through the while loop? 4/21/2017

MATH 224 – Discrete Mathematics Public Key Encryption Using RSA One of the most significant uses of modular arithmetic is encrypting messages so that only the person having a special key is able to determine the original message. Below are the basic steps of the RSA algorithm. First everyone has the following information. An integer n = pq where p and q are very large prime numbers, but only the value of n is know by everyone. An integer e that is relatively prime to (p−1)(q−1) Second only the person receiving the message has the values of p and q. If p and q are very large, even with a very fast computer it will take an extremely long time to compute them from the information provided. 4/21/2017

MATH 224 – Discrete Mathematics Public Key Encryption Using RSA Now with the values of n and e, a message may be encrypted by converting the message to integers M, perhaps using ASCII. The integers are modified by means of the following formula. C = Me mod n Note that there are algorithms for doing modular exponentiation quickly. After the conversion the integers corresponding to C are sent. The receiver decrypts the message using the formula M = Cd mod n The value of d is the multiplicative inverse of e mod (p−1)(q−1). The value of d is not difficult to calculate if p and q are know, but the values of p−1 and q−1 are needed to find d. See the text for a proof that this actually works and an example of how these formulas are used. 4/21/2017