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?

Solution

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 \(G = 16\) images on each grid and \(D = 54\) possible images, there are \(\frac{D!}{G!(D - G)!} = \frac{54!}{16!38!}\) possible grids that either player could have. Regardless of which images are on the first player’s grid, the second grid now only has \(D - G = 38\) images to choose from, hence leaving \(\frac{(D - G)!}{G!(D - 2G)!} = \frac{38!}{16!22!}\) non-overlap grids. Thus, the probability of the two grids having no overlap is

\[P_{d} = \frac{(D - G)!}{G!(D - 2G)!} \times \frac{G!(D - G)!}{D!} = \frac{(D - G)!(D - G)!}{(D - 2G)!D!} = \frac{38!38!}{22!54!} = 0.00105428\]

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 \(N\) cards are revealed from the deck, there are \(\frac{D!}{N!(D - N)!} = \frac{54!}{N!(54 - N)!}\) possible card combinations that could be revealed and \(N!\) possible orderings of those cards, giving us a total of

\[Q = \frac{D!}{N!(D - N)!} \times N! = \frac{D!}{(D - N)!} = \frac{54!}{(54 - N)!}\text{ possible outcomes.}\]

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

\[W = \frac{(D - 2G)!}{(N - G)!(D - G - N)!} \times (N - 1)! \times G = \frac{22!(N - 1)!16}{(N - 16)!(38 - N)!}\text{ possible winning outcomes.}\]

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

\[P_{w}(N) = \frac{W}{Q} = \frac{(D - 2G)!(N - 1)!G}{(N - G)!(D - G - N)!} \times \frac{(D - N)!}{D!} = \frac{22!(N - 1)!16}{(N - 16)!(38 - N)!} \times \frac{(54 - N)!}{54!}.\]

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 \(N\) turns is

\[P_{z}(N) = 2 \times P_{d} \times P_{w}(N) = 2 \times \frac{(D - G)!(D - G)!}{(D - 2G)!D!} \times \frac{(D - 2G)!(N - 1)!G}{(N - G)!(D - G - N)!} \times \frac{(D - N)!}{D!}\] \[P_{z}(N) = \frac{2(D - G)!(D - G)!(N - 1)!G(D - N)!}{D!(N - G)!(D - G - N)!D!} = \frac{38!38!(N - 1)!(54 - N)!32}{54!(N - 16)!(38 - N)!54!}.\]

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

\[P_{tot} = \sum_{N = G}^{D - G} P_{z}(N) = 3.508 \times 10^{-12}.\]

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 \(G\) and \(D\) 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.