# Probability that exactly two defectives are observed

A quality control plan calls for randomly selecting 4 items from the daily production (assumed large) of a certain machine and observing the number of defectives. However, the proportion $p$ of defectives produced by the machine varies from day to day and is assumed to have the uniform distribution on the interval $(0.1,0.5)$. For a randomly chosen day, find the (unconditional) probability that exactly two defectives are observed in the sample.

-
What have you tried? Where are you stuck? –  joriki Nov 5 '12 at 9:34
@joriki I don't know how to start. Any suggestions would be great. –  woaini Nov 5 '12 at 9:46
@joriki I made a bit more progress, but I'm not sure where the distribution for p fits in. Let A = two items are defective. $P(A)=_4C_2p^2(1-p)^2=6p^2(1-p)^2$ –  woaini Nov 5 '12 at 10:15

You correctly calculated the probability that exactly two items are defective given the proportion $p$. Since $p$ has uniform distribution on $(0.1,0.5)$, you need to average this over that interval:
$$P(A)=\frac{\int P(A\mid p)\,\mathrm dp}{\int\mathrm dp}=\frac{\int6p^2(1-p)^2\,\mathrm dp}{\int \mathrm dp}=\frac{\left[\frac63p^3-\frac{12}4p^4+\frac65p^5\right]_{p=0.1}^{p=0.5}}{0.4}=0.24572\;.$$