8
$\begingroup$

An urn contains 20 balls colored each of the 7 colors of the rainbow (140 total balls). We select balls one-by-one without replacement. Given that in the first 70 draws we selected 5 more red balls than yellow, find the probability the 71st ball drawn is yellow.

Question Source

My approach

Let us denote the event that the $71^{st}$ ball is yellow by $A$ and the event that there are 5 more red balls than yellow in the first 70 draws by $B$ We need to find

$$ \mathbb{P}(A | B) = \frac{\mathbb{P}(A, B)}{\mathbb{P}(B)} $$

To calculate $\mathbb{P}(B)$, we can make cases for the number of red balls that we see in our first 20 draws (can be between 0 to 15, both inclusive) and sum up the probabilities The procedure we follow to arrive at the expression is:

  1. Choose $r$ red balls out of 20
  2. Arrange them in $r$ out of the first 70 positions
  3. Choose $r+5$ yellow balls out of 20
  4. Arrange them in $r+5$ out of $70-r$ positions
  5. Choose $65-2r$ balls out of the remaining 100 balls of all colours and arrange them in the $65-2r$ positions in the first 70 draws
  6. Arrange the remaining 70 balls after filling the first 70 positions by the remaining 70 balls

To calculate $\mathbb{P}(A | B)$, I employ a similar procedure with the first 5 steps same.

  1. Choose one of the remaining $20-r$ balls and put it in the $71^{st}$ position

On doing so, the numerator and the denominator come out to be long summations of binomial coefficients which I couldn't evaluate.

My thoughts

Being a Quant interview question, I feel that brute force wouldn't be the way to proceed with this. Two facts which could be exploited but I don't know how are:

  1. The number of balls are equal for all the colours. Can symmetry be used somehow over here?
  2. 70 is half of 140. Is there one specific reason they've asked for 70 draws?

Any help, either with evaluating the summation in the brute-force approach or a smarter approach would be great. Thanks!

$\endgroup$
3
  • $\begingroup$ @JanStuller think you read it as 7 red balls. There are 20 red balls but 7 colors. $\endgroup$
    – Attack68
    Commented Sep 27, 2023 at 9:58
  • 2
    $\begingroup$ @Attack68: ah yeh, correct. Then: $$\frac{1}{16}\left(\frac{20}{70}+\frac{19}{70}+\frac{18}{70}+\frac{17}{70}+\frac{16}{70}+\frac{15}{70}+\frac{14}{70}+\frac{13}{70}+\frac{12}{70}+\frac{11}{70}+\frac{10}{70}+\frac{9}{70}+\frac{8}{70}+\frac{7}{70}+\frac{6}{70}+\frac{5}{70}\right)=\\=\frac{1}{16}\frac{200}{70}=\frac{5}{28}\approx17.8\%$$ $\endgroup$ Commented Sep 27, 2023 at 12:35
  • $\begingroup$ You may be interested in learning about the multivariate hypergeometric distribution. $\endgroup$
    – mhdadk
    Commented Sep 27, 2023 at 21:00

10 Answers 10

8
$\begingroup$

Here's an attempt at a more intuitive argument, at the risk of losing some rigor, based on the solution I wrote out in the section after the dividing bar.

Assume that in the first 70 draws, we saw 5 more red balls than yellow balls. Let's answer two questions about our 71'st draw:

1) How much more likely are we to draw yellow than red?

Well, the balls remaining in the urn always have 5 more yellow than red. We can mark 5 yellow balls as "extra", and the probability of drawing those is $5/70$. Other than the extra balls, there are equally many red and yellow balls, so regardless of their number the probabilities cancel.

2) What's the chance we draw either red or yellow?

Let's see why this is just $40/140$, the base rate of yellow and red balls.

We drew 5 more red balls than yellow in the first 70 balls, and are asking about the chance of a red or yellow ball in the remaining 70 balls. But, it was equally likely that we'd get the symmetric situation where we drew the other 70 balls, and got 5 more yellow than red, and are asking about the chance of a red or yellow ball in the first half. So, if we swap "yellow" and "red", we're equally likely to be in either scenario.

The average of these is simply the chance of drawing a red or yellow ball out of either half, so out of all 140 balls, of which 20 are red and 20 are yellow. So, it's $40/140$.

Getting the answer

So, we've found that

$$\mathbb{P}(\text{yellow}) - \mathbb{P}(\text{red}) = 5/70$$ $$\mathbb{P}(\text{yellow}) + \mathbb{P}(\text{red}) = 40/140$$

