100
DISCRETE STRUCTURES

DISCRETE STRUCTURES

  • Upload
    jeroen

  • View
    52

  • Download
    0

Embed Size (px)

DESCRIPTION

DISCRETE STRUCTURES. LOGICAL STRUCTURE. Logic - study of reasoning - focuses on the relationship among statements as opposed to the content of any particular statement. - PowerPoint PPT Presentation

Citation preview

Page 1: DISCRETE STRUCTURES

DISCRETE STRUCTURES

Page 2: DISCRETE STRUCTURES

LOGICAL STRUCTURE

• Logic - study of reasoning - focuses on the relationship among statements as opposed to the content of any particular statement.

Logical methods are used in mathematics to prove theorems and in computer science to prove that programs do what they are alleged to do.

ex. All mathematicians wear sandals.Anyone who wears sandals is an algebraist.Therefore, all mathematicians are algebraist.

Page 3: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Propositions – A sentence that is either true or false, but not both.

Examples:• 1+1=3• 2+2=4

- A fact-based declaration is a proposition, even if no one knows whether it is true.

Page 4: DISCRETE STRUCTURES

LOGICAL STRUCTURE

- A statement cannot be true or false unless it is declarative. This excludes commands and questions.

examples:• What time is it?• Go home.

Page 5: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition Let p and q be propositions • The conjunction of p and q, denoted by p ᴧ q,

is the proposition p and q• The disjunction of p and q, denoted p ᴠ q, is

the proposition p or q

Page 6: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Compound proposition – combination of propositionsExample : p: 1+1 = 3 q: a decade is 10 yearsthen: conjunction: p ᴧ q : 1+1 = 3 and a decade is 10

years.disjunction: p ᴠ q : 1+1 = 3 or a decade is 10 years

Page 7: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Each sentence or the propositions has a truth value of either true or false. The truth values of propositions can be described by truth tables.

Page 8: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition The truth value of the compound proposition p ᴧ q is defined by the truth table

- states that the conjunction p ᴧ q is true provided that p and q are both true; p ᴧ q is false otherwise.

p q p ᴧ q T T TT F FF T FF F F

Page 9: DISCRETE STRUCTURES

LOGICAL STRUCTURE

DefinitionThe truth value of the compound proposition p ᴠ q is

defined by the truth table

- states that the disjunction p ᴠ q is true if either p or q or both are true; false if both p and q are false

p q p ᴠ q

T T T

T F T

F T T

F F F

Page 10: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition The negation of p denoted by ¬p is the proposition not p.The truth value of the proposition ¬p is defined by the

truth table

In other words, the negation of a proposition has the opposite truth value from the proposition itself.

p ¬p

T F

F T

Page 11: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Example

p: Blaise Pascal invented several calculating machines.

q: The first all-electronic digital computer was constructed in the 20th century.

r: П was calculated to 1M decimal digits in 1954

Page 12: DISCRETE STRUCTURES

LOGICAL STRUCTURE

• represent the proposition:

Either Blaise Pascal invented several calculating machines and it is not the case that the first all electronic digital computer was constructed in the 20th century; or П was calculated to 1M decimal digits in 1954.

Page 13: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition: If p and q are propositions, the compound

propositions if p then q is called conditional proposition and is denoted by p→ q.

• The proposition p is called the hypothesis (or antecedent) and the proposition q is called the conclusion (or consequent)

Page 14: DISCRETE STRUCTURES

LOGICAL STRUCTURE

example:p: The Math Dept. gets an additional Php 200,00.q: The Math Dept. hires one new faculty memberp→ q: If the Math Dept. gets an additional Php 200,000, then it will hire one new faculty

member.

Page 15: DISCRETE STRUCTURES

LOGICAL STRUCTURE

p→ q• if p then q• p implies q (q is implied by p)• whenever p, q (q whenever p)• q unless ¬p• p only if q (if not q then not p)• ¬q implies ¬p• p is a sufficient condition for q• q is a necessary condition for p

Page 16: DISCRETE STRUCTURES

LOGICAL STRUCTURE

examples1. If 3+3=7, then you are the pope.2. If the Lakers win the NBA, then they sign Artest.

A necessary condition for the Lakers to win the NBA is that they sign Artest.

3. If John takes calculus, then he passed algebra.John may take calculus only if he passed algebra.

