You are on page 1of 51

STAT 2

Lecture 19:
Binomial probabilities

This week

The binomial formula


The law of averages
Expected value and standard error
The normal approximation

A reminder: tossing coins

Tossing coins

I toss three coins. What's the


probability that exactly two out of
three are heads?

Draw a tree

Using the tree

P(HHT) = * * = 1/8
P(HTH) = * * = 1/8
P(THH) = * * = 1/8
P(2 heads out of 3) = 3/8
Note that there are three ways of
getting two heads in three tosses
Each way has equal probability

Why are there 3 ways?

Number of tosses is fixed at 3


There needs to be two heads and
one tail (can only get head or tail)
The tail can fall on any of the three
tosses
So there are three places the tail
can be

Why are the probabilities the same


for each way?

Probability of getting a head


doesn't change from toss to toss
Tosses are independent
Each way has probability
**

II

Tossing a biased coin

Tossing a biased coin

I have a biased coin which has a


60% chance of coming up heads. I
toss it three times.
What's the probability that exactly
two out of three are heads?

Drawing the tree

Using the tree

P(HHT) = .6*.6*.4 = 0.144


P(HTH) = .6*.4*.6 = 0.144
P(THH) = .4*.6*.6 = 0.144
P(2 H out of 3) = 3 * 0.144 = 0.432
There are three ways of getting
two heads in three tosses
Each way has equal probability

Why are the probabilities the same


for each way?

P(HHT) = .6*.6*.4 = 0.144


P(HTH) = .6*.4*.6 = 0.144
P(THH) = .4*.6*.6 = 0.144
Tosses indep., probs don't change
The probability of each way is
found by multiplying
P(H)*P(H)*P(T) in some order

III

Tossing a lot of biased coins

Tossing biased coins

I have a biased coin which has a


60% chance of coming up heads. I
toss it five times.
What's the probability that exactly
three out of five are heads?

Tossing biased coins

Will take a long time to draw out


the whole tree
Can find the probability by
multiplying the number of ways by
the probability of each way

What's the probability of one way?

Each way has three heads and two


tails; probability of each way will
be found by multiplying
P(H)*P(H)*P(H)*P(T)*P(T) in
some order
P(one way) = .6*.6*.6*.4*.4
3
2
= (0.6) *(0.4) = 0.03456

How many ways are there?

How many ways are there of


arranging 3H's and 2T's?
Can list them all:
HHHTT HHTHT HHTTH HTHHT
HTHTH HTTHH THHHT THHTH
THTHH TTHHH
10 ways

Find the probability

10 ways
P(one way) = 0.03456
P(three heads in five tosses)
= 10 * 0.03456
= 0.3456 = 34.56%
Quite a lot of work: maybe there's
a formula or something?

IV

Tossing way too many biased coins

Tossing biased coins

I have a biased coin which has a


60% chance of coming up heads. I
toss it eight times.
What's the probability that exactly
four out of eight are heads?

What's the probability of one way?

Probability of each way will be


found by multiplying
P(H)*P(H)*P(H)*P(H)*P(T)*P(T)
*P(T)*P(T)
P(one way) = (0.6)4*(0.4)4
= 0.003318

How many ways are there?

Too many ways to list; need to


count them without listing them
Fortunately, there's the binomial
coefficient
Number of ways of choosing 4 out
of 8 objects is:

(8*7*6*5*4*3*2*1)/(4*3*2*1*4*3*2*1)

Find the probability


(8*7*6*5*4*3*2*1)/(4*3*2*1*4*3*2*1)

Number of ways is

(8*7*6*5*4*3*2*1)/(4*3*2*1*4*3*2*1)

= 70
P(one way) = 0.003318
P(4 H out of 8) = 70 * .003318
= 0.2322 = 23.22%

Where did that binomial coefficient


come from?

Say you have 4 different heads:


H1 H2 H3 H4; and 4 different
tails: T1 T2 T3 T4
How many ways are there of
arranging these 8 coins?
8 ways of picking the first coin,
then 7 of picking the second given
the first, then 6 of the third...

Where did that binomial coefficient


come from?

If there are 8 different objects, then


there are 8*7*6*5*4*3*2*1 ways
of arranging them
We write this as 8! (pronounced
eight factorial)

