Discrete Math Lecture 6: Discrete Probability

Slides:



Advertisements
Similar presentations
Discrete Probability Chapter 7.
Advertisements

Recursively Defined Functions
March 31, 2015Applied Discrete Mathematics Week 8: Advanced Counting 1 Discrete Probability Example I: A die is biased so that the number 3 appears twice.
CSC-2259 Discrete Structures
22C:19 Discrete Structures Discrete Probability Fall 2014 Sukumar Ghosh.
April 2, 2015Applied Discrete Mathematics Week 8: Advanced Counting 1 Random Variables In some experiments, we would like to assign a numerical value to.
Lec 18 Nov 12 Probability – definitions and simulation.
Counting and Probability The outcome of a random process is sure to occur, but impossible to predict. Examples: fair coin tossing, rolling a pair of dice,
1 Discrete Structures & Algorithms Discrete Probability.
1 Discrete Math CS 280 Prof. Bart Selman Module Probability --- Part a) Introduction.
1 Copyright M.R.K. Krishna Rao 2003 Chapter 5. Discrete Probability Everything you have learned about counting constitutes the basis for computing the.
1 Section 5.1 Discrete Probability. 2 LaPlace’s definition of probability Number of successful outcomes divided by the number of possible outcomes This.
Discrete Mathematics Lecture 5
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Great Theoretical Ideas in Computer Science.
Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProbability.
Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProbability.
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
1 9/8/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
1 9/23/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Discrete Mathematical Structures (Counting Principles)
Section 7.1. Section Summary Finite Probability Probabilities of Complements and Unions of Events Probabilistic Reasoning.
Chapter 7 With Question/Answer Animations. Section 7.1.
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Section 7.2. Section Summary Assigning Probabilities Probabilities of Complements and Unions of Events Conditional Probability Independence Bernoulli.
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
Random Variables. A random variable X is a real valued function defined on the sample space, X : S  R. The set { s  S : X ( s )  [ a, b ] is an event}.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CSE 321 Discrete Structures Winter 2008 Lecture 19 Probability Theory TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
September1999 CMSC 203 / 0201 Fall 2002 Week #9 – 21/23/25 October 2002 Prof. Marie desJardins.
Computing Fundamentals 2 Lecture 6 Probability Lecturer: Patrick Browne
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle.
Discrete Mathematics Math 6A Homework 6 Solution.
22C:19 Discrete Structures Discrete Probability Spring 2014 Sukumar Ghosh.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
ICS 253: Discrete Structures I Discrete Probability King Fahd University of Petroleum & Minerals Information & Computer Science Department.
A Brief Summary for Exam 2 Subject Topics Number theory (sections ) –Prime numbers Definition Relative prime Fundamental theorem of arithmetic.
Math 3680 Lecture #4 Discrete Random Variables. Let X denote the number of spots that appear when a fair die is thrown. Then we would expect that f X.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Section 7.1. Probability of an Event We first define these key terms: An experiment is a procedure that yields one of a given set of possible outcomes.
3/7/20161 Now it’s time to look at… Discrete Probability.
CS 104: Discrete Mathematics
Chapter 7 With Question/Answer Animations. Chapter Summary Introduction to Discrete Probability Probability Theory Bayes’ Theorem Expected Value and Variance.
Section 7.3. Why we need Bayes?  How to assess the probability that a particular event occurs on the basis of partial evidence.  The probability p(F)
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Chapter 7. Section 7.1 Finite probability  In a lottery, players win a large prize when they pick four digits that match, in the correct order, four.
Now it’s time to look at…
Introduction to Discrete Probability
ICS 253: Discrete Structures I
The Pigeonhole Principle
Probability – part 1 Prof. Carla Gomes Rosen 1 1.
Chapter 6: Discrete Probability
COCS DISCRETE STRUCTURES
22C:19 Discrete Math Discrete Probability
CS104:Discrete Structures
Conditional Probability
Discrete Probability Chapter 7 With Question/Answer Animations
CS100: Discrete structures
Now it’s time to look at…
Now it’s time to look at…
Discrete Mathematical Structures CS 23022
Representations of Integers
Now it’s time to look at…
Applied Discrete Mathematics Week 12: Discrete Probability
Now it’s time to look at…
Agenda Lecture Content: Discrete Probability
Presentation transcript:

461191 Discrete Math Lecture 6: Discrete Probability San Ratanasanya CS, KMUTNB

Today’s topics Basic of Counting Review Administrivia Probability Baye’s Theorem Expected Value and Variance

Basic Counting Tools Basic rules of counting Sum rule: either task 1 or task 2 have to be done Product rule: both task 1 and task 2 have to be done Task 1 and Task 2 are independent Inclusion and Exclusion Principle Exclude one that count more than once or irrelevant count Include one that miss Pigeonhole Principle If there are k nest for at least k+1 pigeons, then there must be at least one nest that has more than one pigeons