We can solve these for $\mathbb{P}(\text{yellow})$ by adding and get $\mathbb{P}(\text{yellow}) = 25/140 = 5/28$


Here is an argument that uses kaddy's trick from this other answer with $15-r$, but avoids the binomials altogether and makes the symmetry more obvious.

Let's define $f(r)$ to be the probability that if we draw the $140$ balls in order, the first $70$ balls have exactly $r$ yellow balls and $r+5$ red balls. Note that this implies that the remaining $70$ balls have the remaining $20-r$ yellow balls and $15-r$ red balls. If we let $s = 15 - r$, this is $5+s$ yellow balls and $s$ red balls. Swapping the two halves of $70$ balls, and yellow with red, this is now exactly the event whose probability is $f(r)$, so we have $f(r) = f(s) = f(15-r)$.

The symmetry property $f(r) = f(15-r)$ is the only fact we'll need about $f(r)$.

Let $B$ be the event that the first $70$ balls have exactly $5$ more red balls than yellow. This is just the sum of $f(r)$ over the range of possible $r$'s, which is from $0$ to $15$:

$$ \mathbb{P}(B) = \sum_{r=0}^{15} f(r) $$

Now, if we let $A$ be the event that ball $71$ is yellow, given $B$, the chance that $A$ happens equals the number of remaining yellow balls $20-r$ out of remaining balls $70$. So, summing up over $r$'s.

$$ \mathbb{P}(A, B) = \sum_{r=0}^{15} f(r) \frac{20-r}{70} $$

Here, we swap $r \leftrightarrow 15-r$ and use $f(r) = f(15-r)$ to turn this into:

$$ \mathbb{P}(A, B) = \sum_{r=0}^{15} f(r) \frac{5+r}{70} $$

Now, adding these two formulas term by term, the $r$'s cancel in $\frac{20-r}{70} + \frac{5+r}{70} = \frac{25}{70}$, giving

$$ 2 \mathbb{P}(A, B) = \sum_{r=0}^{15} f(r) \frac{25}{70} = \frac{25}{70} \mathbb{P}(B) $$

So, $\mathbb{P}(A, B) = \frac{25}{2 \cdot 70}\mathbb{P}(B) = \frac{5}{28}\mathbb{P}(B)$, which gives us the conditional probability $$\mathbb{P}(A \mid B) = \frac{\mathbb{P}(A, B)}{\mathbb{P}(B)} = 5/28$$.

$\endgroup$
1
  • $\begingroup$ I love this answer because it gives the best of both worlds, hard rigour as well as intuition! $\endgroup$
    – kaddy
    Commented Sep 28, 2023 at 6:54
7
$\begingroup$

Answering my own question because I figured out a semi-elegant way to approach this analytically and get the closed-form solution.

TL;DR

The probability is $\frac{5}{28}$

Method

The first claim is that the problem of drawing balls from a jar without replacement is exactly identical to making permutations of all the balls in the jar. So making 3 draws is same as arranging all the balls (say in a row) and analyzing the first 3 elements of the row. I simply followed the steps and wrote out the long summations as I mentioned in the question. Assume that we are making cases on the number of Yellow balls we draw in the first 70 draws, let the number be $r$ and let the number of Red balls be thus, $r+5$.

$$ \therefore \mathbb{P}(A | B) = \frac{\frac{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! \times (20 - r) \times 69!}{140!}}{\frac{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70-r}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! 70!}{140!}} $$

Breaking this down term by term: $$ \binom{20}{r} = \text{Choose r out of the 20 yellow balls} \\ \binom{70}{r} r! = \text{Arranging the r yellow balls in r out of the first 70 positions} \\ \binom{20}{r+5}\binom{70-r}{r+5}(r+5)! = \text{Choose r+5 red balls out of the 20 and arrange them in the remaining positions among the first 70} \\ \binom{100}{65-2r}(65-2r)! 70! = \text{Choose and arrange the remaining balls in the remaining spaces in the first 70 draws and also the rest of the spaces in the last 70 draws} $$ For the numerator, after arranging balls in the first 70 draws, we put one of the remaining $20-r$ yellow balls in the $71^{st}$ position and arrange the rest of the balls in the remaining 69 positions.

$$ \therefore \mathbb{P}(A | B) = \frac{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! \times (20 - r) \times 69!}{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70-r}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! 70!} $$

Let us call the numerator $S$

