# Bayes' Theorem and Total Probability Theorem problem.

A bag contains n balls out of which some balls are white. The probability that the bag contains i white balls is proportional to $i^2$. A ball is drawn at random from the bag and found to be white. Then find the probability that the bag contains exactly 2 white balls.

I found the probability of drawing the ball that's proportional to i but not any more.

My attempt:

Let the event of drawing the ball be $A_i$.

Its given that $P(A_i)$ is proportional to $i^2$, then $P(A_i)= k~i^2$.

Taking total probability, $1=k\sum_{i=0}^n i^2$

$k= 1/(\sum_{i=0}^n(i^2))$

Therefore, $P(A_i)= \dfrac{(6~i^2)}{n(n+1)(2 n+1)}$

• What do you mean by "the constant $i$"? the condition is that $P(X=i)=\lambda i^2$ for each $i$ (where $X$ denotes the number of white balls). Did you compute $\lambda$? If so...edit your post to include that result.
– lulu
Commented May 4, 2017 at 14:24
• No, what is given that the probability that the bag contains $i$ white ball is proportional to $i^2$. Your calculations are correct, but your interpretation is askew. Your $A_i$ is the event that the bag contains $i$ white balls. Commented May 5, 2017 at 2:32
• The probability that the bag contains $i$ white balls and one of these is drawn is thus $\mathsf P(D\cap A_i)={\big(6~i^3\big)}/{\big(n^2~(n+1)~(2n+1)\big)}$, which leads to the answers given below. (Basically, the calculation of the constant of proportionality was an unnecessary diversion). Commented May 5, 2017 at 2:35

We are looking for the probability that the number of white balls is 2 given that we have already selected a white ball. So, we are looking for $$\frac{\text{Pr}(X = 2 \cap B = w)}{\text{Pr}(B=w)}$$ Where $X$ is the number of white balls and $B$ is the ball drawn. It is given to us that $\text{Pr}(X = i) = \lambda \cdot i^2$. We can see that \begin{equation*} \text{Pr}(X = 2 \cap B = w) = (\lambda \cdot 2^2) \cdot \frac{2}{n} = \frac{8\lambda}{n} \end{equation*}
Now, to find $\text{Pr}(B=w)$, we need the sum \begin{equation*} \sum_{i=1}^n (\lambda\cdot i^2) \cdot \frac{i}{n} \end{equation*} This is the sum of the probabilities that the number of white balls is $i$ and we choose a white ball. Finally, we substitute these into the expression above so that we have $$\frac{\frac{8\lambda}{n}}{\sum_{i=1}^n (\lambda\cdot i^2) \cdot \frac{i}{n}} = \frac{8}{\sum_{i=1}^n i^3} = \frac{8}{\frac{1}{4}(n(n+1))^2} = \frac{32}{(n(n+1))^2}$$ This is the probability that number of white balls is 2 given that we have chosen a white ball.
\begin{align} P(i=2 \,| \,\text{white ball is drawn}) &= \dfrac{P(\text{white ball is drawn}\, | \,i=2) \cdot P(i=2)}{P(\text{white ball is drawn})} \\ &=\dfrac{\dfrac{2}{n} \cdot (\lambda\cdot 2^2)}{\sum_{i=0}^{n}\lambda \cdot i^2 \cdot \dfrac{i}{n}} \\ &=\dfrac{\dfrac{8}{n}}{\sum_{i=0}^{n}\dfrac{i^3}{n}} \\ &=\dfrac{8}{\sum_{i=0}^{n}i^3} \\ &=\dfrac{8}{(n(n+1)/2)^2} \\ &=\dfrac{32}{(n(n+1))^2} \\ \end{align}
• $\frac{i}{n} = \lambda \cdot i^2$ is not true. The probability of drawing a white ball is not necessarily equal to the probability that there are $i$ white balls. Commented May 4, 2017 at 15:00