$n$ boxes with $i-1$ red balls and $n-i$ yellow balls We have $n$ numbered boxes from $1$ to $n$. Box $i$ contains $i-1$ red balls and $n-i$ yellow balls. We randomly chose a box and we draw two balls without substitution.

*

*Find the probability that the second ball is yellow.

Let $X_i$ be the event that we pick the box $i$. Thus
$\rightarrow \mathbb{P}(g_2)=\sum_{i=1}^{n}\mathbb{P}(g_2,X_i)=\sum_{i=1}^{n}\mathbb{P}(X_i)\mathbb{P}(g_2|X_i)=\frac{1}{n}\cdot \frac{n-i}{n-1}$


*Find the probability that the second ball is yellow if the first is yellow.

$\rightarrow \mathbb{P}[(g_2|g_1)|X_i]=\frac{\mathbb{P}(g_1|X_i)\mathbb{P}[(g_1|g_2)|X_i]}{\mathbb{P}[g_2|X_i]}=\frac{\frac{n-i}{n-1}\cdot \frac{n-i-1}{n-2}}{\frac{n-i}{n-1}}=\frac{n-i-1}{n-2}$
$\Rightarrow \mathbb{P}(g_2|g_1)=\sum_{i=1}^{n}\mathbb{P}(X_i)\mathbb{P}[(g_2|g_1)|X_i]=\frac{n-i-1}{n(n-2)}$


*Find the probability to draw the box 1, knowing that the two balls are both yellow.

$\rightarrow \mathbb{P}(X_i|g_1,g_2)=\frac{\mathbb{P}(X_i)\mathbb{P}(g_1|g_2)\mathbb{P}(g_2|X_i)}{\mathbb{P}(g_1,g_2)}$ where
$\mathbb{P}(g_1,g_2)=\sum_{i=1}^{n}\mathbb{P}(g_1,g_2,X_i)=\sum_{i=1}^{n}\mathbb{P}(X_i)\mathbb{P}(g_1,g_2|X_i)=\sum_{i=1}^{n}\mathbb{P}(X_i)\mathbb{P}(g_1|g_2)\mathbb{P}(g_2|X_i)=\frac{1}{n}\sum_{i=1}^{n}\frac{n-i}{n-1}\cdot \frac{n-i-1}{n-2}$
$\Rightarrow \frac{\frac{1}{n}\cdot \frac{n-i}{n-1}\cdot \frac{n-i-1}{n-2}}{\frac{1}{n}\sum_{i=1}^{n}\frac{n-i}{n-1}\cdot \frac{n-i-1}{n-2}}$

Is it correct?
Thanks in advance.
 A: Let me take the first problem where we have to find the probability that the 2nd ball is yellow without substitution. Given the distribution of red and yellow balls, the probability of pulling either color should be $\frac{1}{2}$ over n boxes (n > 2).
As the probability of pulling a specific color ball varies from box to box, here is how it will look -
Probability of picking box i $(P_{Bi}) = \frac {1}{n}$
Probability of pulling the first ball as red in box i $= \frac {i-1}{n-1}$
Probability of pulling the first ball as yellow in box i $= \frac {n-i}{n-1}$
Even the probability of the 2nd ball being yellow should be the same as the first ball being yellow. Please see below.
Probability of pulling the second ball as yellow ($P_{Yi}$) $= \frac {i-1}{n-1} .\frac {n-i}{n-2} + \frac {n-i}{n-1} .\frac {n-i-1}{n-2} = \frac {n-i}{n-1}$  ....(A)
$P_Y = \sum_{i=1}^n PBi.PYi = \frac{1}{n}.\sum_{i=1}^n PYi = \frac{1}{n}.\sum_{i=1}^n \frac{n-i}{n-1}$
$P_Y = \frac{1}{n}.\frac{n^2-\frac{n(n+1)}{2}}{n-1} = \frac{1}{2}.$
The reason I wrote equation (A) as the 2nd and 3rd problems are variations of the first and you should get it from (A).
