Problem: 3.37

A small company has five employees: Anna, Ben, Carl, Damian, and Eddy. There are five parking spots in a row at the company, none of which are assigned, and each day the employees pull into a random parking spot. That is, all possible orderings of the cars in the row of spots are equally likely.

(a) On a given day, what is the probability that the employees park in alphabetical order?

Parking alphabetically would be just one arrangement among all possible ordering of five cars in five parking spaces i.e. permutation of 5

So total possible ways of parking in 5 spaces = 5! Probability of parking in alphabetical oder = 1/5! = 1/120 = 0.008333333 or .08%

p_alphabetical <- 1/factorial(5)
print(p_alphabetical)
## [1] 0.008333333

(b) If the alphabetical order has an equal chance of occurring relative to all other possible orderings, how many ways must there be to arrange the five cars?

Total ways of arranging cars= 5! = 120

total_ways <- factorial(5)
print(total_ways)
## [1] 120

(c) Now consider a sample of 8 employees instead. How many possible ways are there to order these 8 employees cars?

Answer-1. if we assume that parking spaces are also increased from 5 to 8, total ways of arranging cars = 8! = 40,320

tot_for_eight_cars <- factorial(8)
print(tot_for_eight_cars)
## [1] 40320

Answer-2. if we assume that there are still 5 parking spots:

total ways of arranging cars = 8!/(8-5)! = 6,720

tot_for_eight_cars_5park <- factorial(8)/factorial(8 - 5)
print(tot_for_eight_cars_5park)
## [1] 6720