### Pop Quiz - Answer!

After I thought about it a bit more, the probability calculations would be tedious, but can be expressed in a spreadsheet without two much problem.

The answer, after the break ...

Ultimately, the answer, the expected number of caps needed to get a hat, is 19.28 (rounded to the nearest hundredth). With the 19th cap you have a bit less than a 50% chance of a set of three matching cap, with the 20th somewhat more than 50%.

There are 1188 different states (number of caps and number of pairs within that set) to deal with, the probability of each expressed as a spreadsheet cell. Fortunately, each state only needs to deal with 1 or 2 other states as input to the probability calculation. The dependencies are all at the same relative position to the cell being calculated. The exception is the transition to the final state (collected three matching caps), but the calculation of that can be expressed as a sum of a set of products, so the products go into a temporary set of cells to be summed. Altogether, there are 6 or 7 different cell formulae, that then get copied into all the other cells (depending on their position in the sheet). Once I got those formulae correct, the tedious work is just pasting the formulae into the right position, which isn't hard. I added a few more cells as a check, to make sure that the probabilities that should sum to 1 all did indeed sum to 1.

OK, so that was one interesting intellectual activity, and I have my answer now: 19.28. Tomorrow, a couple last observations about this cap game.

And, yes, I am trying to blog daily for a bit. We'll see how long that lasts.

The answer, after the break ...

Ultimately, the answer, the expected number of caps needed to get a hat, is 19.28 (rounded to the nearest hundredth). With the 19th cap you have a bit less than a 50% chance of a set of three matching cap, with the 20th somewhat more than 50%.

There are 1188 different states (number of caps and number of pairs within that set) to deal with, the probability of each expressed as a spreadsheet cell. Fortunately, each state only needs to deal with 1 or 2 other states as input to the probability calculation. The dependencies are all at the same relative position to the cell being calculated. The exception is the transition to the final state (collected three matching caps), but the calculation of that can be expressed as a sum of a set of products, so the products go into a temporary set of cells to be summed. Altogether, there are 6 or 7 different cell formulae, that then get copied into all the other cells (depending on their position in the sheet). Once I got those formulae correct, the tedious work is just pasting the formulae into the right position, which isn't hard. I added a few more cells as a check, to make sure that the probabilities that should sum to 1 all did indeed sum to 1.

OK, so that was one interesting intellectual activity, and I have my answer now: 19.28. Tomorrow, a couple last observations about this cap game.

And, yes, I am trying to blog daily for a bit. We'll see how long that lasts.

## 2 Comments:

I'm not going to pretend I understood all that, but it was interesting.

I'm also trying to blog at least every other day for now. We'll see how long I can keep it up.

By Kamie, at 11/03/2006 3:53 PM

Good, let's see if we can both stay to something like a regular schedule.

I'll have another post up later this evening.

By Tim Tjarks, at 11/03/2006 6:51 PM

Post a Comment

<< Home