aa bag hand mark

Download Report

Transcript aa bag hand mark

Probability & Statistical Inference
Lecture 3
MSc in Computing (Data Analytics)
Lecture Outline

Introduction

Introduction to Probability Theory

Discrete Probability Distributions

There is more than one way to skin a cat!
Introduction
Probability & Statistics

Population
Representative Make
Sample
Inference
Describe
Sample
Statistic

We want to make
decisions based on
evidence from a sample i.e.
extrapolate from sample
evidence to a general
population
To make such decisions we
need to be able to quantify
our (un)certainty about
how good or bad our
sample information is.
Probability & Statistics - Example
Example: How many voters will give F.F. a first preference in the
next general election ?
-researcher A takes a sample of size 10 and find 4 people who
say they will
-researcher B takes a sample of size 100 and find 25 people who
say they will
Researcher A => 40%
Researcher B => 25%
Who would you believe?
Probability & Statistics - Example
Intuitively the bigger sample would get more credence
but
how much better is it, and are either of the samples any good?
 probability helps
Descriptive Statistics are helpful but still lead to decision
making by 'intuition‘
Probability helps to quantify (un)certainty which is a more
powerful aid to the decision maker
Probability & Statistics
 Using
probability theory we can measure
the amount of uncertainty/certainty in
our statistics.
Intuitions and Probability – Lotto example

If you had an Irish lotto ticket which of these sets of
numbers is more likely to win:
1.
1
2
3
4
5
6
Odds of winning are 1 in 8145060
2.
2 11 26 27 35 42
Odds of winning are 1 in 8145060
Intuitions and Probability – Disease example

Suppose we have a diagnostic test for a disease which is
99% accurate.

A person is picked at random and tested for the disease

The test gives a positive result. What is the probability
that the person actually has the disease?
 99%
?
Disease example
No!! IT depends on how common or rare the disease is.
Suppose the disease affects 1 person in 10,000
If you take a population of
1,000,000
Those that have the don’t
have/do have the disease
Test Results
1,000,000
100
999,900
989,991
Of those who test positive only
the disease
9,999
99
99
 0.0098
99  9999
1
have
Introduction to Probability
Theory
Some Definitions




An experiment is the process of obtaining or taking a
measurement.
A simple event is a basic outcome of an experiment; it cannot be
decomposed into simpler outcomes.
A sample space of an experiment is the collection of all its simple
events.
Example:


Experiment: Toss two coins and observe the up face on each
Sample Space:
1.
Observe HH
2.
Observe HT
3.
Observe TH
4.
Observe TT
S: {HH,HT,TH,TT}
Probability


The probability of a simple event is a number that measures the likelihood that the
event will occur when the experiment is preformed, denoted by P(E).
Some rules for probabilities:
 Let E1, E2, E3, .........,Ek
1.
All simple event probabilities must lie between 0 and 1:
0 <= P(Ei) <= 1
for i=1,2,........,k
2.
The sum of the probabilities of all the simple events within a sample space
k
must be equal to 1:
 P ( Ei )  1
i 1

Example:
 Experiment: Toss two coins and observe the up face on each
 Probability of each event:
1.
E = HH => P(HH) = 1/4
2.
E = HT => P(HT) = 1/4
3.
E = TH => P(TH) = 1/4
4.
E = TT => P(HH) = 1/4
Probability


The probability of an event A is equal to the sum of all the
probabilities in event A:
Example:

Experiment: Toss two coins and observe the up face on each

Event A: {Observe exactly one head}
P(A) = P(HT) + P(TH) = ¼ + ¼ = ½

Event B : {Observe at least one head}
P(B) = P(HH) + P(HT) + P(TH) = ¼ + ¼ + ¼ = ¾
Complementary Event

The complementary of an event A is the event that A
does not occur denoted by A´

