CSE 20 DISCRETE MATH. Fall

Similar documents
CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter

CHAPTER 3. Congruences. Congruence: definitions and properties

Relations. Binary Relation. Let A and B be sets. A (binary) relation from A to B is a subset of A B. Notation. Let R A B be a relation from A to B.

3.7 Non-linear Diophantine Equations

Math 109 HW 9 Solutions

Part V. Chapter 19. Congruence of integers

14 Equivalence Relations

Integers and Division

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

CSE 20 DISCRETE MATH WINTER

4. Congruence Classes

Orders and Equivalences

Relations. Relations. Definition. Let A and B be sets.

CSE 20 DISCRETE MATH WINTER

CSE 20 DISCRETE MATH SPRING

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

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

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3

Chapter 3 Basic Number Theory

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

Well-Ordering Principle. Axiom: Every nonempty subset of Z + has a least element. That is, if S Z + and S, then S has a smallest element.

CSE 20 DISCRETE MATH. Winter

3.2 Solving linear congruences. v3

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

CSE 20: Discrete Mathematics

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

CSE 20 DISCRETE MATH. Fall

Notes on Sets, Relations and Functions

Modular Arithmetic Instructor: Marizza Bailey Name:

Wilson s Theorem and Fermat s Little Theorem

Section 0. Sets and Relations

Mathematics 220 Homework 4 - Solutions. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B.

Math 421, Homework #6 Solutions. (1) Let E R n Show that = (E c ) o, i.e. the complement of the closure is the interior of the complement.

Fermat's Little Theorem

Chapter 1 : The language of mathematics.

9 RELATIONS. 9.1 Reflexive, symmetric and transitive relations. MATH Foundations of Pure Mathematics

MAT246H1S - Concepts In Abstract Mathematics. Solutions to Term Test 1 - February 1, 2018

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

1 Partitions and Equivalence Relations

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

The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.

MATH 215 Final. M4. For all a, b in Z, a b = b a.

D-MATH Algebra I HS18 Prof. Rahul Pandharipande. Solution 1. Arithmetic, Zorn s Lemma.

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

CSE 20 DISCRETE MATH SPRING

Chapter 2 - Relations

7. Prime Numbers Part VI of PJE

Math 109 September 1, 2016

5. Partitions and Relations Ch.22 of PJE.

1.4 Equivalence Relations and Partitions

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

CSE 311: Foundations of Computing. Lecture 10: Set Operations & Representation, Modular Arithmetic

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

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

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Part IA Numbers and Sets

Math 370 Homework 2, Fall 2009

MATH 2200 Final Review

CSE 20 DISCRETE MATH. Winter

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 420 FINAL EXAM J. Beachy, 5/7/97

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?

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

CSE 20 DISCRETE MATH. Fall

Tomáš Madaras Congruence classes

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

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

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

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

MATH 310: Homework 7

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

Johns Hopkins Math Tournament 2018 Proof Round: Sequences

3 The fundamentals: Algorithms, the integers, and matrices

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?

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

CSE 20 DISCRETE MATH. Winter

Reading 11 : Relations and Functions

MATH 363: Discrete Mathematics

Discrete Mathematics and Probability Theory Summer 2017 Course Notes Note 6

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Complete Induction and the Well- Ordering Principle

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

ELEMENTS OF NUMBER THEORY

Congruence Classes. Number Theory Essentials. Modular Arithmetic Systems

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

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

The Real Number System

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

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Number Theory Homework.

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

RED. Name: Instructor: Pace Nielsen Math 290 Section 1: Winter 2014 Final Exam

Homework 7 Solutions, Math 55

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

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Chapter 9: Relations Relations

Discrete Mathematics with Applications MATH236

CSE 311: Foundations of Computing. Lecture 10: Set Operations & Representation, Modular Arithmetic

Transcription:

CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/

Today's learning goals Determine whether a relation is an equivalence relation by determining whether it is Reflexive Symmetric Transitive Represent equivalence relations as partitions and vice versa Define and use the congruence modulo m equivalence relation