4. If Jane goes to EK, then she visits Laguna.A sufficient condition for Jane to visit Laguna is that she goes to EK.

Page 17: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition: The truth value of the conditional proposition p→ q is defined by the following truth table.

p q p→q

T T T

T F F

F T T

F F T

Page 18: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Examples:1. p: 1>2 False q: 4<8 True p→ q ?

q→ p ?2. Given p is true, q is false, r is true, find the truth

value of:a. (pᴧq)→rb. (pᴠq)→¬r

Page 19: DISCRETE STRUCTURES

LOGICAL STRUCTURE

NOTE:• Converse: The proposition q→ p is the converse

of the proposition p→ q.• Inverse: The proposition ¬p→¬q is the inverse of

the proposition p→ q.• Contrapositive: The contrapositive (or

transposition) of the conditional proposition p→ q is the proposition ¬q→¬p.

Page 20: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Example:“The home team wins whenever it is raining” (“If it is raining, then the home team wins.”)Converse: “ If the home team wins, then it is

raining.”Inverse: “ If it is not raining, then the home team

does not win.”Contrapositive: “If the home team does not win,

then it is not raining.”

Page 21: DISCRETE STRUCTURES

LOGICAL STRUCTURE

DefinitionIf p and q are propositions, the compound proposition p if and only if q is called a biconditional proposition and is denoted by p↔ q.

Page 22: DISCRETE STRUCTURES

LOGICAL STRUCTURE

p↔ q• p is equivalent to q• p iff q• p is a sufficient and necessary condition for q• p →q and q→ p (p implies q and q implies p)

Page 23: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Definition The truth value of the proposition p↔ q is defined

by the following truth table.

Example: 1<5 iff 2<8

p q p↔q

T T T

T F F

F T F

F F T

Page 24: DISCRETE STRUCTURES

LOGICAL STRUCTURE

DerfinitionSuppose that the compound propositions P and Q are made up of the propositions p1,p2,…,pn . We say that P and Q are logically equivalent and write P ≡ Q , provided that given any truth values of p1,p2,…,pn , either P and Q are both true or P and Q are both false.

Page 25: DISCRETE STRUCTURES

LOGICAL STRUCTURE

example: 1. De Morgan’s Laws for Logic¬ (pᴠq) ≡ ¬p ᴧ ¬q2. ¬(p→q) ≡ pᴧ¬q3. State whether P ≡ Q

a. P = pᴧ(¬qᴠr) ; Q = pᴠ(qᴧ¬r) b. P = (p→q)→r ; Q = p→(q→r)

Note: The conditional proposition p→q and its contrapositive ¬q→¬p are logically equivalent.

Page 26: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Exercises:A. Let p,q,r be the following sentencesp: John is at the office.q: Joan is at the office.r: Laura is at the office.

Use logical connectives to express the following sentences:

1. John is not at the office.2. If Joan and Laura are at the office then John is at the

office.

Page 27: DISCRETE STRUCTURES

LOGICAL STRUCTURE

3. If John is at the office then either Joan or Laura is at the office.

4. John, Joan and Laura are all at the office.5. Joan is not at the office and either John or

Laura are at the office.6. If Laura is not at the office then John and Joan

are both at the office.

Page 28: DISCRETE STRUCTURES

LOGICAL STRUCTURE

B. Translate the following into logical expression.1. “ You can access the internet from campus

only if you are a computer science major or you are not a freshman.”

2. “ You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old.”

Page 29: DISCRETE STRUCTURES

LOGICAL STRUCTURE

C. Solve a CrimeFour friends have been identified as suspects for an unauthorized access into a computer system. They have made statements to the investigating authorities. Alice said “Carlos did it.” John said “ I did not do it .” Carlos said “ Diana did it.” Diana said “Carlos lied when he said that I did it.”

If the authorities also know that exactly one of the four suspects is telling the truth, who did it?

Page 30: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Theorem The following list of logically equivalent properties can be established using truth tables.

1. Indempotent Lawspᴧp ≡ ppᴠp ≡ p

2. Double Negation¬(¬p) ≡ p

3. De Morgan’s Laws¬ (pᴠq) ≡ ¬p ᴧ ¬q¬ (pᴧq) ≡ ¬p ᴠ ¬q