Note that AU A` = S, the sample space

P(A) + P(A`) =1 => P(A) = 1 – P(A`)
Questions
What is the sample space when a coin is tossed 3
times?
What is the sample space for the number of aces in a
hand of 13 playing cards?
If a fair die is thrown what is the probability of throwing
a prime number?
If two fair die are thrown what is the probability that at
least on score is a prime number?
1.
2.
3.
4.
1.
2.
What is the compliment of the event.
`What is its probability?
Questions
4.
A factory has two assembly lines, each of which is shut down (S), at partial
capacity (P), or at full capacity (F). The following table gives the sample space
Event A
P(A)
Event A
P(A)
Event A
P(A)
(S,S)
0.02
(S,P)
0.06
(S,F)
0.05
(P,S)
0.07
(P,P)
0.14
(P,F)
0.2
(F,S)
0.06
(F,P)
0.21
(F,F)
0.19
For where (S,P) denotes that the first assembly line is shut down and the
second one is operating at partial capacity. What is the probability that:
a)
Both assembly lines are shut down?
b)
Neither assembly lines are shut down
c)
At least one assembly line is on full capacity
d)
Exactly one assembly line is at full capacity
Compound Events



The union of two event A and B is the event that occurs if either A or B, or
both, occur on a single performance of the experiment denoted by A U B
(A or B)
The intersection of two events A and B is the event that occurs if both A
and B occur on a single performance of an experiment denoted by A  B
or (A and B)
Example: Consider a die tossing experiment with equally likely simple
events {1,2,3,4,5,6}. Define the events A, B and C.
 A:{Toss an even number} = {2,4,6}
 B:{Toss a less than or equal to 3} = {1,2,3}
 C:{Toss a number greater than 1} = {2,3,4,5,6}
 Find:
P( A  B  C )
and
P( A  B  C )
Conditional Probability

The conditional probability of event A conditional on
event B is
P( A  B )
P( A | B ) 
P( B )
for P(B)>0. It measures the probability that event A
occurs when it is known that event B occur.


Example: A = odd result on die = {1,3,5}
B = result > 3 = {4,5,6}
1
P( A | B )  6
3
1
6
3
Conditional Probability Example

Example: A study was carried out to investigate the link
between people’s lifestyles and cancer. One of the areas
looked at was the link between lung cancer and smoking.
10,000 people over the age of 55 were studied over a 10
year period. In that time 277 developed lung cancer.
Cancer
No Cancer
Total
Smoker
241
3,325
3,566
Non-Smoker
36
6,398
Total
277
9,723
6,434
10,000
What is the likelihood of somebody developing lung cancer
given that they smoke?
Conditional Probability Example

Event A: A person develops lung cancer
Event B: A person is a smoker
P(A) = 277/10,000 = 0.027
P(B) = 3,566/10,000 = 0.356
P( A  B )  241 / 10,000  0.0241
P( A  B) 0.0241
P( A | B ) 

 0.068
P( B )
0.3566
Exercises
A ball is chosen at random from a bag containing 150
balls that are either red or blue and either dull or
shinny. There are 36 red, shiny balls and 54 blue balls.
1.
1.
2.
What is the probability of a chosen ball being shiny
conditional on it being red?
What is the probability of a chosen ball being dull conditional
on it being red?
Mutually Exclusive Events

Two events, A and B, are mutually exclusive given
that if A happens then B can’t also happen.

Example: Roll of a die
A = less than 2
B = even result
There is no way that A and B can happen at the same
time therefore they are mutually exclusive events
Rules for Unions

Additive Rule:
P ( A  B )  P ( A)  P ( B )  P( A  B )

Additive Rule for Mutually Exclusive Events
P ( A  B )  P ( A)  P ( B )
Example

Recodes at an industrial plant show that 12% 0f all injured
workers are admitted to hospital for treatment, 16% are
back on the job the next day, and 2% are both admitted
to a hospital for treatment and back to work the next day.
If a worker is injured that is the probability that the
worker will be either admitted to hospital or back on the
job the next day or both?
Independent Events

Events A and B are independent if it is the case that A
happening does not alter the probability that B happens.

Example :

Then, let us say we are told the result on the die (which
someone has observed but not us) is even so knowing
this, what is the probability that the event B has
happened?
Sample space: {2, 4, 6}
A = even result on die
B = result > 2
B = 4 or 6 => P(B) = 2/3
Independent Events

But if we didn’t know about the even result we would
get:
Sample space: {1, 2, 3, 4, 5, 6}
B = 3 or 4 or 5 or 6
=> P(B) = 4/6 = 2/3
so knowledge about event A has in no way changed
out probability assessment concerning event B
Rules for Intersection

Multiplicative Rule of Probability
P( A  B )  P( A | B ) P( B )  P( B | A) P( A)

If events A and B are independent then
P ( A  B )  P ( A) P ( B )
Bayes Theorem