Cardinality recap {0,1} {a,b} {0,1}* {1} { Empty set } {a} N Q Z P(P((N)) Empty set Z + x Z + R (0,1) P(N)

Binary relations Rosen Ch 9 p. 573 P({a,b}) P({a,b}) { 1, 2, 4, 8 } { 1, 2, 4, 8 } Student Last Name Major empty set {a} empty set {a} 1 1 1 2 1 4 Ackermann Guo Math-CS Cog Sci {a} {b} {b} {a,b} {b} {a} {b} {a,b} 1 8 2 2 2 4 2 8 4 4 Kumar Yau Yau CS Economic s CS 4 8 8 8

Relations, more generally Rosen Sections 9.1, 9.3 (second half), 9.5 Let A be a set. Binary relation on A is (any) subset of A x A. How to visualize / represent?

Relations, more generally Rosen Sections 9.1, 9.3 (second half), 9.5 Let A be a set. Binary relation on A is (any) subset of A x A. Examples A = Z R 1 ={(x,y) x < y} 1 R 1 2 not(2 R 1 1)

Relations, more generally Rosen Sections 9.1, 9.3 (second half), 9.5 Let A be a set. Binary relation on A is (any) subset of A x A. Examples A = {0,1}* R 2 ={(w, u) l(w) = l(u)} 10 R 2 00 not(0 R 2 10)

Relations, more generally Rosen Sections 9.1, 9.3 (second half), 9.5 Let A be a set. Binary relation on A is (any) subset of A x A. Examples A = {0,1,2} R 3 ={(0,0), (0,2), (2,0)} 0 R 3 2 not (0 R 3 1)

Equivalence relations Rosen p. 608 Group together "similar" objects

Equivalence relations Rosen p. 608 Partition S into equivalence classes, each of which consists of "similar" elements: collection of disjoint, nonempty subsets that have S as their union x,y both in A i iff x and y are "similar"

Relation on a set A Rosen pp 576-578 A relation R is called reflexive iff symmetric iff transitive iff

Relation on a set A Rosen pp 576-578 A relation R is called reflexive iff R 1 = {(x,y) x < y} on A = Z R 2 = {(w, u) l(w) = l(u)} on A = {0,1}* R 3 = {(0,0), (0,2), (2,0)} on A = {0,1,2} Which of these relations is reflexive? A. All of them B. Just R 1 C. R 2 and R 3 D. Some other combination

Relation on a set A Rosen pp 576-578 A relation R is called symmetric iff R 1 = {(x,y) x < y} on A = Z R 2 = {(w, u) l(w) = l(u)} on A = {0,1}* R 3 = {(0,0), (0,2), (2,0)} on A = {0,1,2} Which of these relations is symmetric? A. All of them B. Just R 1 C. R 2 and R 3 D. Some other combination

Relation on a set A Rosen pp 576-578 A relation R is called transitive iff R 1 = {(x,y) x < y} on A = Z R 2 = {(w, u) l(w) = l(u)} on A = {0,1}* R 3 = {(0,0), (0,2), (2,0)} on A = {0,1,2} Which of these relations is transitive? A. All of them B. Just R 1 C. R 2 and R 3 D. Some other combination

Equivalence relations Rosen p. 608 Two formulations A relation R on set S is an equivalence relation if it is reflexive, symmetric, and transitive. x R y iff x and y are "similar" Partition S into equivalence classes, each of which consists of "similar" elements: collection of disjoint, nonempty subsets that have S as their union x,y both in A i iff x and y are "similar"

Equivalence classes Rosen p. 612 Given an equivalence relation R on set S, for a in S, the equivalence of class of a is [a] R = {s (a,s) is in R} Theorem 1: Let R be an equivalence relation on a set A. For elements a,b of A i. a R b iff ii. [a] = [b] iff iii. [a] [b] is nonempty.

Relation to classes Rosen p. 608 Given a relation R on set S, its equivalence classes are the sets [a] R = {s (a,s) is in R} Example R={(w, u) l(w) = l(u)} on S = {0,1}* [0] R = {0,1} = [1] R [00] R = {00,01,10,11} = [01] R= = [10] R= = [11] R etc.

Partition to relation Rosen p. 608 The set of integers can be partitioned into four sets {0, 4, 8, 12,, -4, -8, -12, } {1, 5, 9, 13,, -3, -7, -11, } {2, 6, 10, 14,, -2, -6, -10, } {3, 7, 11, 15,, -1, -5, -9, } What equivalence relation on Z has these sets as its equivalence classes? A. xry iff x mod y = 4 B. xry iff x mod 4 = y mod 4 C. xry iff x div 4 = y D. xry iff x div 4 = y div 4 E. None of the above

*The* example Rosen p. 240 For a,b in Z and m in Z + we say a is congruent to b mod m iff m (a-b) i.e. and in this case, we write Which of the following is true? A. B. C. D. E. None of the above.

*The* example Rosen p. 240 Claim: Congruence mod m is an equivalence relation Proof: Reflexive? Symmetric? Transitive?

*The* example Rosen p. 240 Claim: Congruence mod m is an equivalence relation Congruence classes: [a] m = {s (a,s) is in R} = {s a mod m = s mod m} What partition of the integers is associated with this equivalence relation? E.g. m=6 [0] 6 = { s : } {0, 6, 12, 18, 24, } {3, 9, 15, 21, 27, } {1, 7, 13, 19, 25, } {4, 10, 16, 22, 28, } {2, 8, 14, 20, 26, } {5, 11, 17, 23, 29, }

Arithmetic modulo m Rosen p. 242-243 (a+b) mod m = ( (a mod m) + (b mod m) ) mod m ab mod m = ((a mod m) (b mod m)) mod m Modular addition and multiplication are well-defined on equivalence classes! + 0 1 2 0 0 1 2 1 1 2 0 2 2 0 1. 0 1 2 0 0 0 0 1 0 1 2 2 0 2 1

Application 1: Last digit What's the last digit of 2017 2017? A. 1 B. 3 C. 9 D. 7 E. Can't tell without a calculator. Last digit of decimal representation of n is n mod 10

Modular operations We saw that, for all integers a,b and all positive integers m, (a+b) mod m = ( (a mod m) + (b mod m) ) mod m ab mod m = ((a mod m) (b mod m)) mod m Which of the following is also true? A. (a-b) mod m = ( (a mod m) - (b mod m) ) mod m B. (a/b) mod m = ( (a mod m) / (b mod m) ) mod m C. a b mod m = ( (a mod m) (b mod m) ) mod m D. More than one of the above. E. None of the above.

Modular operations (a-b) mod m = ( (a mod m) - (b mod m) ) mod m (-b) mod m = (m-b) mod m (a/b) mod m = ( (a mod m) / (b mod m) ) mod m Counterexample: a = 16, b = 8, m = 10 a b mod m = ( (a mod m) (b mod m) ) mod m Counterexample: a = 2, b= 10, m = 10

Application 2: Proof by cases Claim: The square of each integer is either divisible by 4 or has remainder 1 upon division by 4. Proof: Induction? Contradiction? Exhaustive?

Application 2: Proof by cases Claim: The square of each integer is either divisible by 4 or has remainder 1 upon division by 4. Proof: Let n be an integer and consider its remainder upon division by r. Four cases: remainder is 0, 1, 2, or 3.

Application 3: Pseudorandom generators Rosen p. 288 x n+1 = (ax n +c) mod m Parameters: - modulus m - multiplier a (2 <= a < m) - increment c (0 <= c < m) - seed x 0 (0 <=x 0 < m) What's the maximum number of terms before the sequence starts to repeat? A. m B. a C. c D. x 0 E. Depends on the parameters; maybe never!

Application 3: Pseudorandom generators x n+1 = (ax n +c) mod m Parameters: - modulus m - multiplier a (2 <= a < m) - increment c (0 <= c < m) - seed x 0 (0 <=x 0 < m) m=8, a=5, c=1, x 0 =1 m=8, a=5, c=4, x 0 =1 1, 6, 7, 4, 5, 2, 3, 0, 1, 6, 7, 4, 5, 2, 3, 1, 1, 1, 1, 1,