22
Melikyan/DM/Fall09 Discrete Mathematics Ch. 5 Sets (Review) Instructor: Hayk Melikyan [email protected] Today we will review sections 5.1, 5.2, 5.3

Discrete Mathematics Ch. 5 Sets (Review)

  • Upload
    geoff

  • View
    50

  • Download
    0

Embed Size (px)

DESCRIPTION

Discrete Mathematics Ch. 5 Sets (Review). Today we will review sections 5.1, 5.2, 5.3. Instructor: Hayk Melikyan [email protected]. What is a set? A collection of elements: Order is irrelevant No repetitions Can be infinite Can be empty Examples: {Angela, Belinda, Jean} - PowerPoint PPT Presentation

Citation preview

Page 1: Discrete Mathematics Ch. 5   Sets  (Review)

1Melikyan/DM/Fall09

Discrete Mathematics

Ch. 5 Sets (Review)

Instructor: Hayk [email protected]

Today we will review sections 5.1, 5.2, 5.3

Page 2: Discrete Mathematics Ch. 5   Sets  (Review)

2Melikyan/DM/Fall09

What is a set?

A collection of elements:Order is irrelevantNo repetitionsCan be infiniteCan be empty

Examples:{Angela, Belinda, Jean}{0,1,2,3,…}

Page 3: Discrete Mathematics Ch. 5   Sets  (Review)

3Melikyan/DM/Fall09

Operations on sets

S is a set Membership:xS x is an element of S Angela{Angela, Belinda, Jean}

Subset S1 S – Set S1 is a subset of set S– All elements of S1 are elements of S– {Angela,Belinda} {Angela, Belinda, Jean}

Proper subset S1 S

Page 4: Discrete Mathematics Ch. 5   Sets  (Review)

4Melikyan/DM/Fall09

Operations on sets

If S, S1 are sets

Intersection: S S1

– is a set of all elements that belong to both

{Ang, Bel, Jea} {Ang, Dan} = {Ang}

Union: S S1

– is a set of all elements that belong to either

– {Ang, Bel, Jea} {Ang, Dan} = {Ang, Bel, Jea, Dan}

Page 5: Discrete Mathematics Ch. 5   Sets  (Review)

5Melikyan/DM/Fall09

Operations on sets

Let S, S1 be sets

Equality: S = S1

– iff they have the same elements

Difference: S \ S1

– is a set of all elements that belong to S but NOT to S1

{Ang, Bel, Jea} \ {Ang, Dan} = {Bel, Jea}

Page 6: Discrete Mathematics Ch. 5   Sets  (Review)

6Melikyan/DM/Fall09

More notation

In mathematics sets are often specified with a predicate and an enveloping set as follows:

S = {xA | P(x)}

S is the set of all elements of A that satisfy predicate P

Example:

Q={xR | a,bZ b0 & x=a/b}

Page 7: Discrete Mathematics Ch. 5   Sets  (Review)

7Melikyan/DM/Fall09

Set Equality

Two sets are equal iff they have the same elements

Theorem: for any sets A and B, A=B iff AB & BA

Page 8: Discrete Mathematics Ch. 5   Sets  (Review)

8Melikyan/DM/Fall09

Book example 5.1.5

– 2{1,2,3} ?– {2}{1,2,3} ?– 2{1,2,3} ?– {2}{1,2,3} ?– {2}{{1},{2}} ?– {2}{{1},{2}} ?

How about set A such that {2} is a subset of it and A is an element of it?– A={1,2,{1},{2}}

Page 9: Discrete Mathematics Ch. 5   Sets  (Review)

9Melikyan/DM/Fall09

Universal SetIf we are dealing with sets which are all

subsets ofa larger set U then we call it a universal set U

All of your sets will be subsets of U

When does such a U exist?

Always, for we can set U to the union of all sets involved ???????

Page 10: Discrete Mathematics Ch. 5   Sets  (Review)

10Melikyan/DM/Fall09

Complement

So if I am dealing with set A which is a subset of the universal set U then:

I can define complement of A: AC = U\AThat is the set of all elements (of U) that are not in AOften “of U” is dropped and people say that AC isthe set of everything that is not in A

What is the complement of U? UC = Ø

What set has U as its complement? ØC=U

Page 11: Discrete Mathematics Ch. 5   Sets  (Review)

11Melikyan/DM/Fall09

