Link to Problem: HERE
A manufactured lot of buggy whips has 20 items, of which 5 are defective. A random sample of 5 items is chosen to be inspected. Find the probability that the sample contains exactly 1 defective item
The probability of selecting a defecetive item is \(\frac{1}{4}\). The probability of selecting a working item is \(\frac{3}{4}\). As an example, one possible pattern that results in exactly 1 defective unit would be selecting 4 working units and then one defective unit, given by probability \((\frac{3}{4})^4 (\frac{1}{4})\). Since all possible outcomes featuring one defective unit have the same probability, this calculation must be multiplied by the number of unique ways that 1 defective unit can be selected out of 5. Thus, the final probability is:
\[{5\choose1}(\frac{3}{4})^4(\frac{1}{4})=0.3955\]
choose(5, 1) * 0.75 **4 * 0.25
## [1] 0.3955078
This can be confirmed via simulation:
units <- c(rep(0, 15), rep(1, 5))
valid <- 0
for(i in 1:50000){
if(sum(sample(units, 5, replace=TRUE)) == 1){
valid <- valid + 1
}
}
valid / 50000
## [1] 0.39354
To calculate the probability without replacement, let’s consider one possible scenario. Specifically, let’s calculate the probability that the defective unit is selected last:
\(\frac{15}{20}(\frac{14}{19})(\frac{13}{18})(\frac{12}{17})(\frac{5}{16})\)
and lets compare it to the probability that the defective unit is selected second to last:
\(\frac{15}{20}(\frac{14}{19})(\frac{13}{18})(\frac{5}{17})(\frac{12}{16})\)
Careful inspection of the probability will reveal that they are the same value. This can be confirmed by calculating the probability, but also through verification that both equations are made up of the same individual components in the numerator and denominator. Thus we simply need to calculate any one of these probabilities and multiply it by the number of possible ways this outcome can be achieved.
\[{5 \choose 1}(\frac{15}{20})(\frac{14}{19})(\frac{13}{18})(\frac{12}{17})(\frac{5}{16})=0.4402\]
choose(5, 1) * 15/20 * 14/19 * 13/18 * 12/17 * 5/16
## [1] 0.440209
This can be confirmed via simulation:
units <- c(rep(0, 15), rep(1, 5))
valid <- 0
for(i in 1:50000){
if(sum(sample(units, 5, replace=FALSE)) == 1){
valid <- valid + 1
}
}
valid / 50000
## [1] 0.44032