Lets say you have a deck with 10 cards each of 8 different colors. You then deal 40 card to someone. So you would expect their hand to be 5 cards of each color. You then get the additional knowledge through play that 6 of those 40 cards are yellow. So now what is the expected number of yellow cards out of the 40? What is the expected number of green cards?

The way I calculated the answer for yellow, is that it would be the sum of the P(that they got exactly 6 yellow cards) * 6 + P(that they got exactly 7 yellow cards) * 7 + P(that they got exactly 8 yellow cards) * 8 + P(that they got exactly 9 yellow cards) * 9 +P(that they got exactly 10 yellow cards) * 10: $$E(yellow)\sum_{k=6}^{10} P(k) * k$$

If we were to calculate the P(that they got exactly k cards) it can be done using the hypergeometric distribution function. Or in google sheets: =hypgeomdist(k,40, 10, 80) but since we know that k 0..5 didn't happen I normalized it by dividing by the sum of the probabilities that it could still be: $$P(6) = hypgeomdist(6,40, 10, 80) / \sum_{k=6}^{10} hypgeomdist(k,40, 10, 80) $$ or 0.578.

Doing likewise for the other numbers and plugging into the formula for expected values I got 6.5609691926 yellow cards in the original 40 dealt. Does this seem correct to you?

For the green or other colors I would think that they then no longer can be 5 but something less. I would think I could calculated it by $$\sum_{k=6}^{10} P(k) * E(green)$$. where $$E(green) = 10/(80 - k) * (40 - k)$$ because if we remove k yellow ones from the deck and there will be at 10/(80-k) chance each time of getting a green and we would still have been picking 40-k other cards. However that ends up working out to be E(green) = 4.55 but this seems wrong, because I should also be able to calculate it with $ E(green) = (40 - E(yellow)) / 7 $ since the other colors should have the same probability, and that works out to: 4.777. What am I doing wrong? How can I get to 4.777 without relying on E(yellow) for if the number of cards of the other colors weren't the same in the original deck I wouldn't be able to do that?

  • $\begingroup$ Your "indicator variable reasoning" is wrong because it is not sufficient to condition on "first 6 cards are yellow, expected value of 7th/8th/9th/10th card is green". All that you know is "at least 6 cards are yellow", but you do not know which 6, so IV arguments don't work as well here. $\quad$ Your original approach looks good (I didn't check the calculations), and it's how I would have approached it. $\endgroup$
    – Calvin Lin
    Mar 24 at 15:37

2 Answers 2


The answer of Mike Earnest is much more elegant than the approach in this answer. Further, I suspect that his answer represents the intent of the problem composer.

However, although linearity of expectation is valid, even with dependent events, it can sometimes be challenging to use your intuition to originate such an elegant answer.

So, this response describes what to do, if your intuition is not developed enough to originate a linearity of expectations solution. The analysis here will resemble the analysis suggested by the OP (i.e. original poster).

For $~k \in \{0,1,2,\cdots,10\},~$ let $~f(k)~$ denote the probability that the $~40~$ cards contain exactly $~k~$ yellow cards.


$$f(k) = \frac{\binom{10}{k}\binom{70}{40-k}}{\binom{80}{40}}.$$

Let $~T~$ denote $\displaystyle ~\sum_{k=6}^{10} ~f(k).$

So, since you are given that there were at least $~6~$ cards received in the $~40~$ cards, the expected number of yellow cards received is

$$\frac{\sum_{k=6}^{10} k \times f(k)}{T}. \tag1 $$

Assuming that I am interpreting the original posting correctly, this portion of my answer agrees with the Math indicated by the OP.

For $~k~ \in \{0,1,2,\cdots,10\},$
and for $~s~ \in \{0,1,2,\cdots,10\},$

Let $~g(k,s)~$ denote the probability that there were exactly $~k~$ yellow cards received and (simultaneously) exactly $~s~$ green cards received.


$$g(k,s) = \frac{\binom{10}{k}\binom{10}{s}\binom{60}{40 - [s + k]}}{\binom{80}{40}}.$$

Let $~a(s)~$ denote the probability that there were exactly $~s~$ green cards received, under the assumption that there were at least $~6~$ yellow cards received.


$$a(s) = \frac{\sum_{k=6}^{10} g(k,s)}{T}. \tag2 $$

Before proceeding further, it is important to stretch your intuition to understand why the formula in (2) above is accurate. In order to understand this, re-examine the equation in (1) above, where you divided by $~T.~$

Note that for each $~k~$ in $~\{0,1,2,\cdots,10\},~$ that $~f(k)~$ may be $\color{red}{\text{re-interpreted}}$ as

$$\sum_{s=0}^{10} g(k,s).$$

So, instead of thinking of $~T~$ as the normalization factor that represents the $~5~$ events of having either $~6,~7, ~8, ~9, ~$ or $~10~$ yellow cards, think of $~T~$ as the normalization factor that represents the $~55~$ events of there being $~[k,s]~$ yellow and green cards respectively, where $~k~$ runs from $~6~$ through $~10,~$ and $~s~$ runs from $~0~$ through $~10.$

So, in (2) above, normalizing by $~T~$ in effect represents restricting your focus to the $~55~$ possible combinations of $~[k,s].$

Then, the expected number of green cards received, assuming that at least $~6~$ yellow cards were received is

$$\sum_{s=0}^{10} s \times a(s).$$

  • $\begingroup$ Thanks! The formula for g(k,s) was the missing piece and it makes sense to me. I wasn't choosing green simultaneously as you said. Plugging the formulas into WolframAlpha does indeed then get the 6.56 result for E(yellow) and 4.77 answer for E(green) $\endgroup$ Mar 30 at 14:10

We can simplify both calculations greatly using linearity of expectation.

You know that $6$ cards are yellow. For each of the $34$ unknown cards, the probability that card is yellow is $\frac{4}{74}$, because each card is randomly chosen from the remaining $74$ cards, of which $4$ are yellow. By linearity of expectation, the expected number of yellow cards is $$ E[\text{yellow}]=6+34\times\frac{4}{74}\approx 7.84. $$ For the green cards, the same calculation gives $$ E[\text{green}]=34\times \frac{10}{74} \approx 4.59. $$ As a sanity check, you can verify that $E[\text{green}]=(40-E[\text{yellow}])/7$.

  • $\begingroup$ To me this is answering the problem of look at deck, take 6 yellow cards into your hand, deal the 34 others randomly. I feel like that should be a different answer than dealing the 40 cards randomly. If 9 yellow cards were shown, by this logic there would be 31/71 chance it would be 10, but by hypergeometric distribution there is only a 0.05% chance all 10 yellows would be selected. $\endgroup$ Mar 30 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .