Discrete Mathematics Discrete Mathematics
- - Chapter 3: Set Theory
Hung-Yu Kao (高宏宇) Department of Computer Science and Information Engineering, N l Ch K U National Cheng Kung University
Discrete Mathematics Discrete Mathematics -- Chapter 3: Set Theory - - PowerPoint PPT Presentation
Discrete Mathematics Discrete Mathematics -- Chapter 3: Set Theory Hung-Yu Kao ( ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U Outline 3.1 Set and Subsets 3 2 Set
Hung-Yu Kao (高宏宇) Department of Computer Science and Information Engineering, N l Ch K U National Cheng Kung University
3.1 Set and Subsets 3 2 Set Operations and the Laws of Set Theory 3.2 Set Operations and the Laws of Set Theory 3.3 Counting and Venn Diagrams 3.4 A First Word on Probability 3 5 The Axioms of Probability 3.5 The Axioms of Probability 3.6 Conditional Probability: Independence 3.7 Discrete Random Variables
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
2
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
3
Set: should be a well-defined collection of objects. Elements (members): These objects are called elements or
members of the set members of the set.
Capital letters represent sets: A, B, C
p p lowercase letters represent elements: x, y
E.g.,
A et be de i ted b li ti it ele e t ithi et b e
B y A x ∉ ∈ ,
A set can be designated by listing its elements within set braces
“{“,”}”.
E.g., A = {1, 2, 3, 4, 5}, B = {x | x is an integer, and 1 ≤ x ≤ 5}
g { } { | g }
Cardinality (size): |A| denotes the number of elements in A. for finite sets
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
4
Universe (Universe of discourse): h denotes the range of all
elements to form any set. fi i i 3 1 f C d f i
Definition 3.1: If C and D are sets from a universe h
, if every element of C is an element of D.
if in addition D contains an
) ( C D D C ⊇ ⊆ ) ( C D D C ⊂ ⊂
element that is not in C.
( C D D C ⊂ ⊂ ] [ D x C x x D C ∈ ⇒ ∈ ∀ ⇔ ⊆
] [ )
subset a not is i.e., ( D x C x x D C D C ∈ ⇒ ∈ ∀ ⇔ ⊄ ] ) ( [ ] [ ] [ D x C x x D x C x x D x C x x ∈ ∨ ∈ ¬ ¬ ∃ ⇔ ∈ ⇒ ∈ ¬ ∃ ⇔ ∈ ⇒ ∈ ¬∀ ⇔ ] [ )] ( ) ( [ ] ) ( [ D x C x x D x C x x x C x x ∉ ∧ ∈ ∃ ⇔ ∈ ¬ ∧ ∈ ¬¬ ∃ ⇔ ⇔
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
5
Definition 3.2: The sets C and D are equal for a given universe h ,
) ( ) ( C D D C D C ⊆ ∧ ⊆ ⇔ =
Let A, B, C h ,
C A C B B A C A C B B A ⊂ ⊆ ⊂ ⊆ ⊆ ⊆ h d f ) then , and If ) b then , and If ) a
C A C B B A C A C B B A ⊂ ⊂ ⊂ ⊂ ⊂ ⊆ then , and If ) d then , and If ) c
Let h = {1, 2, 3, 4, 5} with A = {1, 2, 3}, B = {3, 4}, and
C = {1, 2, 3, 4}. Then the following subset relations hold:
A A B A A C B C A C A ⊄ ⊄ ⊆ ⊂ ⊂ ⊆ ) f ) e ) d ) c ) b ) a
A is not a proper subset of A
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
6
Null set (empty set), ∅ or { }: is the set containing no elements.
Power set, P(A): is the collection (set) of all subsets of the set A
from universe h .
Example: A = {1, 2, 3}
F fi it t A ith |A|
For any finite set A with |A|=n A has 2n subsets and |P(A)|= 2n There are
subsets of size k 0≤k≤n
⎞ ⎜ ⎜ ⎛n
There are subsets of size k, 0≤k≤n Counting the subsets of A (binomial theorem)
⎠ ⎜ ⎜ ⎝k
n n
n n n n 2 ∑ ⎞ ⎜ ⎜ ⎛ ⎞ ⎜ ⎜ ⎛ + + ⎞ ⎜ ⎜ ⎛ + ⎞ ⎜ ⎜ ⎛
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
7
n n k
k n 2 1 = ∑ ⎠ ⎜ ⎜ ⎝ = ⎠ ⎜ ⎜ ⎝ + ⋅ ⋅ ⋅ + ⎠ ⎜ ⎜ ⎝ + ⎠ ⎜ ⎜ ⎝
=
Theorem 3.2
T T T F
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
8
Gray code: There is exactly one bit that changes from one
bi i h
Another Gray code
binary string to the next one.
0 Φ 1 { } 00 0 Φ 10 0 { } 000 100 000 010 000 001
Another Gray code
1 {x} (a) 10 0 {x} 11 0 {x, y} 01 0 {y} 100 110 010 010 011 001 001 101 100 0 0 Φ 01 0 {y} 01 1 {y, z} 11 1 {x, y, z} 010 011 111 001 101 111 100 110 010 0 0 Φ 1 0 {x} 1 1 {x, y} 10 1 {x, z} 00 1 {z} (c) 101 001 (d) 110 100 (e) 011 111 (f) { y} 0 1 {y} (b)
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
9
Ex 3.12
{ }
subsets 1 are There elements. r contain A that
subsets all consider and , , , , A
2 1
⎞ ⎜ ⎜ ⎛ + ⎞ ⎜ ⎜ ⎛ = ⎞ ⎜ ⎜ ⎛ + = n n n a a a x Let
n
L subsets. 1 are There ⎠ ⎜ ⎜ ⎝ − + ⎠ ⎜ ⎜ ⎝ = ⎠ ⎜ ⎜ ⎝ r r r
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
10
Ex 3.13
6 2 1
⎞ ⎛ + ⎞ ⎛ + = + + + ≤ ≤ ∀ k k k x x x k k 5 1 6 is
number the , 9 ,
6 2 1
L ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + k k k k 5 1 6 ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + 9 15 9 1 9 7 1, chapter in
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
11
, N N +
+ + ⊆ Q
Z Q
+ +
= ∩ R C R Q R ⊆
+
Z Z Q = ∩
* + + +
= ∪ R R Z
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
12
Definition 3.5: For A and B ⊆ h
} | { ) and
union (the ) a B x A x x B A B A ∈ ∨ ∈ = ∪ ) and
difference symmetric (the ) c } | { ) and
intersecti (the ) b B A B A B x A x x B A B A ∆ ∈ ∧ ∈ = ∩ } | { } ) ( | { B A x B A x x B A x B x A x x ∩ ∉ ∧ ∪ ∈ = ∩ ∉ ∧ ∈ ∨ ∈ =
Definition 3.6: The sets S, T ⊆ h , are called disjoint
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
13
Theorem 3.3: If S, T ⊆ h are disjoint if and only if Proof:
) 1 ( T S T S ∪ ⇒ ∪
Proof:
, i.e., disjoint, and But ) 1 ( T S T S T S x T S x T S T x S x T S x ∆ ∆ ∈ ⇒ ∩ ∉ ∈ ∪ ∈ ⇒ ∪ ∈ ) 2 ( T y S y T S y T S T S ∈ ∪ ∈ ⇒ ∆ ∈ ∆ ⊆ ∪ ∴ T S T S T S y ∪ ⊆ ∆ ∴ ∪ ∈ ⇒ and T S T S T S T S T S T S ∆ = ∪ ∴ ∪ ⊆ ∆ ∆ ⊆ ∪ Q
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
14
Prove the converse by the method of proof by contradiction
Definition 3.7: For a set A ⊆ h , the complement of A, denoted
h – A or , is given by h
A
Definition 3.8: For A, B ⊆ h , the (relative) complement of A in B,
denoted B – A or, is given by
Ex 3 18 : For h = R A = [1 2] B = [1 3)
Ex 3.18 : For h = R, A = [1, 2], B = [1, 3)
A B x x x x A ∪ = < ≤ ⊆ ≤ ≤ = ? ) b } 3 1 | { } 2 1 | { ) a
} 3 1 | { B x x < ≤
A B B A B A = +∞ ∪ −∞ ⊆ +∞ ∪ −∞ = = ∩ = ∪ ) , 2 ( ) 1 , ( ) , 3 [ ) 1 , ( ) d ? c) ? ) b
} 3 1 | { B x x = < ≤ = } 2 1 | { A x x = ≤ ≤ =
Theorem 3.4: The following statements are equivalent:
A B +∞ ∪ ∞ ⊆ +∞ ∪ ∞ ) , 2 ( ) 1 , ( ) , 3 [ ) 1 , ( ) d
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
15
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
16
= A A plement Double Com :
Law ) 1 ⎩ ⎨ ⎧ ∩ = ∩ ∪ = ∪ ⎩ ⎨ ⎧ ∪ = ∩ ∩ = ∪ A B B A A B B A e Commutativ B A B A B A B A DeMogran's plement
: Laws ) 3 : Laws ) 2 :
) ⎧ ∪ ∩ ∪ = ∩ ∪ ⎩ ⎨ ⎧ ∩ ∩ = ∩ ∩ ∪ ∪ = ∪ ∪ C A B A C B A C B A C B A C B A C B A e Associativ ) ( ) ( ) ( ) ( ) ( ) ( ) ( : Laws ) 4 ⎨ ⎧ = ∪ ⎨ ⎧ = ∪ ⎩ ⎨ ⎧ ∩ ∪ ∩ = ∪ ∩ ∪ ∩ ∪ = ∩ ∪ A A Identity A A A Idempotent C A B A C B A C A B A C B A ve Distributi : Laws 7) : Laws ) 6 ) ( ) ( ) ( ) ( ) ( ) ( : Laws ) 5 φ ⎩ ⎨ ⎧ = ∩ = ∪ ⎩ ⎨ ⎧ = ∩ = ∪ ⎩ ⎨ = ∩ ⎩ ⎨ = ∩ A U U A A A U A A Inverse A U A Identity A A A Idempotent : Laws Domination ) 9 : Laws 8) : Laws 7) : Laws ) 6 φ φ φ ⎩ ⎨ ⎧ = ∪ ∩ = ∩ ∪ ⎩ = ∩ ⎩ = ∩ A B A A A B A A Absorption A A A ) ( ) ( : Laws ) 10 φ φ φ
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
17
Ex 3.20
Simplify the expression
B C B A ∪ ∩ ∪ ) (
B C B A ∪ ∩ ∪ ) ( ? and
in terms B
expressing about How ∪
B A∩ B A∪ =
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
18
p g
Definition 3.9: The dual of s, sd can be replaced
Theorem 3.5: The Principle of Duality, let s denote
and (2) and ) 1 ( φ ∩ ∪
Ex 3.19 : find a dual for statement A⊆ B (Th. 3.4)
A∪B=B A∩B=B (duality) A∪B B A∩B B (duality)
But A∩B=B ⇔ B⊆A (the dual of A⊆ B)
A∩B=A A∪B=A ⇔ B⊆A
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
19
Theorem 3.6: Generalized DeMorgan’s Laws,
U I I U
I i i I i i I i i I i i
A A A A
∈ ∈ ∈ ∈
= = (2) ) 1 (
Proof:
I U U
i i i i i
A x I i A x I i A x A x A x ∈ ⇔ ∈ ∈ ⇔ ∈ ∉ ⇔ ∉ ⇔ ∈ all for all for ) 1 (
I i i i i I i i I i i ∈ ∈ ∈
) (
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
20
Sets are the most simple yet non-trivial structures in Sets are the most simple, yet non-trivial structures in
Many other mathematical objects and properties can be Many other mathematical objects and properties can be
For us, sets are useful to understand the principles of
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
21
Venn diagrams are used to depict the various Venn diagrams are used to depict the various
John Venn
John Venn
(1834~1923)
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
22
B A∩ A B B A∪
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
23
j
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
24
The Principle of Inclusion and Exclusion
We can use it when solving counting problems…
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
25
| | | | | | | | ) 1 ( B A B A B A | | | | | | | | (2) | | | | | | | | ) 1 ( B A U B A B A B A B A B A ∪ − = ∪ = ∩ ∩ − + = ∪ | | | | (4) | | | | | | | | | | | | | | | | ) 3 ( | | | | | | | | C B A C B A C B A C B C A B A C B A C B A B A B A U ∪ ∪ = ∩ ∩ ∩ ∩ + ∩ − ∩ − ∩ − + + = ∪ ∪ ∩ + − − = | | | | | | | | | | | | | | | | | | | | | | | | (4) C B A C B C A B A C B A U C B A U C B A C B A ∩ ∩ − ∩ + ∩ + ∩ + − − − = ∪ ∪ − = ∪ ∪ ∩ ∩
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
26
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
27
1到250的整數中 ,可被3或 5或 7 整除的數有
Ans:
假設能分別被3, 5, 7,整除的數字集合分別為 A, B, C
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
28
Throw two dice, how many ways of throwing: Throw two dice, how many ways of throwing: a total of 8, value 6+not value 6, or two identical values? Counting the possibilities: a total of eight: 5 value 6+not value 6: 10 two identical values: 6
two identical values: 6 total 8 and 6+not 6: 2 total 8 and two id-vs: 1 d id
6+not 6 and two id-vs: 6+not 6, two id-vs, total 8: 0
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
29
Under the assumption of equal likelihood, let Φ be a
Pr(a) = The probability that {a} occurs Pr(a) = The probability that {a} occurs
{ }
1 a Φ =
Pr(A) = The probability that A occurs =
n Φ A A Φ =
We often write Pr(a) for Pr({a})
n Φ
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
30
an even number? an even number?
Sample space Φ={1, 2, 3, 4, 5, 6}.
(a) event A={5, 6} Pr(A)=|A|/|Φ|= 2/6=1/3. (b) event B ={2, 4, 6} Pr(B)=|B|/|Φ|=3/6=1/2. Furthermore we also notice here that Furthermore we also notice here that i) Pr(Φ) =| Φ |/|Φ|= 6/6 =1—after all, the occurrence of the event is a certainty; and ii) Pr(A) =Pr({1, 2, 3, 4}) =|A|/Φ = 4/6=2/3=1 − 1/3 = 1 − Pr(A).
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
31
Ex 3.37 :
In a survey of 120 passengers, an airline found that 48 enjoyed
wine with their meals, 78 enjoyed mixed drinks, and 66 enjoyed iced tea. In addition, 36 enjoyed any given pair of these beverages and 24 passengers enjoyed them all If two passengers beverages and 24 passengers enjoyed them all. If two passengers are selected at random from the survey sample of 120, what is the probability that
a) (Event A) they both want only iced tea with their meals?
b) (Event B) they both enjoy exactly two of the three
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
32
The sample space Φ consists of the pairs of passengers we
The Venn diagram indicates that there are 18 passengers
C(120,2)
18
so |A|= and Pr(A) =51/ 2380. |B|= Pr(B) =3/ 34.
18 2
36 2
W:48, M:78, T:66 W∩T:36, W∩M:36, T∩M:36 W∩T∩M:24
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
33
− = A) Pr( 1 ) A ( Pr : Complement
Rule The ) 1
A A
∩ + = ∪ ∩ − + = ∪ B A B A B A B A B A B A B A ) Pr( ) Pr( ) Pr( ) ( Pr disjoint, are , When ) Pr( ) Pr( ) Pr( ) ( Pr : Rule Additive The ) 2
A B A
= = ∩ ∩ = B A B A B A B A B B A B A ) | Pr( ) Pr( ) | Pr( ) Pr( ) ( Pr : Rule tive Multiplica The ) 4 ) Pr( ) Pr( ) | Pr( : y Probabilit l Conditiona ) 3 + = = ∩ A B A A B A B B A B A B A ) | Pr( ) Pr( ) | Pr( ) Pr( ) Pr( : y Probabilit Total
Law ) 5 ) Pr( ) Pr( ) ( Pr t, independen are , When φ + = ∩ = = ∩ ∑ =
= j i n i i i
A B A A B A A B A B B A B A A A A B A B ) | Pr( ) Pr( ) | Pr( ) Pr( ) | Pr( ) Pr( ) Pr( ) Pr( ) | Pr( : Theorem Bayes' ) 6 , ) | Pr( ) Pr( ) Pr( : version) (Extended
1
φ = ∩ ∑ = ∩ = +
= j i n i i i k k k k
A A A B A A B A B B A B A A B A A B A B , ) | Pr( ) Pr( ) | Pr( ) Pr( ) Pr( ) Pr( ) | Pr( : version) (Extended ) | Pr( ) Pr( ) | Pr( ) Pr( ) Pr(
1
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
34
i 1
3.1: 2, 20 3 2: 4 8 3.2: 4, 8 3.3: 6
Discrete Mathematics Discrete Mathematics – – CH3 CH3 2009 Spring 2009 Spring
35