Category Archives: Probability

Celebrating Pi Day with frozen hot dogs

If you’re in a hurry and just want to hear about the frozen hot dogs, feel free to skip to the “But what about the hot dogs?” section… or kick back for a little background on how we got there.

Today is one of the geekier days of the year: Pi Day. And this year it’s extra geeky because not only do the month and day match up with 3.14, but 2015 also gives us 3-14-15 9:26:53.

I’m sure we all have our own personal pi stories, but for me, these two from the Freaks and Geeks days of my teen years come to mind…

A couple bored kids in study hall

It was junior year in high school and my friend Jeff Applebee and I entered into a cerebral duel of sorts to see who could memorize the most digits of pi.

We used two different approaches:

I got some pointers from The Memory Book written by former pro basketball player Jerry Lucas and some other guy whose name escapes me at the moment. Their technique involves associating a consonant sound with each digits 0-9 and then crafting a story in your mind by chaining objects with the consonants corresponding to the digits in the sequence. The more fanciful the story, the easier to remember and convert to the digits of pi.

A book from the 1970s that I still have

A book from the 1970s that I still have

Jeff didn’t need no stinkin’ book (show off), he just sucked it up and memorized the sequence.

Given the fog of time, the exact count escapes me, but I seem to remember we each wound up memorizing around 150 digits. But in the end, it was Jeff’s brute force approach that claimed honors.

Pi out to 150 decimal places:


Let’s code!

Around the same time I got this idea that you could calculate the value of pi by writing a program to generate millions of random points in a square, and by using the Pythagorean theorem, easily calculate if each point was either inside or outside a section of a circle contained within the square.

A diagram with a lot of 2's and lowercase letters on it

A diagram with a lot of 2’s and lowercase letters on it

By using the ratio of points that fell inside the circle and given the formulas for the area of a circle and the square, you could solve for pi. The more points generated, the closer your estimate would be.

With the hubris of youth I fancied myself quite the Einstein for coming up with the idea only to find out later it’s a well-known way to estimate pi called the Monte Carlo Method. There are a slew of articles on the web about how it’s done. Here’s a quick C# method that estimates pi using 10,000,000 random points:

Some C# code that estimates pi

Some C# code that estimates pi

But what about the frozen hot dogs?

I thought you’d never ask.

After doing some Googling to prep for this article and reacquaint myself with the Monte Carlo Method, I saw a few links for “throwing frozen hot dogs.” Click bait? Nope. It actually works.

It’s quite simple and involves basic math, some tape, and a few frozen franks.

First, get some masking or painters tape and mark off a bunch of lines on the floor making sure that the space between the lines is exactly the length of a hot dog. Actually, first you should tell your wife what you’re doing and that you’ll clean things up when you’re done.


Throw a bunch of hot dogs


Keep a count of the total number of dogs thrown and the number that cross any of the pieces of tape.

Pick up the hot dogs and throw them again.

When you’ve had enough (or the cats lose interest), you’ll have two numbers: the total number thrown and the number of hot dogs that landed on a line. Divide 2 by the number of dogs that landed on a line and multiple that result by the number thrown. Of the 300 dogs I threw as a test, 193 crossed a line… (2 / 193) * 300 = 3.108807. Not bad.

If you’re going to try this yourself, frozen hot dogs are COLD and they slide around a little too much on the floor, and dogs at room temperature start to break apart after a few throws.  So “gently thawed” works best.

Happy Pi Day!


Chasing the Ace… and the odds

For years at work, our activities committee (fondly referred to as “The Fun Club”) has held a 50/50 raffle each Friday. A few months back they decided to mix things up a bit by replacing that with something called “Chase the Ace.”

The rules are pretty simple:

  • Tickets are a dollar a piece.
  • A single ticket is drawn each Friday.
  • The ticket holder draws a card from a deck.
  • If it’s an ace, you win half the pot. If not, all the money rolls over to the next week.
  • Rinse and repeat until an ace is drawn.

This all sounded fine and good until weeks and weeks passed with nobody drawing an ace. In fact, we got up to 15, 16, 17 weeks… and still no ace! Seriously? Wouldn’t the odds of that happening be infinitesimal? Were we somehow being hoodwinked by some nefarious faction in the Fun Club?

With some rusty high school probability theory rattling around in our brains and Excel just a click away, a couple of us computer nerds went to work to find out just how unlikely this really was. We set up a simple spreadsheet with formulas to calculate the odds of pulling an ace up to and including 49 pulls (the worst possible outcome).


First let’s look at the odds of pulling an ace for each individual week.


With a full deck, the first week odds of not pulling an ace are 48/52 or 12/13 or 92.3%. So, of course, the first week your odds are pretty slim. That makes sense. The second week, the odds aren’t much better: 47/51 or 92.1%. It turns out it takes quite a few weeks before the odds of any given week reach some reasonable chance. In fact, to get to a 50/50 chance, you’d have to wait until there are only 8 cards left in the deck!

But those are the week-to-week odds. We all know that if you flip a coin 99 times and get heads each time, the odds of getting heads on flip 100 is still 50/50. But it would be crazy unlikely to get that far in without flipping a single tails. Similarly, wouldn’t compounding a long series of ace “no pulls” escalate in our favor pretty quickly?

Here’s the graph for the compounded probability week-to-week. The blue line is the one we’re interested in. At week 17, the odds are about 1/5 (20%) that no ace would have been drawn to that point. Yes, it’s less likely that this would happen, but it’s still within the realm of believability and certainly not infinitesimal.


The blue line shows the odds if the card pulled each week is not replaced in the deck. For comparison, the green line shows the odds if the card was being drawn from a full deck each week.

So with that, the nerds went back to work, the Fun Club was cleared of any suspicion of hoodwinking, and the pot of cash kept growing.