4. Commutative propertiespᴧq ≡ qᴧppᴠq ≡ qᴠp

Page 31: DISCRETE STRUCTURES

LOGICAL STRUCTURE

5. Associative propertiespᴧ(qᴧr) ≡ (pᴧq)ᴧr pᴠ(qᴠr) ≡ (pᴠq)ᴠr

6. Distributive propertiespᴧ(qᴠr) ≡ (pᴧq)ᴠ(pᴧr)pᴠ(qᴧr) ≡ (pᴠq)ᴧ(pᴠr)

7. Equivalence of Contrapositive p→q ≡ ¬q→¬p

8. Other useful properties p→q ≡ ¬pᴠqp↔q ≡ (p→q)ᴧ(q→p)

Page 32: DISCRETE STRUCTURES

LOGICAL STRUCTURE

QUANTIFIERS

Definition Let P(x) be a statement involving the variable x

and let D be a set. We call P a propositional function (with respect to D) if for each x in D, P(x) is a proposition. We call D the domain of discourse of P.

Page 33: DISCRETE STRUCTURES

LOGICAL STRUCTURE

P(x): value of the propositional function P of x.

Example:“x>5” these statement is not a proposition

because whether it is true or false depends on the value of x.Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.

Page 34: DISCRETE STRUCTURES

LOGICAL STRUCTURE

In general, a statement involving n variables x1, x2,…,xn can be denoted by P(x1, x2,…,xn ). A statement of the form P(x1, x2,…,xn ) is the value of the propositional function P at the n-tuples (x1, x2,…,xn ) and P is also called a predicate.

Page 35: DISCRETE STRUCTURES

LOGICAL STRUCTURE

To create proposition from a propositional function:

• Assign values to the variables• Quantification

types: 1. universal quantification 2. existential quantification

Page 36: DISCRETE STRUCTURES

LOGICAL STRUCTURE

DefinitionThe universal quantification of P(x) is the proposition “P(x) is true for all values of x in the domain of discourse.”

