discrete probability
DESCRIPTION
Discrete probability from school of computer science USMTRANSCRIPT
-
March 8, 2015CPT112
1/40
CountingSummation Principle
Multiplication Principle
Permutation
Combination
Pigeon Hole Principle
Probability
-
6.0 Discrete Probability
CPT112
2/40
Everything you have learned about counting constitutes the basis for computing the probability of events to happen.
Used to assign values to the experiment/test that does not guarantee to return the same value on repeated test
.
Different from predicted test that always gives the same result.
March 8, 2015
-
Probability : Introduction
CPT112
3/40
Random Test Test or process that give
unpredictable result
Sample possible result from certain test
Sample Space (from random test) a set that consist
of all samples from certain test
Event A statement that explain the result of a test;
the result is either true or false
March 8, 2015
-
Probability
CPT112
4/40
Example:
Random Test: flip a coin twice and record head-
tail sequence.
Samples: HH, TT, TH, HT
Sample Space: { HH, TT, TH, HT }
(all 4 possibilities)
March 8, 2015
-
Probability: Sample Space
CPT112
5/40
Test Example: Toss 20 cent and 50 cent coins.
1. If the test is to count number of heads, then the sample space is { 0,1,2 }
2. If the test is to record head-tail sequence of 20 cent followed by 50 cent, therefore the sample space is { HH, HT, TH, TT }
3. If the test is to record whether the result is the same pair or not (e.g. HH or TT is consider same pair), therefore the sample space is {Same, Different}
Sample space depends on what need to be observed
(related to the event) from the test.
March 8, 2015
-
Probability: Event
CPT112
6/40
Example:
Random Test: Flip a coin twice and record
head-tail sequence.
Sample space: S = { HH, HT, TH, TT }
Event A: get at least one head
A = { HH, HT, TH }
Event B: did not get tail
B = { HH }March 8, 2015
-
Probability: Event
CPT112
7/40
Sample space: S = { HH,HT,TH,TT }
Event A A = { HH, HT, TH }
Event B B = { HH }
Since the sample space and event are set, therefore
the set operation (intersection, union, etc.) can be applied
on sample spaces and events.
March 8, 2015
-
Probability: Event
CPT112
8/40
Event A = {HH, TT} (same pair)
Event C = {HT, TH} (only one head)
Based on the above two events we can
generate new events:
Event A and C (same pair and only one head)
Event A or C (same pair or only one head)
March 8, 2015
-
Probability: Event
CPT112
9/40
Event A and C = { }
Event A or C = { }
Using set operation:
A or C = A C = { HH,HT,TH,TT }
A and C = A C = { }
Union: X Y X or Y
Intersection: X Y X and Y
Complement: X not X
Event that did not intersect is known as mutually exclusive :
X Y =
March 8, 2015
-
Probability: Event
CPT112
10/40
Event is always a subset to a sample space
Empty Set () and sample space set is also an event, according to the definition.
If S is a sample space, therefore S is a definite event and an empty set is an impossible event
Note: for sample space of size n, there are 2n events (remember power set? And counting technique on how to count it?)
sample space: S = { HH, HT, TH, TT }
event X X = { }
event Y Y = { HH, HT, TH, TT }
March 8, 2015
-
Probability
CPT112
11/40
Example: The test is to flip a coin once and observe the result.
Get the probability head, H, happen.
Assume to obtain H and T are equally likely (that means we have a fair coin)
In word: from 2 possible events (the whole sample space) there is 1 probability that event H can happen
In probability: p(H) = 1 choicefrom 2
=1
2March 8, 2015
-
Probability
CPT112
12/40
Note:
Equal likely event is the assumption that each
case of the sample space is equally likely to
happen.
Equal likelihood case might not necessarily occur.
Example, in the case of cheated coin
March 8, 2015
-
Probability
CPT112
13/40
Each event E is given a value P(E),
known as event probability.
P(E) reflects the assumption made
about the likelihood of event E to
happen.
March 8, 2015
-
Probability
CPT112
14/40
Determine the Probability
Sample space: { x1, x2, x3, . . . , xn }
Determine the probability:
p(x1)= p1, p(x2) = p2, . . . p(xn)=pn
Characteristic in determining the probability:
1. 0 pi 1, i = 1, n
2. p1 + p2 + + pn = 1
March 8, 2015
-
Probability
CPT112
15/40
Probability event
Event
A = { y1, y
2, y
3, y
m}
p(A) = mi=1 pi
where yihas probability
pito happen
March 8, 2015
-
Probability
CPT112
16/40
Equally likely event probability
Sample space with N probability
It is said that there is 1 probability from N total possibility = 1/N
Event probability of size m has m probability from N total possibility or m/N
March 8, 2015
-
Probability
CPT112
17/40
Example:
Toss a dice once and observe the result
1. How many possibility are there?
2. What is the probability of each?
March 8, 2015
-
Discrete Probability
CPT112
18/40
Example 1:
An urn contains four blue balls and five red
balls. What is the probability that a ball
chosen from the urn is blue?
March 8, 2015
-
Discrete Probability
CPT112
19/40
Solution:
1. There are nine possible outcomes, and
2. The event blue ball is chosen comprises four of these
outcomes.
3. Therefore, the probability of this event is 4/9 or
approximately 44.44%.
Note: S = { b1, b2, b3, b4, r1, r2, r3, r4, r5 }
Note: E = { b1, b2, b3, b4 }
Therefore p(E) = 4/9
March 8, 2015
-
Discrete Probability
CPT112
20/40
Example 2:
What is the probability of winning the lottery that
is, you have to pick the correct set of six numbers
out of 49 numbers?
March 8, 2015
-
Discrete Probability
CPT112
21/40
Solution:
1. There are C(49, 6) possible outcomes.
2. Only one of these outcomes will actually make you
win the lottery.
|S| = C(49, 6), |E| = 1
Therefore;
p(E) = 1/C(49, 6) = 1/13,983,816
March 8, 2015
-
Complimentary Events
CPT112
22/40
Let E be an event in a sample space S. The probability of an event not E( E), the complimentary event of E, is given by
p(E) = 1 p(E).
This can easily be shown:
This rule is useful if it is easier to determine the probability of the complimentary event than the probability of the event itself.
March 8, 2015
-
Complimentary Events
CPT112
23/40
Example 1:
A sequence of 10 bits is randomly generated.
What is the probability that at least one of
these bits is zero?
March 8, 2015
-
Complimentary Events
CPT112
24/40
Solution:
1. There are 210 = 1024 possible outcomes of
generating such a sequence.
2. The event E, none of the bits is zero, includes only one of these outcomes, namely the sequence
1111111111.
|S|=1024, |E |=1
Therefore, p(E) = (1/1024).
Now p(E) can easily be computed as
p(E) = 1 p(E) = 1 (1/1024) = 1023/1024.March 8, 2015
-
Discrete Probability
CPT112
25/40
Let E1 and E2 be events in the sample space S. Then we have:
p(E1 E2) = p(E1) + p(E2) - p(E1 E2)
Does this remind you of something?
March 8, 2015
-
Discrete Probability
CPT112
26/40
Example:
What is the probability of a positive integer
selected at random from the set of positive
integers not exceeding 100 to be divisible by 2
or 5?
March 8, 2015
-
Discrete Probability
CPT112
27/40
Solution:
1. E2: integer is divisible by 2
2. E5: integer is divisible by 5
E2 = {2, 4, 6, , 100}
|E2| = 50, |S|=100
p(E2) = 0.5
March 8, 2015
-
Discrete Probability
CPT112
28/40
E5 = {5, 10, 15, , 100}
|E5| = 20
p(E5) = 0.2
E2 E5 = {10, 20, 30, , 100}
|E2 E5| = 10
p(E2 E5) = 0.1
p(E2 E5) = p(E2) + p(E5) p(E2 E5 )
=p(E2 E5)
= 0.5 + 0.2 0.1
= 0.6March 8, 2015
-
Discrete Probability
CPT112
29/40
What happens if the outcomes of an experiment are not equally likely?
In that case, we assign a probability p(s) to each outcome s S, where S is the sample space.
March 8, 2015
-
Discrete Probability
CPT112
30/40
Two conditions have to be met:
(1): 0 p(s) 1 for each s S, and
(2): sS p(s) = 1
Meaning,
each probability must be a value between 0 and 1, and
the probabilities must add up to 1, because one of the outcomes is guaranteed to occur.
March 8, 2015
-
Discrete Probability
CPT112
31/40
How can we obtain these probabilities p(s) ?
The probability p(s) assigned to an outcome s equals
the limit of the number of times s occurs divided by the
number of times the experiment is performed.
Once we know the probabilities p(s), we can compute
the probability of an event E as follows:
p(E) = sE p(s)
March 8, 2015
-
Discrete Probability
CPT112
32/40
Example 1:
A dice is biased so that the number 3 appears twice as often as each other number. What are the probabilities of all possible outcomes?
March 8, 2015
-
Discrete Probability
CPT112
33/40
Solution:
There are 6 possible outcomes s1, , s6.
p(s1) = p(s2) = p(s4) = p(s5) = p(s6)
p(s3) = 2p(s1)
Since the probabilities must add up to 1, we have:
5p(s1) + 2p(s1) = 1
7p(s1) = 1
p(s1) = p(s2) = p(s4) = p(s5) = p(s6) = 1/7,
p(s3) = 2/7March 8, 2015
-
Discrete Probability
CPT112
34/40
Example 2:
For the biased dice from Example 1, what is the
probability that an odd number appears when
we roll the dice?
March 8, 2015
-
Discrete Probability
CPT112
35/40
Solution:
Eodd = {s1, s3, s5}
Remember the formula
p(E) = sE p(s).
p(Eodd) = sEodd p(s) = p(s1) + p(s3) + p(s5)
p(Eodd) = 1/7 + 2/7 + 1/7 = 4/7 = 57.14%
March 8, 2015
-
Conditional Probability
CPT112
36/40
If we toss a coin three times, what is the probability that an odd number of tails appears (event E), if the first toss is a tail (event F) ?
March 8, 2015
-
Conditional Probability
CPT112
37/40
If the first toss is a tail, the possible sequences are TTT, TTH, THT, and THH.
In two out of these four cases, there is an odd number of tails.
Therefore, the probability of E, under the condition that F occurs, is 0.5.
We call this conditional probability.
March 8, 2015
-
Conditional Probability
CPT112
38/40
If we want to compute the conditional probability of E
given F, we use F as the sample space.
For any outcome of E to occur under the condition that F
also occurs, this outcome must also be in E F.
Definition: 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)
March 8, 2015
-
Conditional Probability
CPT112
39/40
Example:
What is the probability of a random bit string of
length four to contain at least two consecutive 0s,
given that its first bit is a 0 ?
March 8, 2015
-
Conditional Probability
CPT112
40/40
Solution:1. E: bit string contains at least two consecutive 0s
2. F: first bit of the string is a 0
3. We know the formula p(E | F) = p(E F)/p(F).
E F = {0000, 0001, 0010, 0011, 0100}p(E F) = 5/16p(F) = 8/16 =
p(E | F) = (5/16)/(1/2) = 10/16
= 0.625
March 8, 2015