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.

Slides:



Advertisements
Similar presentations
Discrete Mathematics I Lectures Chapter 6
Advertisements

Prof. Johnnie Baker Module Basic Structures: Sets
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Discrete Structures & Algorithms Basics of Set Theory EECE 320 — UBC.
Instructor: Hayk Melikya
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.
Lecture 4: Predicates and Quantifiers; Sets.
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.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Copyright © Zeph Grunschlag, Set Operations Zeph Grunschlag.
Sets 1.
Sets 1.
1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations.
Mathematics.
Sets.
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Chapter 3 – Set Theory  .
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)
1 Set Theory Chapter 3. 2 Chapter 3 Set Theory 3.1 Sets and Subsets A well-defined collection of objects (the set of outstanding people, outstanding is.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Chapter 7 Review Important Terms, Symbols, Concepts 7.1. Logic A proposition is a statement (not a question.
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
Mathematical Proofs. Chapter 1 Sets 1.1 Describing a Set 1.2 Subsets 1.3 Set Operations 1.4 Indexed Collections of Sets 1.5 Partitions of Sets.
CS201: Data Structures and Discrete Mathematics I
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
Lecture 4: Predicates and Quantifiers; Sets.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
ELEMENTARY SET THEORY.
Chapter SETS DEFINITION OF SET METHODS FOR SPECIFYING SET SUBSETS VENN DIAGRAM SET IDENTITIES SET OPERATIONS.
Set Theory Chapter 3. Chapter 3 Set Theory 3.1 Sets and Subsets A well-defined collection of objects (the set of outstanding people, outstanding is very.
Chapter 2 With Question/Answer Animations. Section 2.1.
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.
Unit :1 Set Theory Prof. A.J. SHAKADWIPI. Sets and Subsets A well-defined collection of objects. finite sets, infinite sets, subset A={1,3,5,7,9} B={x|x.
Discrete Mathematics CS 2610 January 27, part 2.
Discrete Mathematics Set.
UNIT 3. OUTLINE: Sets and Subsets Set Operations the Laws of Set Theory Counting and Venn Diagrams. A First Word on Probability. The Axioms of Probability.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
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.
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)
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Set Theory Two's company, three is none. Chapter 3.
Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.
Applied Discrete Mathematics Week 1: Logic and Sets
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
Copyright © Zeph Grunschlag,
Discrete Structures – CNS 2300
Discrete Mathematical The Set Theory
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.
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
Discrete Mathematics CS 2610
L5 Set Operations.
… 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.
Set Theoretic Operations
Two's company, three is none.
Presentation transcript:

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 of A” A = {a 1, a 2, …, a n } “A contains…” Order of elements is meaningless It does not matter how often the same element is listed.

Sets Curly braces “ { “ and “ } ” are used to denote sets. Java note: In Java curly braces denote arrays, a data-structure with inherent ordering. Mathematical sets are unordered so different from Java arrays. Java arrays require that all elements be of the same type. Mathematical sets don ’ t require this, however. EG: { }

Standard Numerical Sets The natural numbers: N = { 0, 1, 2, 3, 4, … } The integers: Z = { … -3, -2, -1, 0, 1, 2, 3, … } The positive integers: Z + = {1, 2, 3, 4, 5, … } The real numbers: R --contains any decimal number of arbitrary precision The rational numbers: Q --these are decimal numbers whose decimal expansion repeats Q: Give examples of numbers in R but not Q.

Set Theory (a) Z=the set of integers={0,1,-1,2,-1,3,-3,...} (b) N=the set of nonnegative integers or natural numbers (c) Z + =the set of positive integers (d) Q=the set of rational numbers={a/b| a,b is integer, b not zero} (e) Q + =the set of positive rational numbers (f) Q*=the set of nonzero rational numbers (g) R=the set of real numbers (h) R + =the set of positive real numbers (i) R*=the set of nonzero real numbers (j) C=the set of complex numbers

 -Notation The Greek letter “  ” (epsilon) is used to denote that an object is an element of a set. When crossed out “  ” denotes that the object is not an element. ” EG: 3  S reads: “ 3 is an element of the set S ”. Q: Which of the following are true: 1. 3  R  N  R 4. 0  Z + 5.  x x  R  x 2 =-5

7 Examples for Sets A =  or 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”

Set Builder Notation Up to now sets have been defined using the curly brace notation “ { … } ” or descriptively “ the set of all natural numbers ”. The set builder notation allows for concise definition of new sets. For example { x | x is an even integer } { 2x | x is an integer } are equivalent ways of specifying the set of all even integers.

9 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} Example: A = {a, b}, B = {b, c, d} A  B = {b}

Set Builder Notation. Examples. A1: U = N. { x |  y (y  x ) } = { 0 } A2: U = Z. { x |  y (y  x ) } = { } A3: U = Z. { x |  y (y  R  y 2 = x )} = { 0, 1, 2, 3, 4, … } = N A4: U = Z. { x |  y (y  R  y 3 = x )} = Z A5: U = R. { |x | | x  Z } = N A6: U = R. { |x | } = non-negative reals.

L411  -Notation DEF: A set S is said to be a subset of the set T iff every element of S is also an element of T. This situation is denoted by S  T A synonym of “ subset ” is “ contained by ”. Definitions are often just a means of establishing a logical equivalence which aids in notation. The definition above says that: S  T   x (x  S )  (x  T ) We already had all the necessary concepts, but the “  ” notation saves work.

L412  -Notation When “  ” is used instead of “  ”, proper containment is meant. A subset S of T is said to be a proper subset if S is not equal to T. Notationally: S  T  S  T   x (x  S  x  T ) Q: What algebraic symbol is  reminiscent of?

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

Union A  B = { x | x  A  x  B } Elements in at least one of the two sets: AB U ABAB

Intersection A  B = { x | x  A  x  B } Elements in exactly one of the two sets: AB U ABAB

Disjoint Sets DEF: If A and B have no common elements, they are said to be disjoint, i.e. A  B = . AB U

Set Difference A  B = { x | x  A  x  B } Elements in first set but not second: A B U ABAB

Symmetric Difference AB UABAB A  B = { x | x  A  x  B } Elements in exactly one of the two sets:

Complement  A = { x | x  A } Elements not in the set (unary operator): A U AA

Set Identities  Identity laws  Domination laws  Idempotent laws  Double complementation  Commutativity  Associativity  Distribuitivity  DeMorgan logical identities rewriting as follows: disjunction “  ” becomes union “  ” conjunction “  ” becomes intersection “  ” negation “  ” becomes complementation “–” false “ F ” becomes the empty set  true “ T ” becomes the universe of reference U

Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.) = {x | (x  A  x  B )  x  C } (by def.) = {x | x  A  ( x  B  x  C ) } (logical assoc.) = {x | x  A  (x  B  C ) } (by def.) = A  (B  C ) (by def.)  Other identities are derived similarly.

L522 Visual DeMorgan =

Cardinality The cardinality of a set is the number of distinct elements in the set. |S | denotes the cardinality of S. Q: Compute each cardinality. 1. |{1, -13, 4, -13, 1}| 2. |{3, {1,2,3,4},  }| 3. |{}| 4. |{ {}, {{}}, {{{}}} }|

L424 Cardinality Hint: After eliminating the redundancies just look at the number of top level commas and add 1 (except for the empty set). A: 1. |{1, -13, 4, -13, 1}| = |{1, -13, 4}| = 3 2. |{3, {1,2,3,4},  }| = 3. To see this, set S = {1,2,3,4}. Compute the cardinality of {3,S,  } 3. |{}| = |  | = 0 4. |{ {}, {{}}, {{{}}} }| = |{ , {  }, {{  }}| = 3

L425 Cardinality DEF: The set S is said to be finite if its cardinality is a nonnegative integer. Otherwise, S is said to be infinite. EG: N, Z, Z +, R, Q are each infinite. Note: We ’ ll see later that not all infinities are the same. In fact, R will end up having a bigger infinity-type than N, but surprisingly, N has same infinity-type as Z, Z +, and Q.

Set Theory Counting and Venn Diagrams In a class of 50 college freshmen, 30 are studying BASIC, 25 studying PASCAL, and 10 are studying both. How many freshmen are studying either computer language? U AB

Set Theory Counting and Venn Diagrams Given 100 samples set A: with D 1 set B: with D 2 set C: with D 3 Defect types of an AND gate: D 1 : first input stuck at 0 D 2 : second input stuck at 0 D 3 : output stuck at 1 with |A|=23, |B|=26, |C|=30,, how many samples have defects? A B C Ans:57

Power Set DEF: The power set of S is the set of all subsets of S. Denote the power set by P (S ) or by 2 s. The latter weird notation comes from the following. Lemma: | 2 s | = 2 |s|

Power Set – Example To understand the previous fact consider S = {1,2,3} Enumerate all the subsets of S : 0-element sets: {} 1 1-element sets: {1}, {2}, {3} +3 2-element sets: {1,2}, {1,3}, {2,3} +3 3-element sets: {1,2,3}+1 Therefore: | 2 s | = 8 = 2 3 = 2 |s|

Cartesian Product The most famous example of 2-tuples are points in the Cartesian plane R 2. Here ordered pairs (x,y) of elements of R describe the coordinates of each point. We can think of the first coordinate as the value on the x- axis and the second coordinate as the value on the y-axis. DEF: The Cartesian product of two sets A and B – denoted by A  B – is the set of all ordered pairs (a, b) where a  A and b  B. Q: Describe R 2 as the Cartesian product of two sets.

Cartesian Product A: A = {1,2}, B = {3,4}, C = {5,6,7} A  B  C = { (1,3,5), (1,3,6), (1,3,7), (1,4,5), (1,4,6), (1,4,7), (2,3,5), (2,3,6), (2,3,7), (2,4,5), (2,4,6), (2,4,7) } Lemma: The cardinality of the Cartesian product is the product of the cardinalities: | A 1  A 2  …  A n | = |A 1 |  |A 2 |  …  |A n | Q: What does  S equal?

Set Theory Set Operations and the Laws of Set Theory The Laws of Set Theory

Set Theory Set Operations and the Laws of Set Theory The Laws of Set Theory

Generalized Union Binary union operator: A  B n-ary union: A  A 2  …  A n :  ((…((A 1  A 2 )  …)  A n ) (grouping & order is irrelevant) “Big U” notation: Or for infinite sets of sets:

Generalized Intersection Binary intersection operator: A  B n-ary intersection: A  A 2  …  A n  ((…((A 1  A 2 )  …)  A n ) (grouping & order is irrelevant) “Big Arch” notation: Or for infinite sets of sets:

Mutual subsets Example: Show A  (B  C)=(A  B)  (A  C). Show A  (B  C)  (A  B)  (A  C). Assume x  A  (B  C), & show x  (A  B)  (A  C). We know that x  A, and either x  B or x  C.  Case 1: x  B. Then x  A  B, so x  (A  B)  (A  C).  Case 2: x  C. Then x  A  C, so x  (A  B)  (A  C). Therefore, x  (A  B)  (A  C). Therefore, A  (B  C)  (A  B)  (A  C). Show (A  B)  (A  C)  A  (B  C). …

Membership Table Exercise Prove (A  B)  C = (A  C)  (B  C).

Ordered n-tuples Notationally, n-tuples look like sets except that curly braces are replaced by parentheses: ( 11, 12 ) – a 2-tuple aka ordered pair (,, ) – a 3-tuple (,,, 11, Leo ) – a 5-tuple Java: n -tuples are similar to Java arrays “ { … } ”, except that type-mixing isn ’ t allowed in Java. As opposed to sets, repetition and ordering do matter with n-tuples. (11, 11, 11, 12, 13)  ( 11, 12, 13 ) (,,)  (,,)

39 Exercises Question 1: Given a set A = {x, y, z} and a set B = {1, 2, 3, 4}, what is the value of | 2 A  2 B | ? Question 2: Is it true for all sets A and B that (A  B)  (B  A) =  ? Or do A and B have to meet certain conditions? Question 3: For any two sets A and B, if A – B =  and B – A = , can we conclude that A = B? Why or why not?

Blackboard Exercise Prove the following: If A  B and B  C then A  C.

Set Theory