Four co-workers carpool to work each day. A driver is selected randomly for the drive to work and again randomly for the drive home. Each of the drivers has a lead foot, and each has a chance of being ticketed for speeding. Driver A has a 10 percent chance of getting a ticket each time he drives, Driver B a 15 percent chance, Driver C a 20 percent chance, and Driver D a 25 percent chance. The state will immediately revoke the license of a driver after his or her third ticket, and a driver will stop driving in the carpool once his license is revoked. Since there is only one police officer on the carpool route, a maximum of one ticket will be issued per morning and a max of one per evening.

Assuming that all four drivers start with no tickets, how many days can we expect the carpool to last until all the drivers have lost their licenses?

Just a simulation from me this week. I’m sure there’s a nice analytical approach.

sim <- function(){
drivers <- 1:4
tickets <- replicate(4, 0)
n <- 0
while(length(drivers) > 0){
if (length(drivers) == 1){
driver = drivers
}

else{
driver <- sample(drivers, 1)
}

x <- runif(1)
if (x < (0.1 + (driver - 1)*0.05) ) {

tickets[driver] = tickets[driver] + 1
}
if (tickets[driver] == 3) {
drivers <- drivers[drivers != driver]
}
n = n + 1
}
return(n)
}

v <- c()

for (i in 1:10000){
v <- c(v, sim())
}

mean(v)
## [1] 76.9298

So the carpool should end on the 38th day.

And here’s a histogram.

library(ggplot2)
library(ggthemes)

df <- as.data.frame(v)

ggplot(df, aes(v)) +
geom_histogram(bins=40) +
theme_fivethirtyeight()