You are on page 1of 40

1/40

Counting
Summation Principle
Multiplication Principle
Permutation
Combination
Pigeon Hole Principle
Probability

CPT112

March 8, 2015

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.
CPT112

March 8, 2015

Probability : Introduction
3/40

CPT112

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
4/40

Example:

CPT112

Random Test:

Samples:

Sample Space:

{ HH, TT, TH, HT }

(all 4 possibilities)
March 8, 2015

5/40

Sample space depends on what need to be observed

(related to the event) from the test.
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}
CPT112

March 8, 2015

Probability: Event
6/40

Example:
Random Test:
Sample space:

Flip a coin twice and record

S = { HH, HT, TH, TT }

Event A:

A = { HH, HT, TH }

Event B:

did not get tail

B = { HH }

CPT112

March 8, 2015

Probability: Event
7/40

Sample space:
Event A
Event B

S = { HH,HT,TH,TT }
A = { HH, HT, TH }
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.

CPT112

March 8, 2015

Probability: Event
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:

CPT112

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
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
=AC
={ }
Union:
Intersection:
Complement:

XY
X or Y
XY
X and Y
X

not X

Event that did not intersect is known as mutually exclusive :

XY=
CPT112

March 8, 2015

Probability: Event
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:
event X
event Y
CPT112

S = { HH, HT, TH, TT }

X= {}
Y = { HH, HT, TH, TT }
March 8, 2015

Probability
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) =

CPT112

1 choice 1
=
from 2
2

March 8, 2015

Probability
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,

CPT112

March 8, 2015

Probability
13/40

CPT112

Each event E is given a value P(E),

known as event probability.
about the likelihood of event E to
happen.

March 8, 2015

Probability
14/40

Sample space: { x1, x2, x3, . . . , xn }

Determine the probability:
p(x1)= p1, p(x2) = p2, . . . p(xn)=pn
Characteristic in determining the probability:
1.
2.

CPT112

0 pi 1, i = 1, n
p1 + p2 + + pn = 1
March 8, 2015

Probability
15/40

Probability event
Event

A = { y1, y2, y3, ym }

p(A) = mi=1 pi
where yi has probability
pi to happen

CPT112

March 8, 2015

Probability
16/40

CPT112

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
17/40

Example:
Toss a dice once and observe the result

CPT112

1.

2.

What is the probability of each?

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
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%.

Therefore p(E) = 4/9

CPT112

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
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
CPT112

March 8, 2015

Complimentary Events
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).

CPT112

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
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?

CPT112

March 8, 2015

Complimentary Events
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
CPT112

p(E) = 1 p(E) = 1 (1/1024) = 1023/1024.

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
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
CPT112

March 8, 2015

Discrete Probability
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

CPT112

p(E2 E5) = p(E2) + p(E5) p(E2 E5 )

=p(E2 E5)
= 0.5 + 0.2 0.1
= 0.6

March 8, 2015

Discrete Probability
29/40

CPT112

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
30/40

(2): sS p(s) = 1

Meaning,

CPT112

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
31/40

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)

CPT112

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
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,

CPT112

p(s3) = 2/7

March 8, 2015

Discrete Probability
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?

CPT112

March 8, 2015

Discrete Probability
35/40

Solution:
Eodd = {s1, s3, s5}
Remember the formula
p(E) = sE p(s).
p(Eodd) = sE p(s) = p(s1) + p(s3) + p(s5)
odd

p(Eodd) = 1/7 + 2/7 + 1/7 = 4/7 = 57.14%

CPT112

March 8, 2015

Conditional Probability
36/40

CPT112

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
37/40

CPT112

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
38/40

CPT112

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
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 ?

CPT112

March 8, 2015

Conditional Probability
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/16
p(F) = 8/16 =

p(E | F) = (5/16)/(1/2)
= 10/16
= 0.625
CPT112

March 8, 2015