Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 3 Set Theory.

Similar presentations


Presentation on theme: "1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 3 Set Theory."— Presentation transcript:

1 1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 3 Set Theory

2 2 Sets Set = a collection of distinct unordered objects How to designate a set  Listing  A = {1,3,5,7}  Description  B = {x | x = 2k + 1, 0 < k < 3} Members of a set are called elements  Examples  1  {1,3,5,7}; 2  {1,3,5,7}

3 3 Universe and empty sets Universe  is the set of all elements about which we make assertions. The empty set  or { } has no elements. Also called null set or void set.

4 4 Finite and infinite sets Finite sets  Examples  A = {1, 2, 3, 4}  B = {x | x is an integer, 1 < x < 4} Infinite sets  Examples  Z = {integers} = {…, -3, -2, -1, 0, 1, 2, 3,…}  S={x| x is a real number and 1 < x < 4} = [0, 4]

5 5 Some important sets  = {all integers} = {0, 1, -1, 2, -2, …}  + = {all positive integers} = {1, 2, 3, …}  = {all natural numbers or nonnegative integers} = {0, 1, 2, …}  = {all rational numbers} = {a/b| a,b  , b  0}  = {all real numbers}  = {all complex numbers} = { x+yi | x,y  , i 2 = -1}

6 6 Cardinality Cardinality or size of a set A (in symbols |A|) is the number of elements in A  Examples  If A = {1, 2, 3} then |A| = 3  If B = {x | x is a natural number and 1< x< 9} then |B| = 9 Infinite cardinality  Countable (e.g., natural numbers, integers, rational numbers)  Uncountable (e.g., real numbers)

7 7 Subsets X is a subset of Y if every element of X is also contained in Y (in symbols X  Y) X is a proper subset of Y if X  Y but Y  X (Y  X) Equality: X = Y iff X  Y and Y  X

8 8 Theorem 3.1 Let A, B, C  . If A  B and B  C, then A  C. Proof.  A  B   x [x  A  x  B]  B  C   x [x  B  x  C]   x [x  A  x  C]  A  C (Law of Syllogism)  A  B   y [y  B and y  A]  B  C  y  C and y  A  A  C. #

9 9 Theorem 3.2 For any universe , let A  . Then   A, and if A  , then   A. Proof. Assume   A.   x [x   and x  A]      A (by Contradiction)  A     y [y  A]    A. #

10 10 Power set The power set of X is the set of all subsets of X, in symbols P (X), i.e., P (X)= {A | A  X}  Example  if X = {1, 2, 3}, then P (X) = { , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} If |X| = n, then (1) there are C(n,k) subsets of size k for 0  k  n; and (2) | P (X)| = 2 n.

11 11 Union and intersection Given two sets X and Y The union of X and Y is defined as the set X ∪ Y = { x | x  X or x  Y} The intersection of X and Y is defined as the set X ∩ Y = { x | x  X and x  Y} Two sets X and Y are disjoint if X ∩ Y = 

12 12 Difference and complement The difference ( 差集 ) of two sets X and Y X – Y = { x | x  X and x  Y} The symmetric difference of two sets X and Y X Δ Y = (X – Y) ∪ (Y – X) The complement ( 補集 ) of a set A contained in a universe  is the set A c =  – A

13 13 Laws of set operations (1) For any sets A, B and C taken from a universe . 1) Law of Double Complement ( 回歸律 ): (A c ) c = A 2) De Morgan’s laws: (A ∪ B) c = A c ∩B c (A∩B) c = A c ∪ B c 3) Commutative laws ( 交換律 ): A ∪ B = B ∪ A A ∩ B = B ∩ A

14 14 Laws of set operations (2) 4) Associative laws ( 結合律 ): (A ∪ B) ∪ C = A ∪ (B ∪ C) (A ∩ B) ∩ C = A ∩ (B ∩ C) 5) Distributive laws ( 分配律 ): A ∩ (B ∪ C) = (A∩B) ∪ (A∩C) A ∪ (B∩C) = (A ∪ B) ∩ (A ∪ C) 6) Idempotent laws ( 等冪律 ): A ∪ A = A A∩A = A 7) Identity laws ( 同一律 ): A ∩  = A A ∪  = A

15 15 Laws of set operations (3) 8) Inverse laws ( 互補律 ): A ∪ A c =  A ∩ A c =  9) Domination laws ( 支配律 ): A ∪  =  A∩  =  10) Absorption laws ( 吸收律 ): A ∪ (A∩B) = A A∩ (A ∪ B) = A