One of a number of very useful results: - here is simplest definition:

Suppose:You have two events which are ME and exhaustive – i.e. account
for all the sample space –
Call these events A and event
(read ‘not A’).


Further suppose there is another event B, such that
P(B|A) > 0 and P(A|B) > 0.

Then Bayes theorem states:

P( B | A) P( A)
P( A | B ) 
P( B | A) P( A)  P( B | A' ) P( A' )
Discrete Probability Distributions
Discrete Random Variable

A Random Variable (RV) is obtained by assigning a
numerical value to each outcome of a particular
experiment.

Probability Distribution: A table or formula that
specifies the probability of each possible value for the
Discrete Random Variable (DRV)

DRV: a RV that takes a whole number value only
Example: What is the probability distribution for the experiment to assess
the no of tails from tossing 2 coins;
Sample Space
Coin 1
T
T
H
H
Coin 2
T
H
T
H
x = no. of tails is the RV
x
0
= P(HH)
1
= P(TH) + P(HT)
2
= P(TT)
P( any other value )
N.B.  P(x) = 1
0  P(x)  1 for all values of x
P(x)
=
=
=
=
0.25
0.50
0.25
0
Mean of a Discrete Random Variable


Mean of a DRV =  = Σ x * p(x)
Example: Throw a fair die
x
P(x)
1
0.1667
2
0.1667
3
0.1667
4
0.1667
5
0.1667
6
0.1667
P(any other value) = 0
Mean =  = Σ x * p(x) = 3.5
x * P(x)
0.17
0.33
0.50
0.67
0.83
1.00
0
Some Examples
Simulated Sample size = 10
3 1 4 6 6 6 1 3 6 1
mean
S.D.
= 3.7
= 2.1
Simulated Sample size = 100
4 6 4 6 3 2 4 2 1 3
5 1 3 2 6 3 3 1 5 6
2 3 2 5 6 4 6 2 3 3
5 2 5 4 4 3 1 4 1 3
6 5 6 4 3 3 2 2 2 3
3 1 5 5 1 5 1 2 5 3
6 2 4 3 6 1 3 1 1 2
2 3 5 3 4 6 3 3 5 4
6 5 6 1 2 4 3 6 1 4
2 4 5 6 6 6 6 3 1 5
mean
S.D.
= 3.54
= 1.67
Mean = 3.49
Simulated Sample size = 1000
S.D. = 1.73
1
3
3
2
2
6
1
3
4
6
1
4
4
4
1
3
2
3
1
4
6
2
2
2
2
5
5
2
3
5
5
1
3
1
3
4
5
1
4
4
6
1
3
1
4
4
6
3
1
5
6
1
5
5
1
6
3
2
3
1
4
1
6
3
3
5
6
6
6
6
3
2
5
3
6
5
5
5
2
6
6
6
1
3
4
3
3
5
3
3
6
5
5
1
2
5
5
2
6
1
4
3
2
1
1
1
4
4
5
1
5
3
2
5
1
3
3
2
1
1
2
6
3
5
3
1
5
6
2
3
5
6
6
2
6
2
2
1
6
3
5
3
4
3
5
4
4
3
2
1
2
6
5
6
2
1
2
1
6
4
2
5
6
3
6
6
5
1
6
5
4
6
2
1
5
4
2
5
4
1
3
4
6
5
3
5
1
3
3
6
1
3
3
2
1
4
6
6
4
4
1
5
3
4
2
1
3
4
2
6
3
2
2
3
3
5
1
3
5
5
3
1
6
6
1
3
4
5
3
3
1
5
2
1
5
2
5
2
1
6
1
2
6
3
2
6
5
1
1
5
3
6
1
1
2
1
4
1
1
2
3
4
3
4
4
5
5
4
3
3
6
5
5
6
2
6
6
1
6
2
5
6
3
2
6
5
4
2
2
6
4
3
3
1
3
4
4
3
2
2
1
6
2
2
1
5
2
1
6
1
4
6
4
5
4
5
2
4
4
3
6
1
4
2
1
6
6
2
6
4
2
6
2
5
5
4
5
6
2
3
1
2
5
1
6
5
1
5
2
5
6
5
2
3
2
1
1
3
6
6
3
1
5
3
5
2
6
6
6
3
2
1
2
6
2
6
5
1
4
2
5
1
3
2
1
1
3
3
6
5
6
3
6
4
3
2
5
2
5
2
2
4
3
3
6
1
2
3
4
6
1
1
5
4
5
6
1
4
1
2
1
1
3
1
2
5
4
5
1
6
6
4
2
1
6
5
4
6
2
2
4
3
3
5
5
6
2
3
5
1
1
1
4
2
4
1
4
2
1
3
1
2
3
1
1
2
2
4
2
2
2
1
4
5
2
2
2
5
1
4
1
2
2
2
6
5
5
3
1
2
3
6
6
4
2
4
3
4
5
4
1
5
3
5
2
1
6
6
6
6
6
2
6
2
2
5
3
6
2
4
5
4
6
4
4
5
1
2
1
6
3
6
2
1
4
1
2
2
5
6
1
3
5
2
5
5
1
2
3
6
1
6
4
4
5
1
2
4
1
4
4
6
3
3
5
6
5
4
6
4
5
5
2
5
2
1
2
3
2
6
4
6
3
4
3
6
5
6
6
5
1
6
6
5
2
1
5
3
5
1
1
2
6
4
1
3
5
1
3
3
6
3
1
2
2
3
3
4
5
5
6
3
2
1
5
1
4
3
5
5
2
4
3
6
3
2
6
2
4
6
5
3
1
6
6
5
1
2
6
3
5
3
4
4
2
2
5
1
4
5
3
3
5
6
6
3
1
2
2
5
3
5
5
5
1
5
4
3
3
3
5
1
5
4
5
4
5
2
6
2
1
5
3
3
2
1
6
4
1
3
1
1
4
1
1
4
4
1
5
4
1
2
2
6
6
5
2
4
2
6
3
1
5
3
6
Note:

