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)}$
Thanks in advance. 
 A: We want to compute: 
$$\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}$$
A: 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 
\begin{equation}
\frac{\text{Pr}(X = 2 \cap B = w)}{\text{Pr}(B=w)}
\end{equation}
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 
\begin{equation}
\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}
\end{equation}
This is the probability that number of white balls is 2 given that we have chosen a white ball. 