Notation:• denotes the universal quantification of P(x)• called the universal quantifier• read as “for all x P(x)” ; “for every x P(x)”• true if P(x) is true for every x• false if P(x) is false for at least one x in the Domain

)(xxP

)(xxP

Page 37: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Examples: Domain for x is the set of real numbers1. P(x): “x+1>x”2. P(x): “x>5”3. Q(x): “x2 >= x”

Note: is false if P(x) is false for at least one x in D. A value x in the domain of discourse that makes P(x) false is called a counterexample to the statement .

)(xxP

)(xxP

Page 38: DISCRETE STRUCTURES

LOGICAL STRUCTURE

DefinitionThe existential quantification of P(x) is the proposition “There exist an element x in the domain of discourse such that P(x) is true.

Notation:• denotes the existential quantification of x• is called the existential quantifier• read as “there is an x s.t. P(x)”

“there is at least one x s.t. P(x)” “for some x, P(x)”

)(xxP

)(xxP

Page 39: DISCRETE STRUCTURES

LOGICAL STRUCTURE

• true if P(x) is true for at least one x in the domain

• false if P(x) is false for every x in the domain Examples: Domain is the set of real numbers1. P(x): x>32. Q(x): x = x+13. P(x): 12 x

x

Page 40: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Exercises. Give the domain.1. 2.True or False. Domain is the set of integers.P(x): x>2 Q(x): x<21. 2.

)1( 2 xx

Page 41: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Negation with Quantifiers

example : Every student in the class has taken a course in calculus.

P(x) :“x has taken a course in calculus”

Negation of : • It is not the case that every student in the class has taken a course

in calculus.• There is a student in the class who has not taken a course in

calculus.:

)()( xPxxxP

)(xxP

)(xxP )(xxP

)(xPx

Page 42: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Example :There is a student in this class who has taken a course in calculus.

Q(x) :“x has taken a course in calculus”

Negation of • It is not the case that there is a student in this class who has

taken a course in calculus.• Every student in this class has not taken calculus.

:

)()( xQxxxQ

)(xxQ

)(:)( xxQxxQ

)(xQx

Page 43: DISCRETE STRUCTURES

LOGICAL STRUCTURE

RULES of INFERENCEDefinition (Argument)An argument is a sequence of propositions

written as. The propositions p1,p2,…,pn are called the hypotheses (or premises), and the proposition q is called the conclusion. The argument is valid provided that if p1 andp2 and pn are all true, then q must also be true; otherwise, the argument is invalid (or a fallacy).

Page 44: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Rules of inference- brief and valid argument used within a larger argument such as proof

Example Determine whether the argument is valid.

p→qp q

D:\DiscreteMath\QUANTIFIERS.doc

Page 45: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Example (A Logical Argument)If I dance all night, then I get tired.I danced all night.Therefore I got tired.

Logical representation of the underlying variables:p: I dance all night. q: I get tired.

Logical analysis of the argument:p→qp q

Page 46: DISCRETE STRUCTURES

LOGICAL STRUCTURE

If I dance all night, then I get tired.I got tired.Therefore I danced all night.

Logical form of argument:p→qq p

Page 47: DISCRETE STRUCTURES

LOGICAL STRUCTURE

Examples:1. Show that the hypotheses “ If you send me an

email message, then I will finish writing the program,” If you do not send me an email message, then I will go to sleep early,” and “If I go to sleep early, then I will wake up feeling refreshed “ lead to the conclusion “If I do not finish writing the program, then I will wake up feeling refreshed.”

Page 48: DISCRETE STRUCTURES

LOGICAL STRUCTURE

2. Show that the hypotheses "It is not sunny this afternoon and it is colder than yesterday," "We will go swimming only if it is sunny," "If we do not go swimming, then we will take a canoe trip, " and " If we take a canoe trip, then we will be home by sunset" lead to the conclusion "We will be home by sunset. "

Page 49: DISCRETE STRUCTURES

FUNCTIONS

Page 50: DISCRETE STRUCTURES

FUNCTIONS

DefinitionLet A and B be sets. A function f from A to B is an assignment of exactly one B element to each element of A . We write f(a)=b if b is the unique element of B assigned by the function f to the element a of A. If is a function from A to B, we write f:A→B.

Page 51: DISCRETE STRUCTURES

FUNCTIONS

DefinitionIf f is a function from A to B, we say that A is the domain of f and B is the codomain of f. If f(a)=b, we say that b is the image of a and a is a pre-image of b. The range of f is the set of all images of elements of A. Also, if f is a function from A to B , we say that f maps A to B .

Page 52: DISCRETE STRUCTURES

FUNCTIONS

A function f from A to B is said to be one-to-one, or injective if for each bϵ B, there is at most one aϵA with f(a)=b. A function is said to be an injection if it is one-to-one.

A function f from A to B is called onto, or surjective if and only if for every element bϵB there is an aϵA element with f(a)=b . A function is said to be surjection if it is onto.

Page 53: DISCRETE STRUCTURES

FUNCTIONS

The function f is a one-to-one correspondence, or bijection, if it is both one-to-one and onto.

Example:Let S=1,2,3,4,5 and T=a,b,c,d. For each question below if your answer is yes, give an example; if your answer is no, explain briefly.

1. Are there any one-to-one functions from S to T?2. Are there any functions mapping S onto T?3. Are there any one-to-one correspondences

between S and T?

Page 54: DISCRETE STRUCTURES

FUNCTIONS

Definition(Inverse)Let f be a one-to-one correspondence from the set A to the set B. The inverse function of f is the function that assigns to an element b belonging to B the unique element a in A such that f(a)=b . The inverse function of f is denoted by f¯¹. Hence, f¯¹ (b)=a when f(a)=b .

Page 55: DISCRETE STRUCTURES

FUNCTIONS

Definition(Composition)

Let g be a function from the set A to the set B and let f be a function from the set B to the set C. The composition of the functions f and g , denoted by fg is defined by (fg)(a)=f(g(a)).

(not defined unless the range of g is a subset of the domain of f)

Page 56: DISCRETE STRUCTURES

FUNCTIONS

Examples: Let A= 1,2,3,4,5 B=6,7,8,9C=10,11,12,13 D=,∆,◊,∂

Let R AxB, S BxC and T CxD be defined byR = (1,7),(4,6),(5,6),(2,8)S = (6,10),(6,11),(7,10),(8,13)T = (11, ∆),(10, ∆),(13, ∂),(12, ),(13, ◊)Compute the relations

Page 57: DISCRETE STRUCTURES

FUNCTIONS

DefinitionThe floor function that assigns to the real number x is the largest integer that is less than or equal to x . The value of the floor function at is denoted by Lx˩ . The ceiling function assigns to the real number x the smallest integer that is greater than or equal to x. The value of the ceiling function at is denoted by Гx˥.

Page 58: DISCRETE STRUCTURES

COMBINATORIAL STRUCTURES

Page 59: DISCRETE STRUCTURES

COUNTING

Examples1. How many positive integers of two different

digits can be formed from the integers 1,2,3, and 4?

2. How many different arrangements of six distinct books each can be made on a shelf with space for six books?

Page 60: DISCRETE STRUCTURES

COUNTING

Multiplication Principle If an activity can be constructed in t successive steps and step1 can be done in n1

ways, step 2 can be done in n2 ways, … , and stept can be done in nt ways, then the number of different possible activities is n1 n∙ 2 n∙∙∙ t

Page 61: DISCRETE STRUCTURES

COUNTING

Example Given:

1. List all possible dinners consisting of one main course and one beverage.

2. List all possible dinners consisting of one appetizer, one main course and one beverage.

3. List all possible dinners consisting of one main course and an optional beverage.

APPETIZERS MAIN COURSES BEVERAGESNachos Hamburger TeaSalad Cheeseburger Milk

Fish Fillet SodaRoot Beer

Page 62: DISCRETE STRUCTURES

COUNTING

Examples1. How many different arrangements of each

consisting of four different letters can be formed from the letters of the word “PERSONAL” if each arrangement is to begin and end with a vowel.

2. Suppose that three of six books are math books and three are art books.a. How many different arrangements of the six books can be made on the shelf if book on the same subject are to be kept together?

Page 63: DISCRETE STRUCTURES

COUNTING

b. How many different arrangements of the six books can be made on the shelf if math books are to be kept together but three art books can be placed anywhere?

3. In how many ways can we select two books from different subjects among five distinct computer science books, three distinct math books and two distinct art books?

Page 64: DISCRETE STRUCTURES

COUNTING

Definition (Permutation)A permutation of n distinct elements x1,…,xn is an ordering of the n elements x1,…,xn .

Page 65: DISCRETE STRUCTURES

COUNTING

Definition (Permutation)Let S be a set containing n elements and suppose r is a positive integer such that r≤n . Then a permutation of r elements of S is an arrangement in a definite order, without repetitions, of r elements of S .

notations: nPr; P(n,r); Pn,r ; “permutations of n taken r”

Page 66: DISCRETE STRUCTURES

COUNTING

TheoremThe number of permutations n of elements taken r at a time is given by either of the following formulas:

a. nPr = n(n-1)(n-2)…(n-r+1)

b. nPr = n!/(n-r)!

Page 67: DISCRETE STRUCTURES

COUNTING

Example1. A bus has seven vacant seats. If three

additional passengers enter the bus, in how many ways can they be seated?

2. In how many ways can four boys and four girls be seated in a row containing eight seats if

a) a person may sit in any seatb) boys and girls must alternate seats

