tag:blogger.com,1999:blog-6314876008291942531.post2725018424569470064..comments2024-01-14T00:36:43.430-08:00Comments on Antonio Gulli's coding playground: A bag of white and black ballsUnknownnoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6314876008291942531.post-84257685819054727212009-05-12T07:59:00.000-07:002009-05-12T07:59:00.000-07:00I like this probability test. There are i white ba...I like this probability test. There are i white balls and n-i black balls with 0 le i lq n. The possible combinations are n, so that the number of white balls is n(n+1)/2 and each combination has 2/n(n+1) probability. Now suppose that we fix the number of white balls to k. The probability to extract the first white is 2k/n(n+1). The probability of extracting the second white is (k-1)/(n-1), since there are n-1 balls left. The two events are independent, so that the conditional probability is the product of 2k(k-1)/n(n-1)(n+1). The overall probability of all the combination is \sum_k=0..n 2k(k-1)/n(n-1)(n+1)codingplaygroundhttps://www.blogger.com/profile/08478993186814330588noreply@blogger.com