# Expected number of red balls in an urn | a specific ball being in it

This is a follow-up on this question.

We toss balls into urns. Denote with $x$ the number of balls in an urn. And $x_r$ denotes the number of red balls. The share of red balls among the balls is denoted as $P$. We toss these balls into urns in a manner such that $g(x) = 1/4 \,, x \in [0, 3]$, where $g(x)$ is the probability mass function of an urn of having $x$ balls.

Each urn will pick a winning ball. If there is a red ball among the balls, it will randomly pick a red ball. If there is none, if will pick at random among all its balls.

We want to determine that probability at which a specific red ball $\tilde x_r$ will get "picked" as a winning ball after it has been tossed into one of the urns. Intuitively, one way of calculating that is computing $E[x_r | \tilde x_r]$, the expected number of red balls in an urn conditional on our ball being in it, and then dividing by that number.

How would I compute that expectation? The set-up that I had in mind (see original question) would calculate the expected number of red balls conditional on there being at least one red ball, not the specific red ball.

Importantly, I'd like to find out how to set up this expectation in general - that is, I'm looking for nudges and hints towards a general approach, not just a numerical solution for this case.

Part of the difficulty of this problem is figuring out what it is supposed to mean. We draw some red balls and non-red balls from some reservoir containing an unspecified number of balls and put them into an unspecified number of urns. There appears to be some external mechanism (four-sided fair die, perhaps) governing how many balls go into each urn.

The only actual numbers we are given are the probability distribution of the number of balls placed in any given urn, and the proportion $p$ of red balls in the original reservoir.

To illustrate the importance of the unspecified number of total balls and urns, suppose $p = 1/3$, and more specifically suppose there are actually only three balls in the reservoir and there is only one urn. We can satisfy all the literal requirements of the problem statement (except possibly the reference to plural "urns", but in math we often use a plural noun when describing "one or more" or even "zero or more" things), but now the "specific" red ball is the only red ball, so conditioned on the event that it is in the urn, it is picked with probability $1$. That is not a very satisfying answer, however.

Suppose instead there are six balls and one urn, $p = 1/3$, so the reservoir contains the specific red ball and one other red ball. Letting $X$ be the total number of balls in the urn, $X_r$ the number of red balls in the urn, $R = 1$ if the specified ball is in the urn, $0$ otherwise, and $S = 1$ if the specified red ball is "picked", $0$ otherwise, we get the following prior distribution: \begin{align} P(X=0) &= \frac14 \tag A\\ P(X=1, R=0, S=0) &= \frac14 \cdot \frac56 = \frac{5}{24} \tag B\\ P(X=1, R=1, S=1) &= \frac14 \cdot \frac16 = \frac{1}{24} \tag C\\ P(X=2, R=0, S=0) &= \frac14 \cdot \frac23 = \frac16 \tag D\\ P(X=2, X_r=1, R=1, S=1) &= \frac14 \cdot \frac{4}{15} = \frac1{15} \tag E\\ P(X=2, X_r=2, R=1, S=0) &= \frac14 \cdot \frac{1}{15} \cdot \frac12 = \frac1{120} \tag F \\ P(X=2, X_r=2, R=1, S=1) &= \frac14 \cdot \frac{1}{15} \cdot \frac12 = \frac1{120} \tag G \\ P(X=3, R=0, S=0) &= \frac14 \cdot \frac12 \cdot \frac18 \tag H\\ P(X=3, X_r=1, R=1, S=1) &= \frac14 \cdot \frac{3}{10} = \frac{3}{40} \tag J \\ P(X=3, X_r=2, R=1, S=0) &= \frac14 \cdot \frac15 \cdot \frac12 = \frac{1}{40} \tag K \\ P(X=3, X_r=2, R=1, S=1) &= \frac14 \cdot \frac15 \cdot \frac12 = \frac{1}{40} \tag L \\ \end{align}

Conditioning on the specified red ball being in the urn, we have that one of the events on lines C, E, F, G, J, K, and L occurred; the total probability of these events is $1/4$. The specified red ball is "picked" in cases C, E, G, J, and L: the total probability of these events is $13/60$. Hence the conditional probability of "picking" the specified red ball, given that it is in the urn, is $13/15 \approx 0.86667$.

The expected number of red balls in the urn, given that the specified red ball is in the urn, is $E(X_r \mid R=1) = 7/6$; then $1/E(X_r \mid R=1) = 6/7 \approx 0.85714$. Close, but not quite correct.

But this is still not a satisfying answer. I give it only to illustrate the fact that computing the expected number of red balls is a waste of effort (it gives a wrong answer), and to show an example of a different way to compute the conditional probability that is actually correct for a particular variation of this problem.

For the problem we want to solve, we probably imagine that there is an immense number of balls in the reservoir, so that the chance of the specified red ball landing in any given urn is extremely small; but by supposing a large enough number of urns (up to $1/3$ as many urns as balls) we can make it reasonably likely that the specified red ball lands in one of them. For a very large number of balls, if the specified red ball lands in an urn with one other ball, the probability that the other ball is red is almost equal to $p$; in the limiting case, as the total number of balls grows without bound, the probability is exactly equal to $p$.

I think the limiting case I have just described is the one we would like to solve. It is probably easier if we pick a single urn to "observe", in which case the probability of the special red ball landing in that urn is some very small probability $q$. The method for solving the problem in general is then similar to solving for the problem of six balls and one urn, except that we must recalculate the probabilities in each of the cases A through L, using $p$ as the probability of choosing some red ball other than the specified one each time we draw a ball from the reservoir, and we should express them in terms of the parameter $p$ instead of substituting $p=1/3$ and reducing all the probabilities to explicit numbers.

If we really want to be rigorous about this, we might take into account the fact that the reservoir is still finite and the probability of choosing a second red ball is less than the probability of choosing one on the first draw, but this will introduce a lot of small "correction" terms that I think will all go to zero in the limit.