# Probability for number of contained coins

Here is a situation for a probability question

Assume that you have a bag containing 10 coins. You know that there may be either silver or gold coins in the bag, but you do not know how many silver and gold coins there are.

Because the size is just 10, I figured I can work out all the possible cases so I can understand to answer the questions that follow. Representing the number of silver and gold coins as tuples, I think only the following configurations are possible:

(0,10), (1,9), (2,8), (3,7), (4,6), (5,5), (6,4), (7,3), (8,2), (9,1), (10,0)

They amount to a total of 11 configurations. If I had to derive this number logically without having to count all configurations, I can say I just need to choose the number for either silver or gold coins and there are 11 ways of choosing them(0 through 10, all inclusive). After the first number is chosen, second number is 10 less the first number.

The first question is

What is the initial probability p(nS) that the bag contains nS silver coins?

I note that the question asks about the probability that the bags contains n silver coins. Given that eleven possibilities exist, I would define the probability that the bag contains n silver coins as

$$P(n) = \begin{cases} 1/11, & \text{if 0 \le n \le 10} \\ 0, & \text{otherwise} \end{cases}$$

This is true also for the gold coins.

The second question is

You pull out one coin: it is silver. What is now the probability that the bag contains 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 silver coins?

Given that the pulled out coin is silver, it is possible only in 10 of the 11 combinations. The combination it is not possible in is (0,10) where all coins are gold. I would define the probability of the above question as

$$P(n) = \begin{cases} 1/10, & \text{if 0 \le n \le 9} \\ 0, & \text{otherwise} \end{cases}$$

The last question is

You now pull out another coin: it is gold. What is now the probability that the bag contains 0, 1, 2, 3, 4, 5, 6, 7, 8 silver coins?

So, we pulled out two coins in total and one of them is silver and other is gold. This case is possible only in 9 of the 11 total possible combinations. The combinations where this is not possible are when all the coins are silver(10,0) or all the coins are gold(0,10). Accordingly, I would define the probability of the above question as

$$P(n) = \begin{cases} 1/9, & \text{if 0 \le n \le 8} \\ 0, & \text{otherwise} \end{cases}$$

My first obvious question is if my approach towards these questions is correct?

If no, what is the flaw in my logic?

If yes, how would I derive this using conditional probability techniques or Bayes theorem because it might not be possible to enumerate so easily for larger combinations/numbers?

• Even if we assume a uniform prior, the conditional distribution of the number of blacks remaining, given that the ball we pulled out was black, is not uniform on the set $0$ to $9$. Do a $\Pr(A\mid B)=\Pr(A\cap B)/\Pr(B)$ calculation. – André Nicolas Jun 17 '16 at 17:24
• This depends a lot on how the bag was filled with balls. What you're describing is if whoever filled the bag threw an eleven-sided die (numbered $0$ to $10$), filled the bag with the corresponding number of white balls and then topped it off with black balls. Another common interpretation is that whoever filled the bag had a huge container filled with billions of balls, exactly the same amount of black and white. Then he filled the bag by blindly reaching down and picking up ten balls. In this case the probability of five-five is a lot higher than the probability of all white. – Arthur Jun 17 '16 at 17:25
• In other words, the first question is meaningless. If the problem statement provides no prior distribution for the number of black balls, your assumption that all numbers are equally likely is as good or bad as any other assumption. – joriki Jun 17 '16 at 17:25
• The event $A_k$ is there are $k$ black left after a black is taken out. So $A_k$ says there were initially $k+1$ black. Under our assumption of a uniform prior, all initial numbers of blacks from $0$ to $10$ are equally likely. – André Nicolas Jun 18 '16 at 21:34
• Informally, if we pull out a black that is some indication that the initial distribution was tilted towards black, so the probability of black then white is less than $(1/2)(1/2)$. Formally, I computed the crude way, taking all possible cases and adding up. Got $(1/11)(165/90)$, which simplifies. There may be a cleverer way. You should consider writing up an answer, since now you pretty much know what's going on. – André Nicolas Jun 18 '16 at 23:23

The answer to the first question is correct.

What is the initial probability p(nS) that the bag contains nS silver coins?

$$P(nS) = 1/11$$

Now, the second question

You pull out one coin: it is silver. What is now the probability that the bag contains 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 silver coins?

The analysis in the question is wrong because the question is about conditional probability. We want to find out the probability of the event that the bag contains n silver coins($0 \le n \le 9$), given that the first coin pulled out was a silver coin. We will use Bayes' theorem to solve this.

See this and this for Bayes theorem and this for an illustrative example. The idea of drawing all the probabilities as a tree demonstrated in this idea is quite helpful in understanding the problem. Now, solution to the problem.

Lets us call the event we pulled out one silver coin as $O$.

Let us call the event there are n silver coins remaining in the bag as $nS$, where $0 \le n \le 9$

We want to find out $P(nS | O)$

Using Bayes formula

$$P(nS|O) = \frac{P(O|nS). P(nS)}{P(O)}$$

From the above question, we know that

$$P(nS) = 1/11$$

$P(O|nS)$ is defined as the probability where a silver coin is picked given there are n silver coins remaining in the bag after the ball is picked. Since there are n silver coins remaining after the first silver coin was picked, the probability $P(O|nS)$ can be defined as $\frac{n+1}{10}$

$$P(O|nS) = \frac{n+1}{10}$$

$P(O)$ is the probability that a silver coin is picked from the bag on the first turn. Since there are either silver or gold coins in the bag, there is equal probability for both. Thus,

$$P(O) = 1/2$$

This can also be derived by drawing the tree as illustrated in the video

$$P(O) = (\frac{1}{11}*\frac{0}{10}) + (\frac{1}{11}*\frac{1}{10}) + .... + (\frac{1}{11}*\frac{9}{10}) + (\frac{1}{11}*\frac{10}{10})$$

$$P(O) = \frac{1}{11}(\frac{0}{10} + \frac{1}{10} + .... + \frac{9}{10} + \frac{10}{10})$$

$$P(O) = \frac{1}{11}(\frac{0+1+2+ ... + 9 + 10}{10}) = \frac{55}{11*10} = \frac{1}{2}$$

Substituting these values in

$$P(nS|O) = \frac{P(O|nS). P(nS)}{P(O)}$$

$$P(nS|O) = \frac{n+1}{55}$$

You now pull out another coin: it is gold. What is now the probability that the bag contains 0, 1, 2, 3, 4, 5, 6, 7, 8 silver coins?

Let us call the event where two coins were pulled, and the first one is silver and other is gold as $T$.

Let us call the event there are n silver coins remaining in the bag as $nS$, where $0 \le n \le 8$

We want to find out $P(nS | T)$

Using Bayes formula

$$P(nS|T) = \frac{P(T|nS). P(nS)}{P(T)}$$

We know that

$$P(nS) = 1/11$$

$P(T|nS)$ is defined as the probability where a silver coin is drawn first and gold coin is drawn next given there are n silver coins remaining in the bag after the two coins are picked. On the first turn, the probability for a silver coin to be picked is $\frac{n+1}{10}$. In the second turn, 9 coins would be left in the bag and n of them are silver coins, so, there would be $9-n$ gold coins. The probability of picking a gold coin in the second turn would be $\frac{9-n}{9}$. Combined, the probability would be

$$P(T|nS) = \frac{n+1}{10}*\frac{9-n}{9}$$

$P(T)$ is the probability that a black ball is picked from the bag first followed by a white ball. This can be derived from the probability tree

$$P(T) = (\frac{1}{11}*\frac{0}{10}) + (\frac{1}{11}*\frac{1}{10}*\frac{9}{9}) + (\frac{1}{11}*\frac{2}{10}*\frac{8}{9}) .... + (\frac{1}{11}*\frac{9}{10}*\frac{1}{9}) + (\frac{1}{11}*\frac{10}{10}*\frac{0}{9})$$

$$P(T) = \frac{1}{11}(\sum_{n=0}^{10} \frac{n(10-n)}{10*9})$$

$$P(T) = \frac{1}{11}(\frac{165}{90}) = \frac{1}{6}$$

Substituting these values in

$$P(nS|T) = \frac{P(T|nS). P(nS)}{P(T)}$$

$$P(nS|T) = \frac{8n+9-n^2}{165}$$