$$ S = \sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! \times (20 - r) \times 69! $$ Now comes the crucial trick employed. Notice how we can reverse the summation or replace $r$ by $15 - r$ $$ \therefore S = \sum_{r = 0}^{15} \binom{20}{15-r}\binom{70}{15-r}(15-r)!\binom{20}{20-r}\binom{70}{20-r}(20-r)!\binom{100}{35+2r}(35+2r)! \times (5 + r) \times 69! $$ On expanding the binomial coefficient and cancelling out terms, we realize that the summations are exactly identical except the terms $(20-r)$ and $(5 + r)$. This can be verified quite easily. $$ \therefore 2S = \sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)! \times 25 \times 69! $$ $$ \therefore \mathbb{P}(A | B) = \frac{25}{2} \times \frac{69!}{70!} \times \frac{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70-r}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)!}{\sum_{r = 0}^{15} \binom{20}{r}\binom{70}{r}r!\binom{20}{r+5}\binom{70-r}{r+5}(r+5)!\binom{100}{65-2r}(65-2r)!} \\ \therefore \mathbb{P}(A | B) = \frac{25}{2 \times 70} = \frac{5}{28} $$

Quantguide accepts $\displaystyle \frac{5}{28}$ as the answer when submitted!

Please let me know if there are any mistakes.

$\endgroup$
1
  • $\begingroup$ Nice looks like the information about the red balls was useful after all. Would down vote my own answer if I could. $\endgroup$
    – Attack68
    Commented Sep 27, 2023 at 11:52
5
$\begingroup$

Here to share my answer. I did not make use of Bayes law or any other probability theorems. I just worked with numbers, which is my usual approach towards these quizzes (there are tons of super smart members on this forum that can probably give way better answers than me).

enter image description here

Just to provide some explanation to my figure:

  • Balls Before: The number of balls in the 140 (as you mentioned) before any pickings.
  • Red > Yellow: I just chose the additional 5 red balls compared to yellow.
  • Balls After: The remaining number of balls after separating red and yellow.
  • Expected Amts in Remaining 65: The expected number of balls drawn per colour excluding red and yellow.
  • Expected Amts in Remaining 70: The remaining number of balls left for the 71st draw.

Therefore, the probability of drawing yellow in your 71st draw is just (in the picture) below = 16/70, which gives us 22.86%.

However, this is with the assumption that the red and yellow balls drawn initially after 9 and 4. They can be 5 and 0, 6 and 1 etc. This gives us a total of 16 combinations, because the last combination of red and yellow is 20 and 15 (because red must be more than yellow by 5).

Lastly, I went through all the combinations and took an average to get the final answer of 17.86%.

Hopefully that helps!

$\endgroup$
2
  • $\begingroup$ I've never considered using numerical methods for such questions. This introduces me to a new approach. Thanks! $\endgroup$
    – kaddy
    Commented Sep 27, 2023 at 11:16
  • 1
    $\begingroup$ No problem! @kaddy, honestly I'm surprised I got it right lol $\endgroup$
    – KaiSqDist
    Commented Sep 27, 2023 at 12:00
4
$\begingroup$

Normally, the expected value of number of balls drawn of a particular in the first half is 10. But we're given that the number of red drawn in the first half is 5 more than the number of yellow drawn. So that moves the expected number of red drawn in the first half is 12.5 and the expected number of yellow is 7.5. So the expected number of expected yellow left is 12.5. If we take 12.5/70, that's 25/140 or 5/28.

Now, I calculated the probability from the expected value, which isn't in general a valid thing to do. So a fully rigorous proof is more complicated, but this is an intuitive argument. To make the rigorous argument, we can use the fact that the probability is linear with respect to the number of yellow ones remaining, and that calculating probabilities from expected values is valid given linearity.

$\endgroup$
3
$\begingroup$

This is my calculation.

If you replaced the original question with:

"An urn contains 20 balls colored each of the 7 colors of the rainbow (140 total balls). We select balls one-by-one without replacement. Find the probability the 71st ball drawn is yellow."

Then there is no infomation, the answer is just 1/7 (0.14285) becuase everything is symmetric.

But we have the information that "in the first 70 draws we selected 5 more red balls than yellow". Red balls are irrelevant. All this means is that when picking the 71st ball you know there are at least 5 yellow balls in the bag. Therefore the probability is higher than 1/7. (Let $Y$ stand for Yellow)

$$ P(Y \; on \;71st) = \frac{1}{7} = \sum_{i=0}^{20} P(Y \; on \; 71st | i \; Y \; in \; bag ) P(i\; Y \; in \; bag) $$

This can be re-expressed as:

