25 May 2019

Riddler Submission: ¡Lotería!

Learn Spanish and gamble all at the same time!!!

Lotería is a traditional Mexican game of chance akin to bingo. Each player receives a 4-by-4 grid of images. Instead of the comically large rotating bin of numbered balls, the caller randomly draws a card from a deck containing all 54 possible images. If a player has that image on their grid, they mark off the corresponding location with a corn kernel or pinto bean. Exact rules can vary, but in the version I was taught, the game ends when one of the players fills their entire card (and screams “¡Lotería!”). Each of the 54 possible images can only show up once on each card, but other than that restriction, let’s assume image selection and placement on each player grid is random.

One beautiful day, you and your friend Christina decide to play a friendly game of Loteria. What is the probability that either of you end the game with an empty grid, i.e. none of your images were called? How does this probability change if there were more/fewer unique images? Larger/smaller player grids?


The inspiration for this problem actually comes from reality: while on vacation, a friend of mine ended a game with zero matching images and I seemed to be the only one flabbergasted by the odds. To illustrate that I wasn’t crazy (or perhaps confirm that I was), I set out to calculate the exact odds of such a thing happening. First, the two grids cannot have any overlap. If any of the images on the first card are also on the second, the first card cannot possibly cover all its images without covering one on the second. With images on each grid and possible images, there are possible grids that either player could have. Regardless of which images are on the first player’s grid, the second grid now only has images to choose from, hence leaving non-overlap grids. Thus, the probability of the two grids having no overlap is

Second, we need the order of the deck to be such that all of one player’s images will come up before any of the other player’s images. After cards are revealed from the deck, there are possible card combinations that could be revealed and possible orderings of those cards, giving us a total of

How many of the possible outcomes result in the first player getting their sixteenth and final match on the card and the second player getting no matches at all? Out of the cards revealed, of them have to match, but the remaining cards can’t match any image on either grid. This suggests possible combinations of non-matching cards to come up. Furthermore, the first cards can be in any order they want, giving us possible orderings, but the card has to be one of the G = 16 matching cards, resulting in G possible endings. This produces

With all possible outcomes being equally probable, we can calculate the probability of one player winning and the other remaining at zero after revealing cards as

Next, let’s put these two probability functions together. Since either player can be the winner or loser, the probability of a game ending with either player having an empty grid after turns is

Finally, we can plot this function as shown below and sum up over all possible values of to calculate a total probability of

Think about that for a second. That means that even if we played three billion times, we would still only have about a 1% chance of a zero match game occurring. And yet it happened to us in real life. I would say that we should have bought a lottery ticket, but sadly that’s not how random variables work. As for the second part of the question, we can easily calculate the zero match probability for larger/smaller grid sizes or more/fewer unique images simply by varying and respectively in the same equations above. As your intuition might have guessed, more unique images and smaller grids produce higher zero match probabilities, but play around with the interactive graph below to see exactly how it varies. Hope everyone has as much “divertido” with this as I did!

The python code used to generate the values and figures above are available on my GitHub page. Simulations that validate the equations above are also available.