Where did that binomial coefficient


come from?

Now, we don't have 8 different


objects: the four head are the same.
How many times are we counting
each set of four heads?
Think about the orders that the
four heads could be in

Where did that binomial coefficient


come from?

The four heads (H1, H2, H3, H4)


could be in any of 4! different
orders
So we're counting each way 4!
times
Need to divide number of ways by
4!

Where did that binomial coefficient


come from?

But the four tails could be in any


of 4! different orders
Then number of ways is 8!/(4!4!)=

(8*7*6*5*4*3*2*1)/(4*3*2*1*4*3*2*1)

= 70

The binomial formula

The binomial formula

The probability of some event


happening on one trial is p
I perform n independent trials
What is the chance of the event
happening exactly k times in n
trials?
Number of times the event occurs
has a binomial distribution

The binomial formula

P(k out of n)
= (no. of ways) * (prob of each way)
=

n!
k
nk
p 1 p
k ! nk !

When can you use the binomial


formula?

We want to know how many times


something does or doesn't happen
e.g. rolling a die multiple times:
- can use binomial if we want to
know number of sixes
- can't use binomial if we want to
know sum of rolls

When can you use the binomial


formula?

n, the number of trials, must be


fixed in advance
p, the probability of success on
one trial, doesn't change
Trials must be independent

Why can't you use the binomial


formula?

I toss a coin until I get a tail.


What's the probability that I get
exactly two heads?
I draw three cards from a shuffled
deck. What's the chance that
exactly two of the cards are
spades?

Example: counting sixes

I roll a die ten times. What's the


probability I get exactly one six?

Example: counting sixes

Use formula:
1
= 10 ! 1 5

1 ! 9! 6

=
=

10987654321 1
1987654321 6
1

1
10
6

5
6

= 32.30%

5
6

Counting sixes: a note

I roll a die ten times. What's the


probability I get no sixes?
0

10

10 ! 1
0 ! 10 ! 6

5
6

10

5
=1
6

i.e. same formula as the power rule

Using the addition rule

I roll a die ten times. What's the


probability I get exactly two sixes
or fewer?
Can add up P(no sixes)
+ P(one six) + P(two sixes);
find each of these probabilities
using the binomial formula

Using the addition rule

P(no sixes) =
P(one six) =

10

5
6

1
10
6

P(two sixes) =

= 16.15%
5
6

= 32.30%
8

10 ! 1
2!8! 6

5
6

= 29.07%

P(no more than 2 sixes) = 77.52%

VI

Is it unusual?

Is it unusual?

I toss a coin six times and get five


tails. Is this unusual?
P(5 or more tails)
= P(5 tails) + P(6 tails)
5
1
= 6(1/2) (1/2) + (1/2)6

Is it unusual?

I toss a coin six times and get five


tails. Is this unusual?
P(5 or more tails)
= P(5 tails) + P(6 tails)
5
1
6
= 6(1/2) (1/2) + (1/2) = 10.94%
Not that unusual
NB: P(5 or more heads) = 10.94%

Is it unusual?

I toss a coin twelve times and get


ten tails. Is this unusual?
P(10 or more tails) = P(10 tails)
+ P(11 tails) + P(12 tails)
12
12
12
= 66(1/2) + 12(1/2) + (1/2)
= 1.93%
Unusual: maybe the coin is biased

Is it unusual?

I toss a coin 24 times and get 20


tails. Is this unusual?
P(20 or more tails) = 0.077%,
or 1 in 1300
Very unusual: strongly suspect the
coin is biased

Recap

The binomial formula

The probability of some event


happening on one trial is p
I perform n independent trials
What is the chance of the event
happening exactly k times in n
trials?
Number of times the event occurs
has a binomial distribution

The binomial formula

P(k out of n)
= (no. of ways) * (prob of each way)
=

n!
k
nk
p 1 p
k ! nk !

When can you use the binomial


formula?

We want to know how many times


something does or doesn't happen
e.g. rolling a die multiple times:
- can use binomial if we want to
know number of sixes
- can't use binomial if we want to
know sum of rolls

When can you use the binomial


formula?

n, the number of trials, must be


fixed in advance
p, the probability of success on
one trial, doesn't change
Trials must be independent

Tomorrow:

The law of averages

You might also like