$$ \frac{10}{70} - \frac{4}{70} P(4 \; Y \; in \; bag) - \frac{3}{70} P(3 \; Y \; in \; bag) - \frac{2}{70} P(2 \; Y \; in \; bag) - \frac{1}{70} P(1 \; Y \; in \; bag) = P(Y \ on \; 71st| Y \; in \; bag \geq 5) P (Y \;in \; bag \geq 5)$$

Thus if you can calculate the probabilities of how many yellows are in the bag by the 71st go this gives the answer. But I didnt do that by hand. I used excel and got the answer 0.14315. It was quite a low probability (0.003) that there were less than 5 balls in the bag by the 70th turn.

Note: $$ P (i \;Y\; in\; bag\; after\; 70) = \frac{20!}{(20-i)!} . \frac{120!}{(50+i)!} . \frac{70!}{140!} . ^{70}C_i$$

$\endgroup$
3
$\begingroup$

There are some nice answers above. This is a Python implementation of it that just shows how straightforward this question is. Same method as @Jan Stuller. Using the fractions module gives a nice non-decimal answer.

It's important with conditional probabilities to think it out first. They often seem confusing and intricate on the surface, but oftentimes, they are not!

import numpy as np
from fractions import Fraction

yellow_remaining = np.arange(5, 21)

probabilities = yellow_remaining / 70

average_probability = np.mean(probabilities)

fraction = Fraction(average_probability).limit_denominator()
print(fraction)

Output:

5/28
$\endgroup$
3
$\begingroup$

