# Solved – Example of using binomial distribution

Q: Is my approach correct?

Event: You toss 5 coins at once.

A student of mine claimed he got 4T & 1H in 39 out of 40 trials (!!)

I decided to calc the odds of this…

First, P(4T & 1H) = 5C4 * (1/2)^4 * (1/2)^1 = .16

I did this 2 ways:

1) Binomial Probability

n = 40

r = 39

p = .16

q = .84

P(Exactly 39) = 40 C 39 * (.16)^39 * (.84)^1 = 0%

2) Binomial Distribution:

n = 40

r = 39 (or more)

p = .16

q = .84

E(X) = u = np = (.16)(40) = 6.4

SD = SQRT(npq) = 3.16

Z(39) = (observed – expected) / SD = (39 – 6.4) / 3.16 = 10.3

p = P( Z > 10.3) = 0%

Conclusion: The odds of getting 4T & 1H in 39 out of 40 trials is negligible.

Student was on drugs at the time.

Contents

How about a simulation based approach? Here's some R code to generate 100000 students each trying the 40 tosses.

``theSum = c() for (i in 1:100000) {   coin1 = rbinom(40,1,.5)   coin2 = rbinom(40,1,.5)   coin3 = rbinom(40,1,.5)   coin4 = rbinom(40,1,.5)   coin5 = rbinom(40,1,.5)   theSum[i] = sum(coin1+coin2+coin3+coin4+coin5 == 1) }  summary(theSum) hist(theSum, xlim = c(0,40), freq = F, main = "", xlab = "") ``

The range of times the HTTTT combination occurred (in any order): 0-18 (out of 40), with a mean of around 6.

Below: a histogram of the 100000 attempts and how many times the magical combination occurred. You'd have to be very lucky indeed to get it 39 times out of 40 with fair coins. But stranger things have happened by chance (e.g., our evolution).

alt text http://img80.imageshack.us/img80/9268/coinflips.png

Rate this post