Featured image: sunday morning

I am a bike enthusiast, and an advocate of the benefits of selling your car and buying a much more health- and environment-friendly transport such as a bike. And if there is one thing that can potentially ruin my day, this thing is getting a flat tire on my bike. Sadly, it happened today; and when I walking my bike back home, I started to think: “well, I’ll be damned, it’s the second time in the last 4 months that I get a flat tire and in both times it happened very near the middle of my usual route”. I also remember that, in the first semester of 2013, I got a flat exactly at the midway. However, when I was in Netherlands, it happened once when I was very near home (in fact, I only noticed it when I was already in).

All these mishaps led me to think: why is that flat tires seem to occur more frequently at the worst time possible, or more specifically, near the middle of the route (in the words of probability enthusiasts: a Guassian distribution)? Or is that just an illusion of bad luck (maybe we tend to remember the worst happenings)? Well then, one way to satiate our curiosity is using the tools of probability and modelling the situation.

Now, there could be many many things playing a role on getting a flat tire, such as the conditions of the bike and the road, the weather, how much attention we are paying, the speed you are riding and so on. But let’s start from a very simple model and assume that the only thing playing a role is the road condition. And for that, I’ll start with some numbers gathered from my own experience: in the last 4 months, I got 2 flat tires; also, let’s assume I ride 10 km in a loop (starting at home and ending at home) every day. Additionally, and this is a very important point, let’s suppose that this chance is constant throughout the route. Why is this important? Well, if we assume that, our intuition would tell us that, over time, the flat tires would occur completely spread through the route, which means there will be no spike of occurrences near the middle. However, there’s one caveat: once you get a flat tire, you’ll have to walk your bike home, so the chance of getting another one goes to zero in that day. Could that make a difference? So let’s forget our intuition for now and proceed with the modelling.

This type of probability (yes or no, with a certain chance of getting a yes) can be simulated using a binomial distribution. The exact chance (the number) of it happening doesn’t matter too much in principle, as long as I can reproduce roughly the reality (e.g. ~2 flat tires every 4 months), because what we are interested in is the behavior of the occurrences. I wrote a Python-code that model such situation, and I used Numpy’s binomial number generator, along with some for loops and you can check the code by yourself if you want. Anyway, let’s see how things went in the simulation.

In the first 4 months (120 days), I got 2 flat tires, which seems pretty agreeable with reality, but they happened very near the edges of my path, which is good, because it’s near home and therefore I wouldn’t feel miserable to walk the bike back. The third flat tire occurred in the next 4 months (240 days), and unfortunately for poor virtual me, it happened right after the 4th km, ruining his day. After 1800 days (roughly 5 years of biking 10 km every single day), I got 20 (!) flat tires, but it doesn’t seem like they happen more frequently near midway. 20 is an impressive number for one person, but we have to remember that virtual me is very passionate about biking. Well, it looks like there is not much clumping of occurrences in one or other region of my path.

But what if virtual me spent 50 years of his life biking? That’s more than 18000 days! Let’s fire up that model: during all those years, I got 230 flat tires, and the occurrences through the route seem as well spread as ever. No clumping at all. Well, I guess there’s no denying that, if we consider only these road conditions, there could be no concentration of flat tires in one region of my route… Unless! Unless the road was absolutely terrible. And by that I mean completely covered in broken glass, pointy pebbles and bees glued to the ground, which means the chance of getting a flat tire would be very high. Obviously, I wouldn’t be able to cross not even 10 meters without getting a flat. And this is how the distribution of occurrences look like:

As you can see, I managed to clump the happenings in just one region: at the beginning of the route, because the chances of going forward without getting a flat are so dim. In fact, in all the 18250 days (~50 years) trying to ride the bike through glassfield, virtual me got 18249 flat tires, which means there was ONE FREAKING DAY when I managed to cross the glassfield without getting a flat. How freaking cool is that? That must’ve been the happiest day of my virtual life.

But here’s another situation: what if I was in Netherlands and there were 500 people happily biking the same path every day? Would we see something interesting in the distribution of flat occurrences (using the same probability as the original problem)? Nope, upon checking the next picture, it doesn’t seem so. The distribution is as noisy as ever. In just one year, these poor people managed to get 2232 flat tires.

Well, in the end, it doesn’t seem like we can reproduce a spike of ocurrences near the middle of the route (i.e. a Gaussian) by assuming a constant chance of getting a flat: the only way to do that is to tamper with the probability function through the route… Or is it? Is there a way to get a Gaussian distribution (or any other interesting kind of clumping) of flats without tampering with the road (i.e. “cheating”)? For instance, maybe there’s a way to do that by modifying one’s behavior when they get a flat (instead of just walking the bike back home). Maybe we could think of a situation in which the possibility of getting a flat sums up the more you ride unscathed (although that would be cheating, but in a more elegant way). I think that could be a fun exercise.