The largest simulation had the mean closest to that
predicted by the probability distribution

As the simulations got bigger the mean approached 3.5

Mean of DRV is the mean of a large number of
independent experiments (trials).
Standard Deviation of a DRV

 x P( X  x )  
 
2
2
 x P( X  x)  ( xP( X  x))
2
2
Example: Rolling one die
x
P(x)
1
0.1667
2
0.1667
3
0.1667
4
0.1667
5
0.1667
6
0.1667
P(any other value) = 0
=
15.17 - (3.5)2 = 15.17 - 12.25 =
=>
S.D. = 1.71
2.92
Simulations:
N=10
=> S.D. = 2.1
N=100
=> S.D. = 1.67
N=1,000
=> S.D. = 1.73
x2 * P(x)
0.17
0.67
1.50
2.67
4.17
6.00
0
15.17
Binomial (Probability) Distribution




Many experiments lead to dichotomous responses (i.e.
either success/failure, yes/no etc.)
Often a number of independent trials make up the
experiment
Example: number of people in a survey who agree with a
particular statement?
Survey 100 people => 100 independent trials of Yes/No
The random variable of interest is the no. of successes
(however defined)
These are Binomial Random Variables
Binomial Distribution Example
4 people tested for the presence of a particular gene.
success = presence of gene
P(gene present / success) = 0.55
P(gene absent / failure)
= 0.45
P(3 randomly tested people from 4 have gene)?
Assume trials are independent - e.g. the people are not related
There is 4 ways of getting 3 successes
Binomial Distribution Example

Using Independence rule we can calculate the probability
of each outcome:

Outcome 1:
Outcome 2:
Outcome 3:
Outcome 4:
0.55  0.55  0.55  0.45 = 0.07486875
0.55  0.55  0.45  0.55 = 0.07486875
0.55  0.45  0.55  0.55 = 0.07486875
0.45  0.55  0.55  0.55 = 0.07486875
4 ways of getting result each with P=0.07486875
=>
4  0.07486875 = 0.299475
=> P(3 randomly tested people have gene) = 0.299475
Binomial Distribution Example

A more convenient way of mathematically writing the
same result is as follows:
4
 (0.55)3 (0.45)1  0.2994
 3

the number of ways you can get three successes from
4 trials can be written mathematically as 4C3, this is
known as a combination:
n
n!
C    
 k  (n  k )! k!
n
k
Binomial Distribution – General Formula

This all leads to a very general rule for calculating binomial probabilities:
In General Binomial (n,p)
n = no. of trials
p = probability of a success
x = RV (no. of successes)
n x
n x
P( X  x )    p (1  p)
 x

