Module #3 - Sets 3/2/2016(c)2001-2003, Michael P. Frank 2. Sets and Set Operations.

Slides:



Advertisements
Similar presentations
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Advertisements

Prof. Johnnie Baker Module Basic Structures: Sets
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Discrete Structures & Algorithms Basics of Set Theory EECE 320 — UBC.
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.
2.1 Sets. DEFINITION 1 A set is an unordered collection of objects. DEFINITION 2 The objects in a set are called the elements, or members, of the set.
Denoting the beginning
1 Section 1.7 Set Operations. 2 Union The union of 2 sets A and B is the set containing elements found either in A, or in B, or in both The denotation.
1 Set Theory Rosen 6 th ed., § Introduction to Set Theory A set is a structure, representing an unordered collection (group, plurality) of zero.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Sets 1.
Sets 1.
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
SETS A set B is a collection of objects such that for every object X in the universe the statement: “X is a member of B” Is a proposition.
Mathematics.
Discrete Maths Objective to re-introduce basic set ideas, set operations, set identities , Semester 2, Set Basics 1.
Operations on Sets – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Operations on Sets Reading: Kolman, Section 1.2.
2.1 – Sets. Examples: Set-Builder Notation Using Set-Builder Notation to Make Domains Explicit Examples.
1 Sets CS 202, Spring 2007 Epp, chapter 5 Aaron Bloomfield.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
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)
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
Chapter 2 Section 1 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
ELEMENTARY SET THEORY.
Discrete Mathematical Structures 4 th Edition Kolman, Busby, Ross © 2000 by Prentice-Hall, Inc. ISBN
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 Basic Structure : Sets, Functions, Sequences, and Sums Sets Operations.
Chapter 2 With Question/Answer Animations. Section 2.1.
Introduction to Set theory. Ways of Describing Sets.
Discrete Mathematics SETS. What is a set? ^A set is a unordered collection of “objects”  People in a class: {A yşe, B arış, C anan }  Cities in Turkey.
12/19/20151 … and now for something completely different… Set Theory Actually, you will see that logic and set theory are very closely related.
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 Theory - Definitions and notation A set is an unordered collection of elements. Some examples: {1, 2, 3} is the set containing.
Discrete Mathematics CS 2610 January 27, part 2.
Discrete Mathematics Set.
1 Section 1.2 Sets A set is a collection of things. If S is a set and x is a member or element of S we write x  S. Othewise we write x  S. The set with.
Set Operations Section 2.2.
Fr: Discrete Mathematics by Washburn, Marlowe, and Ryan.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
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.
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)
CPCS 222 Discrete Structures I
Section 6.1 Set and Set Operations. Set: A set is a collection of objects/elements. Ex. A = {w, a, r, d} Sets are often named with capital letters. Order.
Dr. Ameria Eldosoky Discrete mathematics
Applied Discrete Mathematics Week 1: Logic and Sets
Set Definition: A set is unordered collection of objects.
Discrete Structures – CNS 2300
Discrete Mathematical The Set Theory
Set, Combinatorics, Probability & Number Theory
Sets Section 2.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 Rosen 6th ed., §
Set Operations Section 2.2.
Week #2 – 4/6 September 2002 Prof. Marie desJardins
Discrete Mathematics CS 2610
The aim of education is to teach students how to think rather than what to think. Sets The set is the fundamental discrete structure on which all other.
Discrete Mathematics R. Johnsonbaugh
… and now for something completely different…
Lecture Sets 2.2 Set Operations.
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Section 2.1: Sets Set is a collection of distinct unordered objects. Members of a set are called elements. For example:   A = {1, 3, 5, 7}; 3  A, 2  A   B = {Cat, Dog, Fox}   C = {x | x = n 2 + 1, n is an integer, 0 ≤ n ≤ 10}   D = {x | 1 ≤ x ≤ 4} = [1, 4]

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Basic Notations for Sets (1) listing all of its elements in curly braces: - Finite sets: V = {a, e, i, o, u} S = {1, 2, 3, …, 99} - Infinite sets: N = {0, 1, 2, …}, The set of natural numbers Z = {…, -2, -1, 0, 1, 2, …}, The set of integers Z + = {1, 2, 3, …}, The set of positive integers R = The set of real numbers

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Basic Notations for Sets (2) Set builder notation: For any proposition P(x) over any universe of discourse, {x | P(x)} is the set of all x such that P(x). Example “The set of all odd positive integers less than 10” O = {x | x is an odd positive integer and x < 10}

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Examples Use the set builder notation to describe the sets A = {1, 4, 9, 16, 25, …} B = {a, d, e, h, m, o} A = { x | x = n 2, n is positive integer} B = { x | x is a letter of the word mohamed}

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Basic Notations for Sets (3) Venn Diagrams U : universal set S John Venn