Page 68: DISCRETE STRUCTURES

COUNTING

TheoremIf we are given n element, of which exactly m1 are alike of one kind, exactly m2 are alike of a second kind, …, and exactly mk are alike of the kth kind, and if n = m1 + m2 +…+ mk then the number of distinguishable permutations that can be made of the n elements taking them all at one time is .

!m!...m!m!n

k21

Page 69: DISCRETE STRUCTURES

COUNTING

Example1. How many strings can be formed using the

following letters MISSISSIPPI?2. How many different signals each consisting of

eight flags hung one above the other , can be formed from a set of three indistinguishable red flags, two indistinguishable blue flags, two indistinguishable white flags and one black flag?

Page 70: DISCRETE STRUCTURES

COUNTING

Definition(Combination)

Let S be a set containing n elements and suppose r is a positive integer such that r < n. Then a combination of r elements of S is a subset of S containing r distinct elements.

Page 71: DISCRETE STRUCTURES

COUNTING

Theorem

The number of combinations of n elements taken r at a time is given by nCr = nPr / r!

= n! /(n-r)! r!

Page 72: DISCRETE STRUCTURES

COUNTING

Example1. A football conference consists of eight

teams. If each team plays every other team, how many conference games are played?

2. A student has ten posters to pin up on the walls of her room, but there is space for only seven. In how many ways can the student choose the posters to be pinned up?

