Discrete Mathematics I Lectures Chapter 6

Slides:



Advertisements
Similar presentations
Fall 2002CMSC Discrete Structures1 … and now for something completely different… Set Theory Actually, you will see that logic and set theory are.
Advertisements

Prof. Johnnie Baker Module Basic Structures: Sets
Sets Lecture 11: Oct 24 AB C. This Lecture We will first introduce some basic set theory before we do counting. Basic Definitions Operations on Sets Set.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Instructor: Hayk Melikya
(CSC 102) Discrete Structures Lecture 14.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built.
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
Denoting the beginning
Analytical Methods in CS (CIS 505)
Sets Definition of a Set: NAME = {list of elements or description of elements} i.e. B = {1,2,3} or C = {x  Z + | -4 < x < 4} Axiom of Extension: A set.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
EE1J2 – Discrete Maths Lecture 7
Sets 1.
Sets 1.
February 5, 2015Applied Discrete Mathematics Week 1: Logic and Sets 1 Homework Solution PQ  (P  Q) (  P)  (  Q)  (P  Q)  (  P)  (  Q) truetruefalsefalsetrue.
Sets.
This section will discuss the symbolism and concepts of set theory
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
2.1 – Sets. Examples: Set-Builder Notation Using Set-Builder Notation to Make Domains Explicit Examples.
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Sets Defined A set is an object defined as a collection of other distinct objects, known as elements of the set The elements of a set can be anything:
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Chapter 7 Logic, Sets, and Counting Section 2 Sets.
Discrete Structure Sets. 2 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element.
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
January 30, 2002Applied Discrete Mathematics Week 1: Logic and Sets 1 Let’s Talk About Logic Logic is a system based on propositions.Logic is a system.
1. Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element of A” A = {a 1, a 2,
CompSci 102 Discrete Math for Computer Science
Copyright © Cengage Learning. All rights reserved.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
Week 6 - Friday.  What did we talk about last time?  Solving recurrence relations.
ELEMENTARY SET THEORY.
Chapter 2 With Question/Answer Animations. Section 2.1.
12/19/20151 … and now for something completely different… Set Theory Actually, you will see that logic and set theory are very closely related.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Discrete Mathematics Set.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
1 Set Theory Second Part. 2 Disjoint Set let A and B be a set. the two sets are called disjoint if their intersection is an empty set. Intersection of.
Notions & Notations (2) - 1ICOM 4075 (Spring 2010) UPRM Department of Electrical and Computer Engineering University of Puerto Rico at Mayagüez Spring.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
Thinking Mathematically Venn Diagrams and Set Operations.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Set. Outline Universal Set Venn Diagram Operations on Sets.
Applied Discrete Mathematics Week 1: Logic and Sets
Chapter 2 Sets and Functions.
The Language of Sets If S is a set, then
Set, Combinatorics, Probability & Number Theory
Sets Section 2.1.
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
Chapter 5, Set Theory 1.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
… and now for something completely different…
Exercises Show that (P  Q)  (P)  (Q)
CS100: Discrete structures
Set Theory A B C.
Applied Discrete Mathematics Week 2: Proofs
Discrete Mathematics CS 2610
Chapter 7 Logic, Sets, and Counting
… and now for something completely different…
Lecture Sets 2.2 Set Operations.
Presentation transcript:

Discrete Mathematics I Lectures Chapter 6 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco Dr. Adam Anthony Spring 2011

… and now for something completely different… Set Theory Actually, you will see that logic and set theory are very closely related.

Set Theory Set: Collection of objects (“elements”) aA “a is an element of A” “a is a member of A” aA “a is not an element of A” A = {a1, a2, …, an} “A contains…” Order of elements is meaningless It does not matter how often the same element is listed – repeats are OK!.

Set Equality Sets A and B are equal if and only if they contain exactly the same elements. Examples: A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = B A = {dog, cat, horse}, B = {cat, horse, squirrel, dog} : A  B A = {dog, cat, horse}, B = {cat, horse, dog, dog} : A = B

Examples for Sets “Standard” Sets: Natural numbers N = {0, 1, 2, 3, …} Integers Z = {…, -2, -1, 0, 1, 2, …} Positive Integers Z+ = {1, 2, 3, 4, …} Real Numbers R = {47.3, -12, , …} Rational Numbers Q = {1.5, 2.6, -3.8, 15, …} (correct definition will follow)

Examples for Sets A =  “empty set/null set” A = {z} Note: zA, but z  {z} A = {{b, c}, {c, x, d}} A = {{x, y}} Note: {x, y} A, but {x, y}  {{x, y}} A = {x | P(x)} “set of all x such that P(x)” A = {x | xN  x > 7} = {8, 9, 10, …} “set builder notation”

Examples for Sets We are now able to define the set of rational numbers Q: Q = {a/b | aZ  bZ+} or Q = {a/b | aZ  bZ  b0} And how about the set of real numbers R? R = {r | r is a real number} That is the best we can do.

Exercise 1 What are the members of the following sets? A = {x| x  R  x2 = 5} B = {n | n  Z  n  2} Use set-builder notation to describe the following sets: The set of all positive integers that are divisible by 3 The set of all animals with black and white stripes

Why Sets? Sets add another layer of notational convenience Call it Logic 3.0! We can use sets to simplify logic expressions Let BW = {x | x is an animal and x has black and white stripes} All animals with black and white stripes are easy to see  a  BW, easy-to-see(a) There exists an animal without black and white stripes that is easy to see aBW, easy-to-see(a)

Subsets A  B “A is a subset of B” A  B if and only if every element of A is also an element of B. We can completely formalize this: A  B  x (xA  xB) Examples: A = {3, 9}, B = {5, 9, 1, 3}, A  B ? true A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A  B ? true A = {1, 2, 3}, B = {2, 3, 4}, A  B ? false

Subsets Useful rules: A = B  (A  B)  (B  A) (A  B)  (B  C)  A  C (see Venn Diagram) U C B A

Subsets Useful rules:   A for any set A A  A for any set A Proper subsets: A  B “A is a proper subset of B” A  B  x (xA  xB)  x (xB  xA) or A  B  x (xA  xB)  x (xB  xA)

Exercise 2 Is A  B? Is A  D? Is C  A? Is D  A? Is A = C? Is A = D? Let A = {1,3,4}, B = {1,2,4}, C = {4,3,1,1}, D = {1,2,3,4} Is 3A? Is {3}  A? Is {3}  A? Is 3  A? Is 3  B? Is 3  B? Is A  B? Is A  D? Is C  A? Is D  A? Is A = C? Is A = D?

Exercise 3 Let A = {a | a  Z    a  -3}, B = {b | b  Z  bk = 5 for some k  Z+}, C = {c | c  Z  c is prime  7 < c < 10} Describe A, B and C by listing their elements Is B  A? Is A  B? Is C  A?

Cardinality of Sets If a set S contains n distinct elements, nN, we call S a finite set with cardinality n. Examples: A = {Mercedes, BMW, Porsche}, |A| = 3 B = {1, {2, 3}, {4, 5}, 6} |B| = 4 C =  |C| = 0 D = { xN | x  7000 } |D| = 7001 E = { xN | x  7000 } E is infinite!

The Power Set (A) “power set of A” (A) = {B | B  A} (contains all subsets of A) Examples: A = {x, y, z} (A) = {, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}} A =  (A) = {} Note: |A| = 0, | (A)| = 1

