Thursday, January 25, 2007

Probability and Statistics

When I went to Waterloo I was forced to take a few statistics courses. Initially I enjoyed them and was actually enrolled as a CS/Stats double major for two years. Then I started taking more advanced statistics courses and decided that stats wasn't for me and concentrated on computer science and pure math.

Here's a type of probability question I enjoy...and there's 3 blog points up for grabs:

A bag contains 6 red balls and 8 green balls. 5 balls are withdrawn and placed in a red box, the rest are dumped in a green box. What is the probability that the number of green balls in the red box plus the number of red balls in the green box is not a prime number? (For this example assume 1 is defined as prime).

4 comments:

Tammy said...

Hey shouldn't you be at work?

Anyways, I'm not doing anything so I'll try it. Prefacing that with I don't remember much about stats. And I'm thinking as I go here so it's unlikely to make much sense.

Ok so the # of green balls in the red box is just the # of green balls drawn from the bag (we can pretend the bag is the same thing as the green box). So you can either pull 5,4,3,2,1,0 green balls. And, correspondingly, there will be 6,5,4,3,2,1 red balls left in the bag.

Added together:
5+6 = 11 *
4+5 = 9
3+4 = 7 *
2+3 = 5 *
1+2 = 3 *
0+1 = 1 *

Prime number products (err, sums? whatever that mathy word is) TOTALS are marked.

There is only 1 non prime possibility. So we could just do that one and save ourselves a lot of work but I want to make sure my probabilities total 100 or I'll be sad. So:

5G0R: 8/14*7/13*6/12*5/11*4/10 = 2.8%. Hmph, I think I'll have to write this as some kind of C or P thingy or else this is the only one I can do that way. So I don't remember much about these Cs, but I'll speculate that this is 8C5. EIGHT CHOOSE FIVE. Yes that seems about right. It strikes me that Ps were less than Cs (order matters vs. doesn't matter), and in this case order doesn't matter (indicating a larger number) so I'll stick with my Cs and I like them better anyways.

4G1R: 8C4*6C1. I think you multiply them together, but maybe you add them? I forget. Anyways I DO remember that 8C4 = 8! / 4!4!. I found the factorial formula in excel and crunched my numbers and such and got 20.98%. Oh yeah I'm using the total of 14C5 here obvs.

Now for the rest just as a check.

3G2R: 8C3*6C2 = 41.96%

2G3R: 8C2*6C3 = 27.97%

1G4R: 8C1*6C4 = 5.99%

5R: 8C0*6C5 = 0.30%

Common sense test: yeah, the combinations with the highest probabilities do seem the like the likliest outcomes.

Actual test: sum of prob = 100% (good!)

So anyways, back to the actual question which I think I figured out halfway through. The only non prime was 9, which corresponds to a pick of 4G1R. This has the probability of 20.98%.

I probably did something wrong with my Cs and Ps but can I have a bonus point for most rambling solution ever? :)

Back to 90210.

Jimmy said...

You can definitely have the 3 points for the correct solution - good job.

I almost docked you one point for calling the sum of two numbers a product...but I'll let it slip this time ;)

Tammy said...

Haha a joke, I promise.

Kimota94 aka Matt aka AgileMan said...

Very impressive results, Tammy!

I'm not sure I could've solved this one...