Page 73: DISCRETE STRUCTURES

COUNTING

3. In how many ways can we select a committee of two women and three men from a group of 5 distinct women and 6 distinct men?

4. How many poker hands contain cards all of the same suit?

5. From 6 history books and 8 language books, in how many ways can a person select two history books and three language books and arrange them on a shelf?

Page 74: DISCRETE STRUCTURES

COUNTING

Binomial Theorem

If n is any positive integer, then

nnn

rrnrn

nn

nn

nn

n bC...baC...baCbaCaCba 222

110

Page 75: DISCRETE STRUCTURES

PROBABILITY

PROBABILITY

• Random experiment• Sample space• Event as a subset of sample space• Likelihood of an event to occur- probability of

an event

Page 76: DISCRETE STRUCTURES

PROBABILITY

Features of a Random Experiment

• all outcomes are known in advance.• The outcome of any one trial cannot be

predicted with certainty.• Trials can be repeated under identical

conditions.

Page 77: DISCRETE STRUCTURES

PROBABILITY

Examples (Random Experiment)

• Rolling a die and observing the number of dots on the upturned face.

• Tossing a coin and observing the upturned face.

Page 78: DISCRETE STRUCTURES

PROBABILITY

Sample Space

It is a set such that each element denotes an outcome of a random experiment.It is usually denoted by Ω or S.

Example.Rolling a die and observing the number of dots on the upturned face.

S = 1,2,3,4,5,6

Page 79: DISCRETE STRUCTURES

PROBABILITY

Event

A subset of the sample space whose probability is defined.

ExampleS = 1,2,3,4,5,6a. An event of observing odd number of dots in

a roll of a die : E1 = 1,3,5b. An event of observing even number of dots in

a roll of a die : E2 = 2,4,6

Page 80: DISCRETE STRUCTURES

PROBABILITY

Two events are mutually exclusive if the two events cannot occur simultaneously.

ExampleCoin toss: either a head or a tail, but not both. The events head and tail are mutually exclusive.

Page 81: DISCRETE STRUCTURES

PROBABILITY

Definition(Probability)The probability of an event E , which is a subset of a finite sample space S of equally likely outcomes is P(E) = |E|/|S|

note: A probability function P assigns to each outcome x in a sample space S a number P(x) so that 0 < P(x) < 1 for all x in S and

∑ P(x) = 1 .

Page 82: DISCRETE STRUCTURES

PROBABILITY

Example:If we select a card at random from a well shuffled deck of cards then,P(ace in a deck of cards)= 4/52

Note: Probability of a joint event, A and BP(A and B) = P(A∩B)ExampleP(red card and Ace) = 1/26

Page 83: DISCRETE STRUCTURES

PROBABILITY

Theorems1. Let E be an event. The probability of Ē, the

complement of E , satisfies P(E) +P(Ē) = 1 .2. Let E1 and E2 be events. Then

P(E1 U E2) = P(E1) + P(E2) – P(E1∩ E2) note: If E1 and E2 are mutually exclusive

events, P(E1 U E2) = P(E1) + P(E2)

Page 84: DISCRETE STRUCTURES

PROBABILITY

Exercises1. Find errors in each of the ff assignments of

probabilities.a. The probabilities that a student will have 0,1,2, or

3 or more mistakes are 0.51, 0.47, 0.24, and -0.12 respectively.

b. The probability that it will rain tomorrow is 0.46 and the probability that it will not rain tomorrow is 0.55.

Page 85: DISCRETE STRUCTURES

PROBABILITY

2. P(King or Spade)3. P(King or Queen)4. If two dice are thrown, what is the probability

of obtaining sum of 7? of 5?5. What is the probability of obtaining a sum of 7

or 5 if the two dice are thrown?

Page 86: DISCRETE STRUCTURES

PROBABILITY

Definition(Conditional Probability)Let E and F be events with P(F)>0. The conditional probability of E given F , denoted by P(E|F) is defined as

P(E|F) = P(E∩F)/P(F)note: If E and F are independent events

P(E) = P(E|F)The events E and F are independent if and only if: P(E∩F) = P(E)P(F)

Page 87: DISCRETE STRUCTURES