The Power Set Cardinality of power sets: | (A) | = 2|A| Imagine each element in A has an “on/off” switch Each possible switch configuration in A corresponds to one element in 2A z y x 8 7 6 5 4 3 2 1 A For 3 elements in A, there are 222 = 8 elements in P(A)

Exercise 4 Find the power sets ({1,2}) and ({1,2,3})

Ordered Pairs We are familiar with ordered pairs in algebra when we plot on a Cartesian coordinate system: The pair (x,y) is ordered so that we know how to plot it on the axes Important: (a,b) = (c,d)  a = c and b = d The order matters! (x,y)

Cartesian Product The ordered n-tuple (a1, a2, a3, …, an) is an ordered collection of objects. Just a general version of the ordered pair: Two ordered n-tuples (a1, a2, a3, …, an) and (b1, b2, b3, …, bn) are equal if and only if they contain exactly the same elements in the same order, i.e. ai = bi for 1  i  n. The Cartesian product of two sets is defined as: AB = {(a, b) | aA  bB} Example: A = {x, y}, B = {a, b, c} AB = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}

Cartesian Product The Cartesian product of two sets is defined as: AB = {(a, b) | aA  bB} Example: A = {good, bad}, B = {student, prof} AB = { (good, student), (good, prof), (bad, student), (bad, prof)} BA = { (student, good), (prof, good), (student, bad), (prof, bad)}

Cartesian Product Note that: A =  A =  For non-empty sets A and B: AB  AB  BA |AB| = |A||B| The Cartesian product of two or more sets is defined as: A1A2…An = {(a1, a2, …, an) | aiA for 1  i  n}

Set Operations Union: AB = {x | xA  xB} Example: A = {a, b}, B = {b, c, d} AB = {a, b, c, d} Intersection: AB = {x | xA  xB} AB = {b}

Set Operations Two sets are called disjoint if their intersection is empty, that is, they share no elements: AB =  If a set C = A  B and A and B are disjoint, then the set P = {A,B} is referred to as a partition of C The difference between two sets A and B contains exactly those elements of A that are not in B: A-B = {x | xA  xB} Example: A = {a, b}, B = {b, c, d}, A-B = {a}

Set Operations Given a Universe identified by the set U, the complement of a set A contains exactly those elements under consideration that are not in A: Ac = U-A Example: U = N, B = {250, 251, 252, …} Bc = {0, 1, 2, …, 248, 249}

Exercise 5 Let the Universe U = {0,1,2,3,…,9} and: A = {0,2,4,6,8} B = {1, 2, 4, 7} C = {1,5,7} Find the following: A  B A  B Bc A - B (A  B)c A  (B  C) (A  B)  C Ac  Bc