Module #3 - Sets 3/2/2016 Membership in Sets x  S : x is an element or member of the set S. e.g. 3  N “a”  {x | x is a letter of the alphabet} x  S :   (x  S) “x is not in S ”

Module #3 - Sets 3/2/2016(c) , Michael P. Frank The Empty Set  (null or the empty set) is the unique set that contains no elements.  = {} Empty set  does not equal the singleton set {  }  ≠ {  }

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Definition of Set Equality Two sets are declared to be equal if and only if they contain exactly the same elements. i.e. A and B are equal if and only if  x (x  A  x  B ) Example: (Order and repetition do not matter) {1, 3, 5} = {3, 5, 1} = {1, 3, 3, 3, 5, 5, 5}

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Subset Relation S  T (“S is a subset of T”) means that every element of S is also an element of T. S  T   x (x  S  x  T )   S S  S If S  T is true and T  S is true then S = T,  x (x  S  x  T) means  (S  T ), i.e.  x (x  S  x  T )

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Proper Subset S  T (S is a proper subset of T ) means every element of S is also an element of T, but S  T. S T Venn Diagram equivalent of S  T e.g. {1, 2}  {1, 2, 3}

Module #3 - Sets 3/2/ Sets Are Objects, Too! The objects that are elements of a set may themselves be sets. e.g. let S = {x | x  {1,2,3}} then S = { , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} Note that 1  {1}  {{1}} !!!!

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Cardinality and Finiteness |S| or card(S) (read the cardinality of S ) is a measure of how many different elements S has. e.g. |  | = |{ }| = 0 |{1, 2, 3, 5}| = 4 |{a, b, c}| = 3 |{{1, 2, 3},{4, 5}}| = 2

Module #3 - Sets 3/2/2016(c) , Michael P. Frank The Power Set Operation The power set P(S) of a set S is the set of all subsets of S. e.g.   P({a, b}) = { , {a}, {b}, {a, b}}   P({1, 2, 3}) = { , {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}   P({a}) = { , {a}}   P({  }) = { , {  }}   P(  ) = {  } Note: If a set has n elements then P(S) has 2 n elements.

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Ordered n-tuples The ordered n-tuple (a 1, a 2, …, a n ) is the ordered collection that has a 1 as its first element, a 2 as its second element and so on. These are like sets, except that duplicates matter, and the order makes a difference. e.g. (2, 5, 6, 7) is a 4-tuple. Note that (1, 2)  (2, 1)  (2, 1, 1). Note: 2-tuples are called ordered pairs.

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Cartesian Products of Sets The Cartesian product of any two sets A and B is defined by A  B :  {(a, b) | a  A  b  B }. e.g. {a, b}  {1, 2} = {(a, 1), (a, 2), (b, 1), (b, 2)} Note that for finite A and B, |A  B| = |A||B|. Note that the Cartesian product is not commutative: A  B ≠ B  A. e.g. {1, 2}  {a, b} = {(1, a),(1, b),(2, a),(2, b)}

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Section 2.2: Set Operations The Union Operator  For any two sets A and B, A  B is the set containing all elements that are either in A, or in B or in both. Formally: A  B = {x | x  A  x  B}.