PROBABILITY

From a deck of 52 cards, P(Ace|red) = ?

A Deck of 52 cards

Type Color TotalRed Black

Ace 2 2 4Non-Ace 24 24 48Total 26 26 52

Page 88: DISCRETE STRUCTURES

PROBABILITY

Example:What is the probability of getting a sum of 10, given that at least one die shows 5, when two fair dice are rolled?

Page 89: DISCRETE STRUCTURES

PROBABILITY

Solution:Let E be the event of getting a sum of 10

F be the event that at least one die shows 5

P(E∩F) – probability of getting a sum of 10 and at least one die shows 5

11

13611361

FP

FEPF|EP

Page 90: DISCRETE STRUCTURES

PROBABILITY

Example:Weather records shows that the probability of high barometric pressure is 0.80, and the probability of rain and high barometric pressure is 0.10. What is the probability of rain given high barometric pressure?

Page 91: DISCRETE STRUCTURES

PROBABILITY

Solution: R – denotes the event of “rain” H – denotes the event of “ high barometric

pressure”

8

1800100

..

HPHRP

H|RP

Page 92: DISCRETE STRUCTURES

PROBABILITY

Example (Independent Events)1. Tossing a coin: What is the probability that

head on first toss and tail on second?2. Are the events that a family with 3 children

has children of both sexes, and that a family with three children has at most one boy, independent? Assume that the eight ways a family can have 3 children are equally likely.

Page 93: DISCRETE STRUCTURES

PROBABILITY

3. Joe and Olivia take a final exam in discrete structures. The probability that Joe passes is 0.70 and the probability that Olivia passes is 0.95. Assuming that the events “Joe passes” and “Olivia passes” are independent, find the probability that Joe or Olivia passes or both passes the final exam?

Page 94: DISCRETE STRUCTURES

PROBABILITY

Baye’s TheoremSuppose that the possible classes are C1,…,Cn. Suppose further that each pair of classes is mutually exclusive and each item to be classified belongs to one of the classes. For a feature set F, we have

n

iii

jjj

CPC|FP

CPC|FPF|CP

1

Page 95: DISCRETE STRUCTURES

PROBABILITY

Example1. At a call center company, David, Rose, and Lea

make calls. The following table shows the percentage of calls each caller makes and the percentage of persons who are annoyed and hang up on each call.

Caller

David Rose Lea% calls 40 25 35% hang ups 20 55 30

Page 96: DISCRETE STRUCTURES

PROBABILITY

Let D – event “David made the call” R – event “Rose made the call”

L – event “Lea made the call” H - event “the caller hang up”

Find P(D), P(R), P(L), P(H|D), P(H|R), P(H|L), P(D|H), P(R|H), P(L|H), P(H).

Page 97: DISCRETE STRUCTURES

PROBABILITY

2. The sample space S is described as “the integers 1 to 15” and is partitioned into:

E1 – “the integers 1 to 8”E2 – “the integers 9 to 15”If E is the event “even number”, what is P(E1|E)?

3.Of all the smokers in a town, 40% prefer brand A and 60% prefer brand B. Of those smokers who prefer brand A, 30% are female, and of those who prefer brand B, 40% are female. What is the probability that a randomly selected smoker prefers brand A, given that the person selected is female.

Page 98: DISCRETE STRUCTURES

Pigeonhole Principle

Pigeonhole Principle (Dirichlet drawer principle)

Suppose that a flock of pigeons flies into a set of pigeonholes to rest. The pigeonhole principle states that if there are more pigeons than pigeonholes, then there must be at least one pigeonhole with at least two pigeons in it.

TheoremIf k+1 or more objects are placed into k boxes, then there is at least one box containing two or more objects.

Page 99: DISCRETE STRUCTURES

Pigeonhole Principle

Examples1. Among any group of 367 people, there must be

at least two with the same birthday.2. In any group of 27 English words, there must

be at least two that begin with the same letter.3. How many students must be in a class to

guarantee that at least two students receive the same score on the final exam, if the exam is graded on the scale from 0 to 100 points?

Page 100: DISCRETE STRUCTURES

Pigeonhole Principle

4. Each week a man goes to a shopping center where there are seven stores, and shops at two of the stores. If he goes to the shopping center for 43 weeks, prove that he must shop at some pair of stores at least three times.