cse115/engr160 discrete mathematics 02/14/12

18
CSE115/ENGR160 Discrete Mathematics 02/14/12 Ming-Hsuan Yang UC Merced 1

Upload: edison

Post on 05-Jan-2016

48 views

Category:

Documents


3 download

DESCRIPTION

CSE115/ENGR160 Discrete Mathematics 02/14/12. Ming-Hsuan Yang UC Merced. 2.2 Set operations. Union : the set that contains those elements that are either in A or in B, or in both A={1,3,5}, B={1,2,3}, A ⋃B={1,2,3,5}. Intersection. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSE115/ENGR160 Discrete Mathematics 02/14/12

CSE115/ENGR160 Discrete Mathematics02/14/12

Ming-Hsuan Yang

UC Merced

1

Page 2: CSE115/ENGR160 Discrete Mathematics 02/14/12

2.2 Set operations

• Union: the set that contains those elements that are either in A or in B, or in both

• A={1,3,5}, B={1,2,3}, A⋃B={1,2,3,5}2

}|{ BxAxxBA

Page 3: CSE115/ENGR160 Discrete Mathematics 02/14/12

Intersection

• Intersection: the set containing the elements in both A and B

• A={1,3,5}, B={1,2,3}, A⋂B={1,3}3

}|{ BxAxxBA

Page 4: CSE115/ENGR160 Discrete Mathematics 02/14/12

Disjoint set

• Two sets are disjoint if their intersection is ∅• A={1,3}, B={2,4}, A and B are disjoint • Cardinality:

4

|||||||| BABABA

Page 5: CSE115/ENGR160 Discrete Mathematics 02/14/12

Difference and complement

• A-B: the set containing those elements in A but not in B

• A={1,3,5},B={1,2,3}, A-B={5}5

}|{ BxAxxBA

Page 6: CSE115/ENGR160 Discrete Mathematics 02/14/12

Complement

• Once the universal set U is specified, the complement of a set can be defined

• Complement of A: • A-B is also called the complement of B with

respect to A

6

AUAAxxA },|{

Page 7: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• A is the set of positive integers > 10 and the universal set is the set of all positive integers, then

• A-B is also called the complement of B with respect to A

7

}10,9,8,7,6,5,4,3,2,1{}10|{ xxA

Page 8: CSE115/ENGR160 Discrete Mathematics 02/14/12

Set identities

8

Page 9: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• Prove• Will show that• (→): Suppose that , by definition of

complement and use De Morgan’s law

• By definition of complement• By definition of union

9

BABA BABABABA and

BAx

)()(

))(())((

)(

BxAx

BxAx

BxAx

BxAx or

BAx

Page 10: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• (←): Suppose that• By definition of union• By definition of complement• Thus• By De Morgan’s law:

• By definition of complement, 10

BAx

BxAx

BxAx )()( BxAx

))((

)(

)()(

BAx

BxAx

BxAx

BAx

Page 11: CSE115/ENGR160 Discrete Mathematics 02/14/12

Builder notation

• Prove it with builder notation

11BA

BAxx

BxAxx

BxAxx

BxAxx

BxAx

BAxx

BAxxBA

union) of (def }|{

)complement of (def }|{

to)belongnot of (def }|{

law) sMorgan' (De )}()(|{

on)intersecti of (def )}(|{x

to)belongnot of (def ))}((|{

)complement of (def }|{

Page 12: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• Prove• (→): Suppose that then and . By definition of union, it follows

that , and or . Consequently, and or and

• By definition of intersection, it follows or• By definition of union,

12

)()()( CABACBA

)( CBAx AxCBx

Ax Bx CxAx Bx Ax Cx

BAx CAx

)()( CABAx

Page 13: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• (←): Suppose that • By definition of union, or • By definition of intersection, and ,

or and • From this, we see , and or• By definition of union, and• By definition of intersection,

13

)()( CABAx

BAx CAx

Ax BxAx Cx

Ax Bx Cx

Ax CBx )( CBAx

Page 14: CSE115/ENGR160 Discrete Mathematics 02/14/12

Membership table

14

Page 15: CSE115/ENGR160 Discrete Mathematics 02/14/12

Example

• Show that

15

ABCCBA )()(

law) ve(commutati )(

law) ve(commutati )(

law) sMorgan' (De )(

law) sMorgan' (De )(

ABC

ACB

CBA

CBACBA

Page 16: CSE115/ENGR160 Discrete Mathematics 02/14/12

Generalized union and intersection

• A={0,2,4,6,8}, B={0,1,2,3,4}, C={0,3,6,9}• A⋃B⋃C={0,1,2,3,4,6,8,9}• A⋂B⋂C={0}

16

Page 17: CSE115/ENGR160 Discrete Mathematics 02/14/12

General case

• Union:• Intersection• Union:• Intersection:• Suppose Ai={1, 2, 3,…, i} for i=1,2,3,…

17

i

n

in AAAA

1

21

i

n

in AAAA

1

21

ii

n AAAA

1

21

ii

n AAAA

1

21

}1{},,3,2,1{

},3,2,1{},,3,2,1{

11

11

iA

ZiA

ii

i

ii

i

Page 18: CSE115/ENGR160 Discrete Mathematics 02/14/12

Computer representation of sets

• U={1,2,3,4,5,6,7,8,9,10}• A={1,3,5,7,9} (odd integer ≤10),B={1,2,3,4,5}

(integer ≤5)• Represent A and B as 1010101010, and

1111100000• Complement of A: 0101010101• A⋂B: 1010101010˄1111100000=1010100000 which corresponds to {1,3,5}

18