16 16 Proof of Associative laws Associative laws: x  (A ∪ B) ∪ C  x  (A ∪ B) or x  C  (x  A or x  B) or x  C  x  A or (x  B or x  C)  x  A or x  (B ∪ C)  x  A ∪ (B ∪ C) 同法可證 (A ∩ B) ∩ C = A ∩ (B ∩ C). #

17 17 Proof of De Morgan’s laws De Morgan’s laws: x  (A ∪ B) c  x  (A ∪ B)  x  A and x  B  x  A c and x  B c  x  A c ∩ B c 同法可證 (A ∩ B) c = A c ∪ B c. #

18 18 Generalized De Morgan’s laws Let I be an index set and A i   for all i  I. Then a) b) Proof of a). x   x    i  I [x  A i ]   i  I [x  A i c ]  x . #

19 19 Venn diagrams A Venn diagram provides a graphic view of sets. Set union, intersection, difference, symmetric difference and complements can be identified.

20 20 Counting vs. Venn diagrams If A, B, C are finite sets, then |A  B  C| = |A| + |B| + |C| - |A  B| - |A  C| - |B  C| + |A  B  C|. A B C

21 21 An experiment is a process that yields an outcome An event is an outcome or a set of outcomes from an experiment The sample space is the event of all possible outcomes Introduction to probability

22 22 Probability Probability of an event is the number of outcomes in the event divided by the number of outcomes in the sample space. If S is a finite sample space and E is an event (E is a subset of S) then the probability of E is P(E) = |E| / |S|

23 23 Discrete probability theory When all outcomes are equally likely and there are n possible outcomes, each one has a probability 1/n. BUT this is not always the case. When all probabilities are not equal, then some probability (possibly different numbers) must be assigned to each outcome.

24 24 A probability function P is a function from the set of all outcomes (sample space S) to the interval [0, 1], in symbols P : S  [0, 1] The probability of an event E  S is the sum of the probabilities of every outcome in E P(E) = Probability function

25 25 Probability of an event Given E  S, we have 0 < P(E) < P(S) = 1 If S = {x 1, x 2,…, x n } is a sample space, then P(S) = = 1 If E c is the complement of E in S, then P(E) + P(E c ) = 1

26 26 Events in a sample space Given any two events E 1 and E 2 in a sample space S. Then P(E 1  E 2 ) = P(E 1 ) + P(E 2 ) – P(E 1  E 2 ) We also have P(  ) = 0 Events E 1 and E 2 are mutually exclusive if and only if E 1  E 2 = . In this case P(E 1  E 2 ) = P(E 1 ) + P(E 2 )

27 27 Conditional probability Conditional probability is the probability of an event E, given that another event F has occurred. In symbols P(E|F). If P(F) > 0 then P(E|F) = P(E  F) / P(F) Two events E and F are independent if P(E  F) = P(E)P(F)

28 28 Pattern recognition Pattern recognition places items into classes, based on various features of the items. Given a set of features F we can calculate the probability of a class C, given F: P(C|F) Place the item into the most probable class, i.e. the one C for which P(C|F) is the highest. Example: Wine can be classified as Table wine (T), Premium (R) or Swill (S). Let F  {acidity, body, color, price} Suppose a wine has feature F, and P(T|F) = 0.5, P(R|F) = 0.2 and P(S|F) = 0.3. Since P(T|F) is the highest number, this wine will be classified as table wine.

29 29 Bayes’ Theorem Given pairwise disjoint classes C 1, C 2,…, C n and a feature set F, then P(C j |F) = A / B, where A = P(F|C j )P(C j ) and B = P(F|C i )P(C i ) F C1C1 C2C2 C3C3

30 30 Proof of Bayes’ Theorem

31 31 Detecting HIV Virus Classes: H: has the HIV virus H c : does not have HIV virus Feature: Pos: ELISA test positive Given Information: P(H)=0.15, P(H c )=0.85, P(Pos|H)=0.95, P(Pos|H c )=0.02

32 32 Brainstorm 小明昨晚從 9 點到 11:30 間持續讀完五個科目:國文、數學、 英文、化學、生物(順序未知)。其中沒有同時讀兩個 科目的情形。另外每一科所花的時間也不同: 10 分、 20 分、 30 分、 40 分、 50 分(順序也未知)。已知 ( 1 )小明 10:05 正在讀數學。 ( 2 )第三順位只用 10 分鐘,第四順位則用 50 分鐘。 ( 3 )讀完國文後,讀數學;讀完英文( 20 分鐘)後, 讀化學。 問題: 請推算出小明在不同時段分別讀那一科。


Download ppt "1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 3 Set Theory."

Similar presentations


Ads by Google