I’m pleased with myself today. I adapted.
John Derbyshire posed the problem:
…from Dr. Peter Winkler at the National Museum of Mathematics.
A box contains nine billiard balls numbered 1 through 9. You repeat the following ten times: reach blindly into the box, pick out a random ball, note its number, and throw the ball back in the box.
What is the probability that the sum of the numbers of the balls you picked is even?
Now, I’ve actually solved one or two of The Derb’s math puzzles, and one memorable time I actually beat him to the solution. But the vast majority of the time I can’t even begin to figure out how to set up the problem, and I lose interest quickly. I have a decent high-school level of math, nothing more.
But every once in a while one of these brain-teasers takes my acute interest. This one with the billiard balls somehow snagged me. I give up where I think calculus notation is coming in. But this one looked to be algebraically solvable. Complex algebra, but algebra.
I didn’t know exactly how to calculate cumulative odds in iterated trials. So I whispered those crazy words into a search engine and got this:
Two out of three of the formulas they show involve calculus notation, but there’s one, the one with the factorials, that’s algebraic. I tried to sand some of the rust off my Python, and here’s what I came up with:
The probability of 1 odd balls in 10 trials is 0.00375910824777
The probability of 2 odd balls in 10 trials is 0.0211449838937
The probability of 3 odd balls in 10 trials is 0.0704832796457
The probability of 4 odd balls in 10 trials is 0.154182174225
The probability of 5 odd balls in 10 trials is 0.231273261338
The probability of 6 odd balls in 10 trials is 0.240909647227
The probability of 7 odd balls in 10 trials is 0.172078319448
The probability of 8 odd balls in 10 trials is 0.080661712241
The probability of 9 odd balls in 10 trials is 0.0224060311781
Total of all probabilities: 0.996898517443
Total of all probabilities with an odd number of odd balls: 0.499999999857
What is the probability that the sum of the numbers of the balls you picked is even? 50 percent. Counterintuitive since the odd balls outnumber the even, but then an odd cancels out an odd and not the other way around.
There is some hilarious, and probably simple, proof of how this specific case works.