Sets & Predicate LogicAll of the set operations and relations above

can be defined in terms of Boolean connectives:– AB={x | xA v xB}– AB={x | xA & xB}– A\B={x | xA & not xB}– AC={x | not xA}

– A = B iff x( xA xB)– A B iff x (xA xB)– AB iff x (xA xB) & not A=B

Page 12: Discrete Mathematics Ch. 5   Sets  (Review)

12Melikyan/DM/Fall09

Symmetric Difference

Set C is the symmetric difference of sets A and

B iff every element of C belongs to A or B butnot both

ABC [C=A B a (aC (aA xor aB))]

If A={1,2}, B={2,3} then A B={1,3}

In general: A A = {}

Page 13: Discrete Mathematics Ch. 5   Sets  (Review)

13Melikyan/DM/Fall09

Exercise 2Intersection of two sets is contained in their

union: AB [ (A B) (A B) ]Proof:

Page 14: Discrete Mathematics Ch. 5   Sets  (Review)

14Melikyan/DM/Fall09

Exercise 3

Union is commutativeAB [ A B = B A ]

Intersection is commutative

AB [ A B = B A ]

Intersection distributes over union:

ABC [ A (B C) =(A B) (A C) ]

Page 15: Discrete Mathematics Ch. 5   Sets  (Review)

15Melikyan/DM/Fall09

Exercise

In Exercise #5 we proved: ABC [ A (B C) =(A B) (A C) ]

using the fact that A&(BvC) = (A&B)v(A&C)Given the statement just proved

Av(B&C) = (AvB) & (AvC)

what can we now prove in terms of sets?Union distributes over intersection:

ABC [ A (B C) =(A B) (A C) ]

Page 16: Discrete Mathematics Ch. 5   Sets  (Review)

16Melikyan/DM/Fall09

Proof :

Page 17: Discrete Mathematics Ch. 5   Sets  (Review)

17Melikyan/DM/Fall09

Logic - Sets

v & avb=bva ab=ba a&b=b&a ab=ba (avb)vc=av(bvc) (ab)c=a(bc) (a&b)&c=a&(b&c) (ab)c=a(bc) a&(bvc)=(a&b)v(a&c)

a(bc)=(ab)(ac) av(b&c)=(avb) & (avc)

a(bc)=(ab)(ac)

Page 18: Discrete Mathematics Ch. 5   Sets  (Review)

18Melikyan/DM/Fall09

Cartesian Products

Intuition first:Suppose I have a function that takes two

numbers x and y and returns x/yWhat is the set of valid inputs?Is it just R?

– No -- cannot divide by 0

Is it R\{0}?– No -- can happily have 0 as x

Page 19: Discrete Mathematics Ch. 5   Sets  (Review)

19Melikyan/DM/Fall09

CombinationsSuppose I have:• two independent attributes:

sky conditions and temperaturetwo values for the sky conditions

S={sunny, overcast};three values for the precipitation:

P={snow, rain, nothing}.

How many combinations can I have?

<sunny, rain> , <sunny, snow> . <sunny, nothing>.

<overcast, rain>. <overcast, snow>, <overcast, nothing>

Page 20: Discrete Mathematics Ch. 5   Sets  (Review)

20Melikyan/DM/Fall09

Cartesian Product

Set C is a Cartesian Product of set A and set B iff it is a set of all ordered pairs such that the 1st element belongs to A and the 2nd element belongs to B

C=A B iff ab (<a, b>C (aA & bB))]

Page 21: Discrete Mathematics Ch. 5   Sets  (Review)

21Melikyan/DM/Fall09

Examples

A={0,1}, B={Ang, Bel}AB = {<0,Ang>, <0,Bel>, <1,Ang>, <1,

Bel>}

A={0,1}, B={Ang, Bel}BA = {<Ang, 0>, <Bel, 0>, <Ang, 1>,

<Bel,1>}

A={0}, B={a,b}, C={1,2}ABC={<0, a, 1>,<0, b, 1>, <0, a, 2>,<0,

b, 2>}

Page 22: Discrete Mathematics Ch. 5   Sets  (Review)

22Melikyan/DM/Fall09

More examples

A=B=C=D=R (set of all real numbers)ABCD=R4 (time-space continuum)

What is the cardinality of Cartesian Product?

|A1 … An|=|A1| · … · |An| for finite sets

How about { } {1,2}?– {} {1,2}={}