This morning, when I went to get gas for the car, I saw something I don’t think I’ve ever seen before. I saw someone changing the sign that shows the gas prices.

Now, I know that they do this, but I’ve never been there while they do it. I’m guessing this is probably because they do it very early in the morning or late at night, when I’m less likely to be at the gas station. For the record, I was there around 9:20am, and the guy making the change was using a very long pole (about 15 feet) with a suction cup at the end to pull the numbers up. Despite his best efforts, he ended up dropping all of the numbers on the ground. I was going to say that an electronic sign might be more cost-effective, but then I realized that most gas station attendants don’t have much to do a lot of the time, since payments are mostly handled automatically. So I guess you might as well put them to work. On the other hand, maybe Chevron hires one person to change all the signs in an area. A sign-changing expert? Who knows.

In any case, I got to thinking (because this is what I do): what if they didn’t do it early in the morning or late at night? What if they did it randomly at some time during the day. Is it that unlikely that I would never see them change it?

Warning: Math ahead!

So let’s do some rough calculations.

Suppose I drive about 15,000 miles a year. If I get 300 miles per tank, that’s about 50 fillups per year. But I don’t usually wait until the car is running on fumes, so probably 60 fillups per year is more accurate. I’ve been doing this for about 13 years, for a total of about 780 fillups. Let’s suppose each fillup takes about 6 minutes. Let’s make some wild guesses and say they change the price of gas about 100 times a year, and it takes an average of 10 minutes for the sign change (lower signs are quicker, higher signs take longer). Given all those variables (which may or may not be anywhere near accurate), how would we go about calculating the expected number of times I should have seen them change the price during my 13 years of filling up?

Let’s first look at the simpler question of the probability of seeing them change the price during a single fillup. They change the signs for a total of about 100×10 = 1000 minutes per year. There are 60*24*365 = 525600 minutes per year. So if I did a single 1-minute fillup, the chances of me seeing them change the sign would be 1 in 525.6. At first glance, you might think my chances with a 6-minute fillup would be 6 in 525.6. But that would be wrong. The simplest way to see it’s wrong is to note that using the same approach would say that a 525.6 minute fillup would lead to a 100% chance of seeing them change the price. Which is obviously wrong.

Arg. It’s hard for me to do this while I’m scanning pictures in, and I don’t see a way to save a work in progress, so I guess I’ll just publish this and finish it later…

Ok, I’m back.

Let’s analyze a single fillup. Let’s assume that they never change the price twice in one day. It’s probably true, and even if it’s not it won’t affect our analysis much. So the chances that they change the price the same day we fill up is 100/365 = 1/3.65. Let’s now assume that our fillup starts at the start of a minute, and they change signs at the start of a minute. We’ll do a more accurate analysis later, but let’s start with that. There are 60*24 = 1440 minutes in a day. If we further assume that a price change and a fillup do not span multiple days, then there are 1431 different time slots for the price change, 15 of which overlap our 6 minute fillup. So the chances of us seeing the price change is 15/1431 = 1/95.4.

What if we did the same analysis but allowed the time slots on second boundaries instead of minute boundaries? Well, let’s generalize even further and do the analysis on boundaries on time T, where T is in minutes. So T = 1/60 would be the same analysis in seconds. There are (1440/T) units of time T in a day. So there are (1430/T) + 1 different time slots for the price change, (16/T – 1) of which overlap our 6 minute fillup. So the chances of us seeing the price change is (16/T – 1) / (1430/T) + 1 = (16 – T) / (1430 + T) which, as T approaches 0, is clearly 16 / 1430 = 1/89.375.

Since we fill up 60 times a year, the chance of us not seeing the price change on all of those fill-ups is (1 – 1/89.375) ^ 60 = 0.509.

The chance of us not seeing the price change over 13 years is (1 – 1/89.375) ^ (13 * 60) = 0.0001543228 = 0.15% Which means there’s only a 1 in 6480 chance of us not having seen a price change. Which strongly suggests that they change the prices while I’m asleep or at work, and not in the mid-morning when I often fill up.

What’s the expected number of times I would have expected to see a price change? That’s simply (13 * 60) * (1/89.375) = 8.73.

So I should have seen about 9 price changes in those 13 years.

Of course, if any of my time estimates are wrong, then I’ll have to adjust my analysis. Maybe I’ll time myself at the gas station for the next month or so.

One other note: if my fill-up times are not random, but the gas station’s price changes are completely random, then it’s equivalent to us both being random. At least as far as the probability of me seeing the price change goes. This is also the same as my fill-up times being completely random, and the gas station not being random.

In any case, I will probably clean up this analysis and put it up on my Math web site in the near future…