Exercise 6 Let A = {1,2,3,4,5,6,7} Which collections form a partition of A? P1 = {1,3}, {2,5}, {4,6,7} P2 ={1}, {2,4,6}, {3,5} P3 ={1,3,5,7}, {2,4,6}, {3,6} Let B = {x | x  R  x  -2 }, C = {x | x  R  -2 < x  4}, D = {x | x  R  x > 4} Is P4 = {B,C,D} a partition of R?

Venn Diagrams of Operations NOTE: The amount that A and B overlap is not always guaranteed A B

Venn Diagrams of Operations B

Venn Diagrams of Operations B A B

Venn Diagrams of Operations A  B A B

Venn Diagrams of Operations A  B

Venn Diagrams of Operations A - B

Venn Diagrams of Operations Ac

Exercise 7 Draw a Venn Diagram to represent the following expressions over the sets A,B and C: A  B =  A  B = A and C  B C  A  B Ac – C A  B   and A  C   and B  C   BUT A  B  C  

Section 6.2,6.3: Properties of Sets Unifying Logic and Sets Proofs with sets Set identities

Logic and Sets We can interpret our set operations logically: A  B  x  A  x  B (Set-based implication) A  B  x  A  x  B (Set-based OR) A  B  x  A  x  B (Set-based AND) x  Ac x  A (Set-based Negation) A – B  x  A  x  B (NEW expressive power!) (x,y)  A x B  x  A  y  B (NEW expressive power!)

Element Arguments Prove that for all sets A and B, A  B  A Normal starting Point: “Suppose A and B are arbitrarily chosen sets” Where does this get us? We make more progress using an ‘element argument’: Note that A  B  A translates to “If x  A  B then x  A” From this, we get the statement: “Suppose A and B are arbitrarily chosen sets and x  A  B” Idea: focusing on a single arbitrary element in a set lets us prove something about every single element in the set!

Transitivity Revisited Prove, using logical interpretations, the transitive property for subsets: For all sets A, B and C, if A  B and B  C, then A  C.

Proving Equality How can we Prove A(BC) = (AB)(AC)? Recall: A = B  A  B  B  A To prove A = B, you must show both subset claims are true So an equality proof really requires 2 element proofs!

Prove A(BC) = (AB)(AC). Prove that A(BC)  (AB)(AC): Suppose that x is an arbitrarily chosen element of A(BC). There are 2 cases for x: x  A or x  (BC) Case 1: x  A Since x  A, by definition of union, x  (A  B) and x  (A  C). Therefore, by definition, x  (AB)(AC). Case 2: x  (BC). By definition of intersection, x  B and x  C. By definition of union, x  (AB) and x  (AC). Therefore, by definition of intersection, x  (AB)(AC)

Prove A(BC) = (AB)(AC). Prove that (AB)(AC)  A(BC) Drawing a Venn diagram might help us think this through… Suppose that x is an arbitrarily chosen element of (AB)(AC). We’ll analyze this one element in two cases: x  A and x  A. Case 1: x  A It immediately follows that x  A(BC) by definition of union. Case 2: x  A Since x  (AB)(AC), it must be true that x  (AB) and x  (AC). Since x  A in this case, it must follow that x  B and x  C or else x would not be a member of (AB)(AC). Therefore, by definition of intersection, x  (BC) and by definition of Union, x  A(BC)

OR…Use logic instead! How can we prove A(BC) = (AB)(AC)? Suppose x is an arbitrary element of A(BC). Then by definition, the following statements are true: x(A(BC)) (xA)  (x(BC)) (xA)  (xB  xC) (xA  xB)  (xA  xC) (distributive law for logical expressions) (x(AB))  (x(AC)) x((AB)(AC)) Since each statement is a biconditional with the one before it, x(A(BC))  x((AB)(AC)) and x((AB)(AC))  x(A(BC)) . So by definition, (A(BC))  ((AB)(AC)) and ((AB)(AC))  (A(BC)). Therefore, A(BC) = (AB)(AC)

Which method to use? You may use an element argument or logic conversions to prove set identities on assignments and exams Which one you choose depends on your strengths Neither approach is ‘easier’ than the other Element arguments provide more direction about where you’re headed Logic arguments have less direction, but tend to be more concise

Set Identities—Look Familiar?

Exercise 1 Use Venn Diagrams to verify the following set-theoretic DeMorgan’s law: (A  B)c = Ac  Bc

Exercise 2 Recall that two sets are disjoint if their intersection is the empty set (A  B = ). Draw venn diagrams for the sets A – B and B – A Use Theorem 6.2.2 to construct a proof that A – B and B – A are disjoint

Exercise 3 Use Theorem 6.2.2 to prove the following: (A  (B  C)  ((A  B) – C) = A  B

A Technology Tie-In Sailors Don’t forget your set theory—You’ll use it in Databases! Each ‘table’ in a database is called a relation, filled with tuples Database theory says that a relation is actually a subset of the universe of all possible tuples Sailors

A Technology Tie-In SQL (structured query language): Select SID, SNAME, RATING, AGE FROM SAILORS WHERE AGE > 40 S = {X  SAILORS | AGE > 40} See the similarity? Remembering set-theory will really help you work with databases Sailors