# 2 Probability questions: distributions - Expectations

Q:
In the grocery store, there are 2 kinds of egg cartons (12 eggs each) .
$$80\%$$ of the cartons have exactly $$1$$ broken egg. In the other $$20\%$$ there are exactly $$3$$ broken eggs. You want to buy a carton that include exactly one broken egg, but you can't examine each egg (because you have no time ) you only check $$3$$ eggs for each carton.
If you find one or more broken eggs in the $$3$$ that you examine, you return the carton back, else you take it.

How many cartons do you need to return until you will find the carton you want?

My go:
This sounds like a Geometric distribution because you search and search until you find something (and then stop) so basically $$X \sim G(p)$$ The chance of finding the right carton is $$0.8 \cdot \frac{1}{12} + 0.2 \cdot \frac{9}{12} \cdot \frac{8}{11} \cdot \frac{7}{10} \approx 0.143$$
And so the mean is $$E[X] = \frac{1}{p} = \frac{1}{0.143} \approx 6.9915 \approx 7$$ so $$7$$ cartons, so you will return $$6$$ Am I right?

Another question:

Same exact story as described above.
You would like to take $$4$$ cartons, what is the probability you will need more than $$7$$ cartons in order to get $$4$$ that satisfy your rules? (that you examine 3 random eggs and if you find $$\geq$$ 1 eggs you return it and search another one) ?

My go:

I did not quite understood how to approach it using distributions, it sounds like HyperGeometric however I am not sure! The tip for the question is:

Define $$X_3$$ to be the number of cartons you return until you get to $$4$$ cartons

Thank you for helping!

• "If you find one or more broken eggs in the 3 ..." Don´t you find always at least one broken egg in a carton? May 20 '20 at 17:32
• @callculus you examine 3 eggs per carton , you can find 3 eggs that are completely fine May 20 '20 at 18:47

Let $$X$$ be a random variable indicating the number of broken eggs in a randomly selected carton, so $$X = 1$$ if it has one broken egg, and $$X = 3$$ if it has three. Then $$\frac{X - 1}{2} \sim \operatorname{Bernoulli}(p = 0.2).$$ Let $$Y \mid X \sim \operatorname{Hypergeometric}(N = 12, n = X, m = 3), \\ \Pr[Y = y \mid X = x] = \frac{\binom{x}{y} \binom{12-x}{3-y}}{\binom{12}{3}}$$ represent the random number of broken eggs observed when a sample of $$m = 3$$ eggs are taken without replacement. Then we want to compute the unconditional probability of acceptance $$p$$, i.e., \begin{align*} p = \Pr[Y = 0] \\ &= \Pr[Y = 0 \mid X = 1]\Pr[X = 1] + \Pr[Y = 0 \mid X = 3]\Pr[X = 3] \\ &= \frac{\binom{1}{0}\binom{11}{3}}{\binom{12}{3}} (0.8) + \frac{\binom{3}{0}\binom{9}{3}}{\binom{12}{3}} (0.2) \\ &= \frac{3}{4} (0.8) + \frac{21}{55} (0.2) \\ &= \frac{186}{275}. \end{align*} Therefore, the number of rejected cartons $$R$$ until the first accepted carton is a geometric random variable with success probability $$p$$; i.e. $$\Pr[R = r] = (1-p)^r p, \quad r \in \{0, 1, 2, \ldots \}.$$

For the second part of the question, this is simply a negative binomial probability. Let $$T$$ represent the number of cartons you need to try until you get four that you want. Then $$T \sim \operatorname{NegativeBinomial}(k = 4, p = \tfrac{186}{275}), \\ \Pr[T = t] = \binom{t-1}{k-1} (1-p)^{t-k} p^k, \quad t \in \{k, k + 1, k + 2, \ldots\}.$$ The desired probability is $$\Pr[T \ge 7].$$

In the second part of the question, we were interested in the probability that we would need to try at least $$7$$ cartons before accepting $$4$$. Once we accept $$4$$ cartons, what is the posterior probability distribution for the number of cartons we accepted with only one broken egg?
• Thank you for your answer! just a little thingy I noticed: it is $\frac{186}{275}$ =) thank you!! I will take a shot at the bonus question you added May 20 '20 at 19:50