There has been already lots of great answers (but I can't agree with those who simply say average the probabilities)

This is another way by total probability theories

$Pr[A|C] = \sum_{T}Pr[A|T \cap C] * Pr[T|C]$

where $T$ is a partition

Let's first set some events

$Y$ : the 71th draw is yellow

$M$ : there are five more red balls drawn than yellow ball

$T=t$ : there are t yellow balls have been drawn

So what is asked is $Pr[Y|M]$

Use the total probability for conditional probability :

$Pr[Y|M] = \sum\limits_{t=0}^{15} Pr[Y|M\cap T=t] \times Pr[T=t|M]$

Let's look at each term:

the first term:

$Pr[Y|M\cap T=t] $ is the probability of drawing a yellow ball given that in the previous 70 draws there are t yellow balls and 5 more red balls. i.e. the probability of drawing a yellow ball given that in the previous 70 draws there are $t$ yellow and $t+5$ red balls

It is simply $\frac{20-t}{70}$

the second term

$Pr[T=t|M] \\= \frac{Pr[T=t \cap M]}{Pr[M]} $

where

$Pr[T=t\cap M]={20\choose t} \times {20\choose 5+t} \times {140-20-20\choose 70-t-t-5}/{140\choose 70}$

and
$Pr[M]=\sum\limits_{q=0}^{15}Pr[M \cap T=q] = \sum\limits_{q=0}^{15} {20\choose q}\times{20\choose q+5}\times{140-20-20\choose70-q-q-5}/{140\choose 70}$

This is because $M\cap T=q$ forms a partition of $M$, for $q={0,1,...15}$

Put them all together:

$$Pr[Y|M] = \sum\limits_{t=0}^{15}\frac{20-t}{70}\times \frac{{20\choose t}{20\choose t+5}{100\choose 65-2t}}{\sum\limits_{q=0}^{15}{20\choose q}{20\choose q+5}{100\choose 65-2q}}$$

Note that $q$ and $t$ are independent variables

Then use the trick given by kaddy it can be simplified to the result mentioned in the question

From it you can also see why I don't think average probabilities is the right way, because those probabilities have different weights

This can be generalized as the same procedure above and hope the generalization can answer if the half of the numbers are contrived or if the symmetry is necessary

$\endgroup$
10
  • 1
    $\begingroup$ When you say you can't agree with those who simply say average the probabilities, I assume you are referring to my answer? Could you pls specify why you disagree? Say the question instead said: "Given that either 10 or 19 yellow balls had been drawn in the first 70 draws, what is the probability of the 71st ball being yellow?" Why should the answer not be: $$\frac{1}{2}\left(\frac{10}{70}+\frac{1}{70}\right)$$ ? $\endgroup$ Commented Sep 28, 2023 at 8:59
  • $\begingroup$ Because 10 yellow being drawn is more likely than 19 being drawn, so those appear more often in the sample space. $\endgroup$ Commented Sep 28, 2023 at 23:27
  • $\begingroup$ This may be easier to see with smaller numbers: suppose there is 1 Y, 1 R, 1 G. You are told that either 1 or 0 Y are chosen in the first spot, and you are asked to determine the probability that a Y is is the second spot. Your method would say this is $\frac 12(\frac 12 + 0)=\frac 14$, when the chance is $\frac 13$. The chance that $0$ are drawn in the first spot is twice as likely as $1$, so a correct calculation would factor in those weights: $\frac23(\frac 12) + \frac13(0)$ $\endgroup$ Commented Sep 28, 2023 at 23:32
  • $\begingroup$ @ZackWolske: Your computation is the following example: $$\frac{2}{3}\left(\frac{1}{2}\right)+\frac{1}{3}\left(0\right)=\mathbb{P}\left(R_1\cup G_1\right)\mathbb{P}(Y_2|(R_1\cup G1))+\mathbb{P}(Y_1)\mathbb{P}(Y_2|Y_1)=\mathbb{P}((R_1\cup G_1)\cap Y_2)+\mathbb{P}(Y_1\cap Y_2)=\mathbb{P}\left((Y_1^C\cap Y_2)\cup(Y_1\cap Y_2)\right)$$ In words, what is the probability that the second ball is yellow if the first ball is either yellow or not yellow ($Y_1$ means first draw is yellow ball, $Y_1^C$ is the complement event of the first ball being yellow). $\endgroup$ Commented Sep 29, 2023 at 10:56
  • 1
    $\begingroup$ Stuller, you find it :P I'm sorry if the answer sounds not polite :P well, for your question , you can follow the same procedure using "total probability theory" and get a different answer. You can see from the last equation, the answer (to the question in the post) is the weighted sum of probabilities you average, but they have different weights, so if you simply average them to get the result you should mention some other reason for example, the "symmetry" $\endgroup$
    – D_K
    Commented Sep 30, 2023 at 18:35
3
$\begingroup$

Consider each yellow ball individually as a trial. For any yellow ball, its value is $1$ if it lands in spot $71$, and the value is $0$ otherwise.

We know that $5$ of the yellow balls have to be among the spots $71$ to $140$. Each of them has an expected value of $1/70$.

We know that $15$ of the yellow balls can be anywhere. Each of them has an expected value of $1/140$.

By linearity of expectation, the total expected value for the yellow balls, i.e. the expected number of yellow balls at spot $71$, i.e. the probability that the $71$st ball is yellow, is

$5 \cdot \frac{1}{70} + 15 \cdot \frac{1}{140} = \frac{5}{28}$.

$\endgroup$
1
  • $\begingroup$ Wow. Most elegant andwer yet. $\endgroup$ Commented Sep 29, 2023 at 19:30
2
$\begingroup$

You are right that choosing exactly half is helpful. Suppose the difference $R-Y=x$ in the first half (so your specific question has $x=5$). The probability that the 71st draw is $Y$ is the same as any other draw after $70$, so we can compute the expected number of $Y$ in the second half, $E(x)$, then divide by $70$. Notice that $E(x)+E(-x)=20$, since if $R-Y=x$ in the first half, then $R-Y=-x$ in the second half, and there are $20$ $Y$ in total. Finally, $E(x)-E(-x)=x$, since $E(x)$ is also the expected value of $R+x$ in the second half (similarly, $E(-x)$ is the expected value of $R-x$ in the second half), and expectation is linear. Thus, $E(x)=10+\frac x2$, and we get $E(5)=\frac{25}{2}$, so the probability is $\frac{25}{140}$.

$\endgroup$
1
  • 1
    $\begingroup$ Just wanted to thank thank you for your comments, which helped me clarify the logical flaw in my thinking. You were correct, and I was wrong. $\endgroup$ Commented Oct 4, 2023 at 19:40
1
$\begingroup$

Problem Statement A jar contains 140 balls with 7 different colors, 20 balls for each color. A total of 70 balls are removed. Among these 70, the number of red balls is 5 greater than the number of yellow balls. The question is: if one more ball is drawn, what is the probability that it will be yellow?

Solutions A. With the Data Given Conditions:

R=Y+5, where � R is the number of red balls and � Y is the number of yellow balls among the 70 removed. Analysis: The actual number of red and yellow balls among the 70 removed depends on the number of "other colors" removed, leading to a range of possibilities. Result: The probability of drawing a yellow ball next ranges from a minimum of (or 7.14%) to a maximum of ​ (or 28.57%). B. With Probabilistic Data Added Assumption: The 70 balls removed followed the original uniform distribution of 7 colors. Analysis: Under this assumption, 10 yellow balls would have been among the 70 removed, leaving 10 yellow balls in the jar. Result: The probability of drawing a yellow ball next would be

or 14.29%. The 14.29% probability falls within the range calculated with the original data, serving as a specific answer under a reasonable assumption.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.