Chapter 4 Sets, Combinatorics, and Probability Section

Chapter 4 Sets, Combinatorics, and Probability Section

Chapter 4 Sets, Combinatorics, and Probability Section 4.1: Sets CS 130 – Discrete Structures Set Theory • A set is a collection of elements or objects, and an element is a member of a set – Traditionally, sets are described by capital letters, and elements by lower case letters • The symbol means belongs to: – Used to represent the fact that an element belongs to a particular set. – aA means that element a belongs to set A – bA implies that b is not an element of A • Braces {} are used to indicate a set • Example: A = {2, 4, 6, 8, 10} – 3A and 2A CS 130 – Discrete Structures 2 Continue on Sets • Ordering is not imposed on the set elements and listing elements twice or more is redundant • Two sets are equal if and only if they contain the same elements – A = B means (x)[(xA xB) Λ (xB xA)] • Finite and infinite set: described by number of elements – Members of infinite sets cannot be listed but a pattern for listing elements could be indicated CS 130 – Discrete Structures 3 Various Ways To Describe A Set • The set S of all positive even integers: – List (or partially list) its elements: • S = {2, 4, 6, 8, …} – Use recursion to describe how to generate the set elements: • 2 S, if n S, then (n+2) S – Describe a property P that characterizes the set elements • in words: S = {x | x is a positive even integer} • Use predicates: S = {x P(x)} means (x)[(xS P(x)) Λ (P(x) xS)] where P is the unary predicate. • Hence, every element of S has the property P and everything that has a property P is an element of S. CS 130 – Discrete Structures 4 Examples • Describe each of the following sets by listing the elements: – {x | x is a month with exactly thirty days} – {x | x is an integer and 4<x<9} • What is the predicate/property for each of the following sets: – {1, 4, 9, 16, …..} – {2, 3, 5, 7, 11, 13, 17, ….} CS 130 – Discrete Structures 5 Standard Sets • Some notations used for convenience of defining sets – N = set of all nonnegative integers • remember that 0 N – Z = set of all integers – Q = set of all rational numbers – R = set of all real numbers • A set that has no members is called a null or empty set and is represented by – S = {x | x N and x < 0} – Note that is not the same as {} CS 130 – Discrete Structures 6 Examples • What are the elements in the following sets? – A = {x| (y)(y {0,1,2} and x = y2} – B = {x| x N and (y) (y N and x <= y)} – C = {x| x N and (y) (y N x <= y)} – D = {x| (y)(z)(y{1,2} and z{2,3} and x=z–y)} CS 130 – Discrete Structures 7 Open and Closed Interval • {x R | -2 < x < 3} – denotes the set containing all real numbers between -2 and 3. This is an open interval, meaning that the endpoints -2 and 3 are not included. By all real numbers, we mean everything; 1.05, -3/4, and every other real number within that interval. • {x R | -2 x 3} – is a closed interval -- it includes all the numbers in the open interval described above, plus the endpoints. CS 130 – Discrete Structures 8 Relationships Between Sets: Subsets • Say S is the set of all people, M is the set of all male humans, and C is the set of all computer science students: – M and C are both subsets of S, because all elements of M and C are also elements of S. – M is not a subset of C, however, since there are elements of M which are not in C (specifically, all males who are not studying computer science). – For sets S and M, M is a subset of S if and only if, every element in M is also an element of S. – Symbolically: M S (x) (x M x S). – If M S and M S, then there is at least one element of S that is not an element of M, then M is a proper subset of S denoted by M S CS 130 – Discrete Structures 9 More Relationships • A superset is the opposite of subset. If M is a subset of S, then S is a superset of M, denoted S M. Likewise, if M is a proper subset of S, then S is a proper superset of M, denoted S M. • The cardinality of a set is simply the number of elements within the set; the cardinality of S is denoted by |S|. Then by the above definition of subset, it is clear that set M must have fewer members than S, which yields the following symbolic representation: – M S |M| < |S| – M S |M| <= |S| CS 130 – Discrete Structures 10 Exercises A = {x| x N and x 5} B = {10, 12, 16, 20} C = {x | (y)(y N and x = 2y)} What statements are true? • B C B A • A C 26 C • {11, 12, 13} A {11, 12, 13} C • {12} B {12} B • {x | x N and x < 20} B 5 A • {} B A For the following sets, prove A B • A = { x | x R such that x2 – 4x + 3 = 0} • B = { x | x N and 1 x 4} CS 130 – Discrete Structures 11 Set of Sets • From every set, many subsets can be generated. A set whose elements are all such subsets is called the power set. • For a set S, (S) is termed as the power set. • For a set S = {1, 2, 3} ; – (S) = { ,{1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} • For a set with n elements, the power set has 2n elements. CS 130 – Discrete Structures 12 Set Operations • Binary and unary operators – Binary acts on two elements – Unary acts on a single element • An ordered pair of elements is written as (x,y) and is different from (y,x) • Two ordered pairs (a,b) and (c,d) are equal if and only if a = c and b = d • If S = {2,3}, the ordered pairs of this set are (2,2), (2,3), (3,2), (3,3) CS 130 – Discrete Structures 13 Binary Operations • Binary operation on a set defined as follows: – is a binary operation if for every ordered pair (x,y) of elements of S, x y exists, and is unique, and is a member of S. – The fact that x y exists and is unique is the same as saying that the binary operation is well-defined. – The fact that x y always belongs to S means that S is closed under the operation • The operator is just a placeholder for the real operator like +, -, *, etc. CS 130 – Discrete Structures 14 Examples • Example: +, - and * are all binary operators on Z • How about division(/)? Is it a binary operation on Z and why? • Is subtraction a binary operation on N? • Let x^ = -x, so that x^ is the negative of x. – Is ^ a unary operation on Z? – Is ^ a unary operation on N? CS 130 – Discrete Structures 15 More Examples • Which of the following are neither binary nor unary operations on the given sets? • Why? x y = x/y; S = set of all positive integers x y = x/y; S = set of all positive rational numbers y x y = x ; S = R x y = maximum of x and y; S = N x y = x + y; S = set of Fibonacci numbers CS 130 – Discrete Structures 16 Operations On Sets • New sets can be formed in a variety of ways, and can be described using: – Set builder notation (union, intersection, complement, etc.), and – Venn diagrams. • A rectangle marked by U is used to represent the universal set. CS 130 – Discrete Structures 17 Union and Intersection • The union of set A and B is the set which contains all elements in either set A or set B. – A B = {x | x A or x B } • The intersection of set A and B is the set which contains all elements both in set A and in set B. – A B = {x | x A and x B } • Example – A = {1, 3, 5, 7, 9} – B = {1, 2, 3, 4, 5} CS 130 – Discrete Structures 18 Disjoint, Universal and Difference Sets • Given set A and set B, if A B = , then A and B are disjoint sets. In other words, there are no elements in A which are also in B. • The complement of set A, denoted as ~A or A, is the set of all elements that are not in A. – A = {x | x A } • The difference of A-B, is the set of elements in A which are not in B. This is also known as the complement of B relative to A. – A - B = {x | x A and x B } – Note that A – B = A B B – A CS 130 – Discrete Structures 19 Exercise Let A = {1, 2, 3, 5, 10} B = {2, 4, 7, 8, 9} C = {5, 8, 10} be subsets of S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Find – A B = {1, 2, 3, 4, 5, 7, 8, 9, 10} – A – C = {1, 2, 3} – B (A C) = {1, 3, 5, 6, 10} {1, 2, 3, 5, 8, 10} = {1, 3, 5, 10} – A B C = {} – (A B) C = {1, 2, 3, 4, 7, 9} CS 130 – Discrete Structures 20 Cartesian Product • If A and B are subsets of S, then the Cartesian product or cross product of A and B denoted symbolically by A B is defined by: – A B = {(x,y) | x A and y B } • The Cartesian product of 2 sets is the set of all combinations of ordered pairs • For example, given 2 sets A and B, where A = {a, b, c} and B = {1, 2, 3}, the Cartesian product of A and B can be represented as: – A B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3), (c, 1), (c, 2), (c, 3)} – Is A B = B A ? CS 130 – Discrete Structures 21 Continue On Cartesian Product • Cross-product of a set with itself is represented as A A or A2 n • A represents the set of all n-tuples (x1, x2, …, xn) of elements of A.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    25 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us