The Perfect Bracket Coding Challenge

Every year in the middle of March, millions of people become obsessed with college basketball. The NCAA basketball tournaments give any basketball enthusiast or casual fan a lot to enjoy. They offer a chance for people to root for their favorite teams, support underdogs from schools they didn’t know existed, and see a huge amount of basketball in a relatively short period of time.

The tournaments also bring a surprising amount of attention to an interesting mathematical object: the bracket. Every year, millions of people fill out tens of millions of brackets in an attempt to show off their predictive skills (or simply to express their love for certain teams’ mascots or uniforms). Every bracket that’s filled out brings with it a slight hope of achieving the holy grail of March Madness: the perfect bracket, with correct predictions for every game, from the first round to the championship.

It is, however, hard to overstate just how slight that hope really is. Various attempts have been made to quantify the probability of a bracket being perfect, and all make the prospects look quite bleak. The first, most naive value that’s often quoted is the probability of picking a perfect bracket by guessing the outcome of every game uniformly at random: there are 63 games in most bracket challenges, so the odds of such a bracket being perfect are 1 in 2^63, or 1 in 9.2 quintillion.

Of course, there are far better ways to fill out brackets than flipping coins. DePaul math professor Jeff Bergen adjusted teams’ win probabilities based on the historical success of their respective seeds (1 seeds almost always beat 16 seeds, but 8 vs 9 matchups are more like a coin flip) and found that a more reasonable probability was 1 in 128 billion. This is of course much more manageable, but 128 billion is still orders of magnitude more than the number of brackets that have ever been filled out.

I think that probability is still a bit low (I’ll probably make a post about that in more detail). If we take FiveThirtyEight’s pre-tournament forecasts from this year, the probability of the favorite winning every game is about 1 in 26 billion. Thus, there is at least one way to fill out a bracket (namely, the one where we always pick the better team according to FiveThirtyEight’s model) that gives us odds of 1 in 26 billion. FiveThirtyEight put the odds as high as 1 in 1.6 billion back in 2015, which they said was a particularly top-heavy year, making upsets less likely than usual. I haven’t yet crunched the numbers on every year in which data are available, but it seems that we can’t hope for much better than about a 1 in a billion chance of picking a perfect bracket.

The Challenge

Now that we’ve established just how impossible it is to make a perfect bracket, I’ll outline my goal: I want to write a perfect bracket for the 2024 NCAA Division I men’s basketball tournament. After spending this much time going through how long the odds are, how am I still conceited enough to think that I can accomplish what hundreds of millions of brackets have not? Well, I’m going to need a lot more than hundreds of millions of brackets.

My goal, stated more precisely, is the following: next year, between the time that brackets are released and the time that the first games start, I want to make a perfect bracket. This will (hopefully) be accomplished by writing a computer program that prints out as many plausible brackets as it can. I will not get the bragging rights associated with actually predicting the games myself, and I won’t be able to submit all of my brackets to any official bracket challenge, but if all goes well, I will achieve the distinction of having technically produced the first ever perfect bracket.

As far as I can tell, a challenge like this has been attempted once before. In 2019, Chris Wilson from Time Magazine randomly generated 10 million brackets using a formula to give preference to better seeds. As we might expect, some of them did very well, but 10 million was not enough. Those 10 million brackets included some very good entries, but every bracket was busted by the end of the first round, and the best bracket did well enough to finish 8th in ESPN’s bracket challenge.

While 10 million brackets may have fallen short, it may still seem like computer assistance should turn this into a trivial problem. After all, if I can just print brackets at will, what is stopping me from just printing all of them? It turns out, however, that computer technology is just advanced enough to make this an interesting problem. Printing 1.6 billion brackets on a personal computer in 4 days is very doable. Printing 9.2 quintillion is not.

Furthermore, making a perfect bracket isn’t as simple as writing out 1.6 billion brackets, even if next year’s tournament turns out to be more like 2015 than 2022. While the most likely bracket might have odds of 1 in 1.6 billions, the billionth most likely bracket will have odds that are much lower, and filling out more brackets will quickly produce diminishing returns. Without filling out all 9.2 quintillion possible brackets, it is impossible to guarantee that one will be perfect, but there is a lot that we can do to improve our odds.

Thus, this is a challenge of trying to maximize the quantity of brackets produced without sacrificing quality of predictions made in each individual bracket. I’ll put out the full rules of the challenge in another post, and I’ll continue to post updates on my progress. Let the madness begin!

Leave a comment