When a certain driver parks their car in the evenings, they are equally likely to remember or to forget to switch off the headlights.

Giving your answers in their simplest index form, find the probability that on the next 16 occasions that they park their car in the evening, they forget to switch off the headlights:

a) 14 more times than they remember to switch them off [2]

From the given information, we can define X to be the number of events the driver forget to switch off the headlights. As the probability of the driver remember and forget to switch off the headlights are the same, so:

\[ P (forget~to~switch~off = F) = P (remember~to~switch~off = R) = \frac{1}{2}\] For each time, there is a Bernoulli trail for the driver. with two options: either turn off, or forget, each with probability = 1/2. For the next 16 events, assuming that they are independently happened, the probability that the driver forget to switch off the headlights should follow a binomial distribution, with n = 16, parameter p = 1/2.

\[ F(orgot) \sim {\sf Binomial}(n = 20, ~~p = 0.2) \] We can then draw the following diagram:

par (mfrow = c (1,1))
### let probability = p = 0.5, and number of events n = 16 to make my life easier...
p <- 0.5
n <- 16
plot( dbinom (0:n, size = n, prob = p), 
      type = "l", col = "blue", lwd = 3,
      xlab = "F -- number of times the driver \n forgets to turn off the headlight",
      ylab = "probability", main = "A binomial distribution graph")
points ( 15, dbinom (15, size = n, prob = p), pch = 16, col = "red")
abline ( h = 2^-12, lty = 2, col = "red", lwd = 2)

### The following few chunks are not related to solve this problem:

As you can see, the curve above doesn’t seem too smooth, this is because we only take 17 values, if we divide the whole plot into more parts, say 1000 and approximate this into a normal distribution, it will looks better

bbbbb <- seq (0 , n , length.out = 1000)
plot( bbbbb, dnorm ( bbbbb , mean = n*p , sd = sqrt (n*p*(1-p) ) ), 
      type = "l", col = "coral", lwd = 3,
      xlab = "F -- number of times the driver \n forgets to turn off the headlight",
      ylab = "probability", main = "A NORMAL distribution graph")

Now, we’re going to settle this problem using R: As it is said to have 14 more times a driver forgets to switch off the headlight , and the total number of events n = 16, we can have:

F + R = 16
F - 14 = R

solving this system we will get:

F = 15
T = 1

so:

answer_a <- dbinom (15, size = n, prob = p)
print(answer_a)
## [1] 0.0002441406

to the index form we can take log:

log ( answer_a, base = 2)
## [1] -12

\[ P (F = 15) = 2^{-12} \] Note: you should perform adept calculation using combination C during the exam!!!

b) at least 12 more times than they remember to switch them off. [3]

Still, using the lines of equations you’ve formed in question a:

(a set of equation with two variables both raised to the power of 1)

you just need to replace: the second equation parameter 14 into: 12 to 16. This is to indicate that the driver forgets to turn off the headlight more than and include 12 times.

Remember: when you get the result of F and R, omit the answers with half values (29/2 or 31/2). So actually, F = (14, 15, 16)

We can calculate this using R:

answer_b <- sum (dbinom (c (14:16), size = n, prob = p))
print (answer_b)
## [1] 0.002090454

if you do it with your calculator using C function for combination, you will be familiar with how this 137 comes from:

log (answer_b / 137 , base = 2)
## [1] -16

\[ P (F = 14~to~16) = 137 \times 2^{-16} \]

plot( dbinom (0:n, size = n, prob = p), 
      type = "l", col = "navy", lwd = 3,
      xlab = "F -- number of times the driver \n forgets to turn off the headlight",
      ylab = "probability", main = "A binomial distribution graph")
points ( c(14:16) , dbinom (14:16, size = n, prob = p), pch = 16, col = "red")
abline ( v = 14, lty = 2, col = "red", lwd = 2)

### If they are plotted in a normal distribution: (just for fun~~~~)
plot( bbbbb, dnorm ( bbbbb , mean = n*p , sd = sqrt (n*p*(1-p) ) ), 
      type = "l", col = "coral", lwd = 3,
      xlab = "F -- number of times the driver \n forgets to turn off the headlight",
      ylab = "probability", main = "A NORMAL distribution graph")
points ( c(14:16) , dnorm (14:16, mean = 8, sd = 2), pch = 16, col = "blue")
lines( c(14:16) , dnorm (14:16, mean = 8, sd = 2), lty = 2, lwd = 2, col = "navy")
abline ( v = 14, lty = 2, col = "blue", lwd = 2)