Where P(X=x) is read as the probability of seeing x
successes.
P( X
P( X
P( X
P( X
P( X
 4
0
4 0
 0)   (0.55) (0.45)  0.0410065
 0
 1)  ?
 2)  ?
 3)  ?
 4)  ?
Binomial Distribution

For all binomials the mean is given by the simple formula;
=np

Example: from previous example
 = 4  0.55 = 2.2

Standard deviation also has simple formula for all Binomials
 2  np(1  p)
  np(1  p)

Example: from previous example

= 0.995
Binomial Distribution



What is P(< 3 people have gene) from a group of four people
tested at random?
Use the fact that the possible outcome are mutually exclusive
(ME)
= P(0) + P(1) + P(2)
= 0.041 + 0.2 + 0.368
= 0.609 [ to 3 decimal places ]
We can write this probability like this;
 4
4 x
P( X  3)    (0.55) x 0.45  0.609
x 0  x 
2

P(X>3)=?
Binomial Question

There are two hospitals in a town. In Hospital A, 10
babies are born each day, in Hospital B there are 30
babies born each day. If the hospitals only count those
days on which over 70% of babies born are girls, and
assuming the probability that a girl is born is ½, which
of the two hospitals will record more such days?

Hospital A: Binomial (n=10, p=0.5)

Hospital B: Binomial (n=30, p=0.5)
Answer

Hospital 1:

Calculate :
6
P(X  7)  1 -  P( X  xi )
i 0
 1  0.828125  0.17188

Hospital 2 :

Calculate :
20
P(X  21)  1 -  P( X  xi )
i 0
 1  0.978613  0.02139
There is a higher probability of getting 70% of babies born being girl
from hospital 1.
Binomial Question

A flu virus hits a company employing 180 people.
Independent of other employees , there is a probability
p=0.35 that each person needs to take sick leave. What is
the expectation and variance of the proportion of the
workforce who needs to take sick leave. In general what
is the value of the sick rate p that produces the largest
variance for this proportion.
Poisson Probability

Many experiments don't have a simple success/failure
response

Responses can be the number of events occurring over time,
area, volume etc.

We don't know the number of 'failures' just the number of
successes.
Example: The number of calls to a telesales company
- we know how many calls got through (successes)
- but don't know how many failed (lines busy etc.)

Knowledge of the mean number of events over time etc =>
Poisson Random Variable

Events must occur randomly
Poisson Probability Distribution

Probability Distribution for Poisson
Where  is the known mean:
e 
P( X  x ) 
x!

x

x is the value of the RV with possible values 0,1,2,3,….
e = irrational constant (like ) with value 2.71828…

The standard deviation , , is given by the simple relationship;

=

Example: Bombing of London WW2




1944 German V1 rockets feel on London
Were they aimed at specific targets or falling
randomly?
Important in AA strategy & Civil Defence
Divide London into
a 24  24 grid of
equal sizes (576
equal square areas).
Example: Bombing of London WW2

If rockets are random => should fall according to Poisson
random variable per square

 (mean)

= No. of Bombs/ No of squares
= 535/576
= 0.9288
So, for a particular square (assuming randomness)
e0.9288(0.9288) x
P( X  x ) 
x!

Where x is the number of bombs landing in the square on the
map grid.
e 0.92880.9288
 0) 
 0.395
0!
1
e 0.92880.9288
 1) 
 0.367
1!
2
e 0.9288 0.9288
 2) 
 0.170
2!
3
e 0.9288 0.9288
 3) 
 0.053
3!
4
e 0.9288 0.9288
 4) 
 0.012
4!
 4)  1  P( X  0)  P( X  1)  P( X  2)  P( X  3)  P( X  4)