Example How many strings of five ASCII character contain the ‘@’ character at least once? (ASCII has 128 characters) 1285 - 1275

Example A computer company receives 350 applications from computer graduates for a job planning a line of new Web servers. Suppose that 220 of these people majored in CS, 147 majored in business, and 51 majored both in CS and business. How many of these applications majored in CS nor in business? |A  B| = 220 + 147 - 51 = 316  U - |A  B| = 350 – 316 = 34

Example g pigeonhole A drawer contains a dozen brown socks and a dozen black socks, all un matched. A man takes socks out at random in the dark. How many socks must he take out to be sure that he has at least two socks of the same color? How many socks must he take out to be sure that he has at least two black socks? 3 14

Binomial Coefficient THEOREM 1: The Binomial Theorem Let x,y,n be positive integer THEOREM 2: PASCAL’S IDENTITY Let n and k be positive integer with n > k then THEOREM 3: Let n be positive integer, then

Example How many terms are therein the expansion of (x + y)15? What is the difference between the coefficient of the term x8y3 and x5y6? 215 |C(11, 8) – C(11, 5)| = |165 – 462| = 297

Permutations and Combinations Ordered arrangement of a set of distinct objects. An ordered arrangement of r elements of a set is r-permutation Combinations An unordered selection of r elements from the set is r-combination P(n, r) = n! (n - r)! C(n, r) = P(n, r) = n! r! r!(n – r)!

Example A group contain n men and n women. How many ways are there to arrange these people in a row if the men and women alternate? In how many ways can a set of five letters be selected from the English alphabet? 2(n!)2 C(26, 5) = 65780

Generalized Permutations and Combinations Permutations and Combinations with repetition Permutations with Indistinguishable Objects Distributing Objects into Boxes (4 cases) Distinguishable objects and distinguishable boxes Distinguishable objects and indistinguishable boxes Indistinguishable objects and distinguishable boxes Indistinguishable objects and indistinguishable boxes

Example General PC How many string of six letter are there? How many ways are there to select three unordered elements from a set with five elements when repetition is allowed? 266 C(5+3-1, 3) = C(7, 3) = 35

Generating Permutations and Combinations Counting permutations or combinations can solve many problems Counting is sometimes not enough. We need to generate either one of them to find the solution.

Example Generate PC What is the next permutation in lexicographic order after 362541? Count number of permutations = n! -1 = 6! – 1 = 719 Lexicogrphic: aj < aj+1. Therefore, the next number is 364125 (Kakuro) Let S = {1, 2, …, 9}. What are the subset that has 3 elements of S and their sum is 15? Count number of combinations = 9! / 3!6! = 84 Generate subset: {1, 5, 9}, {1, 6, 8}, {2, 4, 9}, {2, 5, 8} ,{2, 6, 7}, {3, 4, 8}, {3, 5, 7}, {4, 5, 6}

Administrivia Midterm Exam is in next 2 weeks. Please be prepared! All assignments MUST be submitted before Midterm.

Discrete Probability and Probability Theory

Finite Probability Laplace’s definitions: Experiment – a procedure that yields one of a given set of possible outcomes. Sample space – the set of possible outcomes from the experiment. Event – a subset of the sample space. Definition 1: If S is a finite sample space of equally likely outcomes, and E is an event, that is , a subset of S, then the probability of E is p(E) = |E| |S|

The Probability of Combinations of Events Theorem 1: Let E be an event in a sample space S. The probability of the event E, the complementary event of E, is given by p(E) = 1 – p(E) Theorem 2: Let E1 and E2 be events in sample space S. Then p(E1  E2) = p(E1) + p(E2) – p(E1  E2)

Example There are many lotteries now that award enormous prizes to people who correctly choose a set of six numbers out of the first n positive integers, where n is usually between 30 and 60. What is the probability that a person picks the correct numbers out of 40? What is the probability that a positive integer selected at random from the set of positive integers not exceeding 100 is divisible by either 2 or 5? 1 / C(40, 6) = 1 / 3838380 = 0.00000026 0.5 + 0.2 – 0.1 = 0.6

Probabilistic Reasoning The Monty Hall Three-door Puzzle You are asked to select one of the 3 doors to win the price. Once you select the door, the host, who knows what is behind each door, he opens one of the other two doors that he know is a losing door. Then he ask you whether you would like to switch doors. Should you change doors or keep your original selection? You should change the door whenever you have chance! The probability of wining will change from 1/3 to 2/3

Assigning Probabilities Let S be the sample space of an experiment with a finite or countable number of outcomes. We assign a probaility p(s) to each outcome s such that these 2 conditions must be met 0  p(s)  1 for each s  S The function p() is called a probability distribution

Definition 1: Suppose that S is a set with n elements. The uniform distribution assigns the probability 1/n to each element of S. Definition 2: The probability of the event E is the sum of the probabilities of the outcomes in E. That is, (Note that when E is an infinite set, is a convergent infinite series.)