Module #3 - Sets 3/2/2016(c) , Michael P. Frank {2,3,5}  {3,5,7} = {2,3,5,3,5,7} ={2,3,5,7} Union Example

Module #3 - Sets 3/2/2016(c) , Michael P. Frank The Intersection Operator  For any two sets A and B, their intersection A  B is the set containing all elements that are in both A and in B. Formally: A  B = {x | x  A  x  B}.

Module #3 - Sets 3/2/2016(c) , Michael P. Frank {a, b, c}  {2, 3} =  disjoint {2, 4, 6}  {3, 4, 5} = {4} Intersection Examples

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Inclusion-Exclusion Principle How many elements are in A  B? |A  B| = |A|  |B|  |A  B| Example: {1, 2, 3}  {2, 3, 4, 5} = {1, 2, 3, 4, 5} {1, 2, 3}  {2, 3, 4, 5} = {2, 3} |{1, 2, 3, 4, 5}| = – 2 = 5

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Set Difference For any two sets A and B, the difference of A and B, written A  B, is the set of all elements that are in A but not in B. A  B :   x  x  A  x  B    x   x  A  x  B  A – B = A  B is called the complement of B with respect to A. e.g. {1, 2, 3, 4, 5, 6}  {2, 3, 5, 7, 9, 11} = {1, 4, 6 }

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Set Difference - Venn Diagram Set A Set B Set A  B

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Symmetric Difference For any two sets A and B, the symmetric difference of A and B, written A B, is the set of all elements that are in A but not in B or in B but not in A. A B :   x  (x  A  x  B)  (x  B  x  A)   (A – B)  (B – A) = (A  B) – (A  B) e.g. {1, 2, 3, 4, 5, 6} {2, 3, 5, 7, 9, 11} = {1, 4, 6, 7, 9, 11}

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Symmetric Difference - Venn Diagram Set ASet B Set A  B Set B  A

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Set Complements U : Universe of Discourse : For any set A  U, the complement of A, i.e. it is U  A. e.g. If U = N, A U

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Example Let A and B are two subsets of a set E such that A  B = {1, 2}, |A|= 3, |B| = 4, A = {3, 4, 5, 9} and B = {5, 7, 9}. Find the sets A, B and E. E A = {1, 2, 7}, B = {1, 2, 3, 4}, E = {1, 2, 3, 4, 5, 7, 9} A B

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Set Identities Identity: A  = A = A  U Domination: A  U = U, A  =  Idempotent: A  A = A = A  A Double complement: Commutative: A  B = B  A, A  B = B  A Associative: A  (B  C) = (A  B)  C A  (B  C) = (A  B)  C Distribution: A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) De Morgan’s Law:

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Proving Set Identities To prove statements about sets of the form E 1 = E 2, where the Es are set expressions, there are three useful techniques: 1. Proving E 1  E 2 and E 2  E 1 separately. 2. Using set builder notation and logical equivalences.. 3. Using set identities.

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Example: Show A  B = A  B Method 1: Prove E 1  E 2 and E 2  E 1 Assume x  A  B   x  A  B by the definition of the complement    x  A  B by the definition of the negation   ((x  A)  (x  B)) by the definition of intersection   (x  A)   ( x  B) by De Morgan’s law  x  A  x  B by the definition of negation  x  A  x  B by the definition of the complement  x  A  B by the definition of union

Module #3 - Sets (c) , Michael P. Frank31 Method 2: Set Builder Notation Show A  B = A  B A  B = {x | x  A  B} = {x |  ( x  (A  B))} = {x |  ( x  A  x  B)} = {x |  x  A   x  B)} = {x | x  A  x  B} = {x | x  A  x  B)} = {x | x  A  B } = A  B

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Method 3 : Using Set Identities

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Method 3 : Using Set Identities

Module #3 - Sets 3/2/2016(c) , Michael P. Frank Computer Representation of Sets Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. The bit string (of length |U| = 10) that represents the set A = {1, 3, 5, 6, 9} has a one in the first, third, fifth, sixth, and ninth position, and zero elsewhere. It is