0
P( X
P( X
P( X
P( X
P( X
P( X
 1  0.997  0.003
Example: Bombing of London WW2

576  p(x)
X = no. of
rockets
P(x)
Actual no. of
squares Hit
0
0.395
228
229
1
0.367
211
211
2
0.170
98
93
3
0.053
31
35
4
0.012
7
7
> 4 (i.e. 5+)
0.003
2
1
Prediction from Poisson so good => British concluded rockets were not
being aimed at specific targets - were falling randomly on London
Other Basic Discrete Probability Distributions

Geometric – No. of independent trials to first
success.

Negative Binomial - No. of independent trials to
first, second, third fourth… success.

Hypergeometric – lottery type experiments.

many others….
Question

The number of cracks in a ceramic tile has a Poisson
distribution with a mean µ = 2.4.


What is the probability that a tile has no cracks?
What is the probability that a tile has four or more cracks?
There is more than one way to
skin a cat!
Questions
1.
2.
3.
If two fair die are thrown what is the
probability that at least one score is
a prime number (2, 3, 5)?
What is the compliment of the event?
What is its probability?
There are three ways (at least) that we can
approach this problem
Solution 1: Brute Force Approach

Enumerate the sample space and select those outcomes
that satisfy the desired conditions

36 possible combinations of 2 die
Solution 1: Brute Force Approach

Enumerate the sample space and select those outcomes
that satisfy the desired conditions


36 possible combinations of 2 die
27 combinations include a prime number
Solution 1: Brute Force Approach

Enumerate the sample space and select those outcomes
that satisfy the desired conditions



36 possible combinations of 2 die
27 combinations include a prime number
Probability of at least one prime is 27/36 = 0.75
The Compliment

What is the compliment of the event?


That neither score is a prime number (2, 3, 5) when two fair
dice are thrown
What is its probability?



Let the event be E and its probability be P(E)
Then the compliment of E is E’ and the probability of E`,
P(E`), is equal to 1 – P(E)
In our case P(E) = 0.75
=> P(E`) = 1 – 0.75
= 0.25
The Compliment

What is the compliment of the event?

That neither score is a prime number (2, 3, 5) when two fair
dice are thrown
The Compliment

What is the compliment of the event?


That neither score is a prime number (2, 3, 5) when two fair
dice are thrown
What is its probability?
The Compliment

What is the compliment of the event?


That neither score is a prime number (2, 3, 5) when two fair
dice are thrown
What is its probability?



Let the event be E and its probability be P(E)
Then the compliment of E is E’ and the probability of E`,
P(E`), is equal to 1 – P(E)
In our case P(E) = 0.75
=> P(E`) = 1 – 0.75
= 0.25
Solution 2: Find the Probability of the
Compliment


The brute force approach is fine for two dice, but
cumbersome as the number of dice increases – i.e. 3 dice,
4 dice…..12 dice….1,247 dice!
Our question can be slightly rearranged to reveal a
possible solution

If two fair die are thrown what is the probability that at least
one score is a prime number (2, 3, 5)?
Solution 2: Find the Probability of the
Compliment


The brute force approach is fine for two dice, but
cumbersome as the number of dice increases – i.e. 3 dice,
4 dice…..12 dice….1,247 dice!
Our question can be slightly rearranged to reveal a
possible solution

If two fair die are thrown what is the probability that at
least one score is a prime number (2, 3, 5)?
Solution 2: Find the Probability of the
Compliment


The brute force approach is fine for two dice, but
cumbersome as the number of dice increases – i.e. 3 dice,
4 dice…..12 dice….1,247 dice!
Our question can be slightly rearranged to reveal a
possible solution


If two fair die are thrown what is the probability that at
least one score is a prime number (2, 3, 5)?
What is the probability of one or more primes from two
dice throws?
Solution 2: Find the Probability of the
Compliment


The brute force approach is fine for two dice, but
cumbersome as the number of dice increases – i.e. 3 dice,
4 dice…..12 dice….1,247 dice!
Our question can be slightly rearranged to reveal a
possible solution



If two fair die are thrown what is the probability that at
least one score is a prime number (2, 3, 5)?
What is the probability of one or more primes from two
dice throws?
What is the probability of one or more of outcome O from
X trials?
Solution 2: Find the Probability of the
Compliment


The brute force approach is fine for two dice, but
cumbersome as the number of dice increases – i.e. 3 dice,
4 dice…..12 dice….1,247 dice!
Our question can be slightly rearranged to reveal a
possible solution




If two fair die are thrown what is the probability that at
least one score is a prime number (2, 3, 5)?
What is the probability of one or more primes from two
dice throws?
What is the probability of one or more of outcome O from
X trials?
If questions are of this form we can work out the answer
by working out the compliment first
Solution 2: Find the Probability of the
Compliment

What is the probability that neither score is a prime
number (2, 3, 5) when two fair dice are thrown?



This is an easier probability to calculate as we can consider
throwing each dice as an independent event and combine the
probabilities that neither results in a prime
It is the “one or more” in the previous problem that makes
things tricky as we cannot consider each dice throw as an
independent event
Solution 2: Find the Probability of the
Compliment


To start let’s work out, if we throw a single dice what is
the probability of not getting a prime number?
Solution 2: Find the Probability of the
Compliment

To start let’s work out, if we throw a single dice what is
the probability of not getting a prime number?




Sample space: {1, 2, 3, 4, 5, 6}
Primes: {2, 3, 5}
Non-primes: {1, 4, 6}
So, probability is 3/6
Solution 2: Find the Probability of the
Compliment

If the probability of getting no prime if we throw one dice
is 3/6, what is the probability of getting no primes if we
throw two dice in a row?
Solution 2: Find the Probability of the
Compliment

If the probability of getting no prime if we throw one dice
is 3/6, what is the probability of getting no primes if we
throw two dice in a row?


Dice rolls are independent events
Remember our intersection rule for independent events
P( A  B )  P( A) P( B )

So, the probability of getting no primes if we throw two dice in
a row is:
P(E)  3 6 * 3 6
 9 36
 14
Solution 2: Find the Probability of the
Compliment




Our event, E, was that neither score is a prime number
(2, 3, 5) when two fair dice are thrown
So the complement of this event, E`, is that at least one
score is a prime number (2, 3, 5) when two fair dice are
thrown
We know that given the probability of event E, P(E), we
can work our the probability of the complement of this
event,
P(E`), as 1 – P(E)
So for our dice example
P( E )  1
4
P ( E `)  1  1
4
 3
4
Solution 2: Find the Probability of the
Compliment


The great thing is that this works for any number of dice
The probability, P(E), of getting no primes if we throw n
dice in a row is:
 
P(E)  3 6

n
So, for three dice the probability of getting no primes is

 
 3 6 * 3 6 * 3 6 
 36
3
 27 216
 18

This means that the probability of getting at least one
prime from 3 dice rolls is 1 – 1/8 = 7/8
Solution 3: Use the Binomial Distribution

Problems that can be stated as:

what is the probability of seeing x successes in n
independent binary trials

can be solved using the Binomial distribution.

For example:


what is the probability of seeing 1 prime in 2 dice throws
Solution 3: Use the Binomial Distribution

The Binomial probability, P(X=x), (read as the probability
of seeing x successes) is given by:
n x
n x
P(X  x)   p (1  p)
x


where n is the number of trials, p is the probability of a
n 
success and
  , known as a combination, is the number of
x 
ways of getting x successes from n trials


n
n!
 
x  (n  x)!x!
Solution 3: Use the Binomial Distribution

So, what is the probability of seeing 1 prime in 2 dice
throws
 n=2
p = 1/2 x = 1
n 
n!
 
x  (n  x)!x!
2
2!
 
1 (2 1)!1!
2
n x
P(X  x)   p (1  p)n x
x
2 1
P(X 1)   12 (1  12)21
1


 2 * 12 * 12
 12
Solution 3: Use the Binomial Distribution

Exercise: What is the probability of seeing 2 primes in 2
dice throws
n x
P(X  x)   p (1  p)n x
x
2 2
P(X  2)   12 (1  12) 22
2
n 
n!
  
x  (n  x)!x!
2
2!
  
2 (2  2)!2!
1


 1* 1 4 *1
 14
Solution 3: Use the Binomial Distribution

Exercise: What is the probability of seeing 2 primes in 2
dice throws
Solution 3: Use the Binomial Distribution

So, what is the probability of seeing one or more primes
in 2 dice throws?


P(1 ≥ X ≤ 2) = P(X = 1) + P(X = 2)
=½+¼
=¾
More generally then we can say that the probability of
seeing one or more primes in n dice throws is:
n
P(1  X  n)   P X  x 
x 1

Exercise

Consider a multiple choice test in which:




1.
2.
3.
4.
5.
Each question has 4 possible answers of which only 1 is correct
The test is made up of 10 questions
The pass mark is 40%
How well could we do if we just guessed each answer?
What is the probability of guessing a single question
correctly?
What is the probability of getting no answers correct in the
test?
What is the probability of getting at least one question
correct in the test?
What is the probability of getting a score of 40% in the test?
What is the probability of passing the test?