Example Suppose that a die is biased so that 3 appears twice as often as each number but that the other five outcomes are equally likely. What is the probability that an odd number appears when we roll this die? Let E = {1, 3, 5} p(1) = p(2) = p(4) = p(5) = p(6) = 1/7; p(3) = 2/7 Then p(E) = 4/7

Conditional Probability and Independence Definition 3: 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) Definition 4: The events E and F are independent if and only if p(E  F) = p(E)∙p(F)

Example What is the conditional probability that a family with two kids has two boys, given they have at least one boy? Are the events E, that a family with three kids has of both sexes, and F, that this family has at most one boy, independent? Let E = {BB}, F = {BB, GB, BG} then E  F = {BB} p(E|F) = (1/4)/(3/4) = 1/3 Yes. Because p(E  F) = p(E)p(F) = 3/8

Bernoulli Trials and the Binomial Distribution An experiment with only 2 outcomes either Success or Failure is called Bernoulli Trials. Let p and q be a probability of success and failure, respectively. Then, it follows that p + q = 1 Bernoulli Trails are mutually independent. Theorem 2: The probability of exactly k successes in n independent Bernoulli trials, with probability of success p and probability of failure q = 1 – p, is b(k; n, p) = C(n, k)pkqn-k If we consider it as a function of k, we call this function the Binomial Distribution.

Random variable Definition 5: A random variable is a function fro the sample space of an experiment to the set of real numbers. That is, a random variable assigns a real number to each possible outcome. Definition 6: The distribution of random variable X on a sample space S is the set of pairs (r, p(X = r)) for all r  X(S), where p(X = r) is the probability that X takes the value r. A distribution is usually described by specifying p(X = r) fro each r  X(S).

Example Suppose that a coin is flipped three times. Let X(t) be the random variable that equals the number of heads that appear when t is the outcome. Find X(t). X(HHH) = 3, X(HHT) = X(HTH) = X(THH) = 2, X(TTH) = X(THT) = X(HTT) = 1, X(TTT) = 0 Because each of the eight possible outcomes Has probability of 1/8, the distribution of X(t) is given by P(X=3) = 1/8, P(X=2)=3/8, P(X=1) = 3/8, P(X=0) = 1/8

More Examples Birthday Problem. What is the minimum number of people who need to be in a room so that the probability that at least two of them have the same birthday is greater than 1/2? Example 14 - 16 1- pn = 1- 365 364 363 … 367-n 366 366 366 366 n = 22

Monte Carlo Algorithms Deterministic Algorithms Always proceed in the same way whenever given the same input. Probabilistic Algorithms Make random choices at one or more step for its efficiency in a huge number of possible case. Mote Carlo Algorithms The probability that the algorithm give the correct answer increases as more test carried out. Details in Section 6.2 page 411

The Probabilistic Method is used as existence proof to proof results about set S. See Theorem 4 for example Theorem 3: If the probability that an element of a set S does not have a particular property is less than 1, there exists an element in S with this property.

Baye’s Theorem

Bayes’ Theorem The probability that a particular event occurs on the basis of partial evidence, i.e., it is like conditional probability Theorem 1: Suppose that E and F are events from a sample space S such that p(E)  0 and p(F)  0. Then P(F | E) = p(E | F)p(F) p(E | F)p(F) + p(E | F)p(F) Theorem 2: Suppose that E is an event from a sample space S and that F1, F2, …, Fn are mutually exclusive events such that Assume that p(E)  0 and p(Fi)  0 for i = 1, 2, .., n. Then

Example We have 2 boxes. The first box contains two green balls and seven red balls; the second box contains four green balls and three red balls. Bob selects a ball by first choosing one of the two boxes at random. He then selects one of the balls in this box at random. If Bob has selected a red ball, what is the probability that he selected a ball from the first box? Details in Section 6.3 on page 417

Example: Bayesian Spam Filter Uses information about previously seen e-mail messages whether an incoming e-mail message is spam. Look for occurrences of particular word in messages. See details in Section 6.3 on page 421

Expected Value and Variance

Expected Value (of Random Variable) is a weighted average of the values of a random variable. provides central point for the distribution of values of the random variable. Definition 1: The expected value (or expectation) of the random variable X(s) on the sample space S is equal to Theorem 1: If X is a random variable and p(X = r) is the probability that X = r, so that p(X = r) = , then

Variance Definition 4: Let X be a random variable on a sample space S. The variance of X, denoted by V(X), is The standard deviation of X is defined to be Theorem 6: If X is a random variable on sample space S, then V(X) = E(X2) – E(X)2

Average-case Computational Complexity See Example 8-9 on page 431-432

Homework Section 6.1 8, 20, 35, 38, 41 Section 6.2 18, 22, 36, 37, 39, 40 Section 6.3 5, 10, 15, 18, 23 Section 6.4 2, 7, 9, 10, 22, 23 Supplementary 2, 3, 15, 16, 21, 22