The Mathematics of Urinals
Using restroom etiquette as an excuse to talk combinatorics.
If you use urinals in public bathrooms, then you probably know the golden rule of urinal etiquette: Don’t pee standing next to someone else.¹
What you may not know, however, is how many standing arrangements actually uphold that rule. Lucky for you, this is exactly what we’ll be exploring today!
Definitions.
Let’s say that a standing arrangement of some people at some urinals is well-spaced if no two people are standing next to each other. Let S(n) be the set of possible well-spaced arrangements at n urinals, and let S(n, k) be the subset of S(n) of arrangements with exactly k people. Our goal is to come up with formulas for the sizes of S(n) and S(n, k), which we denote by |S(n)| and |S(n, k)|. To see what this all means, consider the following example.
Pictured here is S(5), which contains thirteen arrangements (note that we include the empty arrangement). Then S(5, 2) consists of the arrangements in the picture with two people, of which there are six. So, we write |S(5)|= 13 and |S(5, 2)|= 6. Similarly, |S(5, 0)|= 1 and |S(5, 5)|= 0. We want to find a way to compute these kinds of values without explicitly drawing every standing arrangement.
A formula for |S(n)|.
There are lots of ways we might group the arrangements of S(n), like by number of people, by symmetry, or by aesthetic preference, but there’s one grouping that reveals a really nice recurrence relation.
Here we have S(5) again, but arrangements with their first urinal occupied are in the first column and arrangements with their first urinal empty are in the remaining columns. Everything in the “first occupied” group must have an empty second urinal (otherwise they wouldn’t be well-spaced), so they can only differ by what shows up in their last three urinals. The arrangements in the “first empty” group, however, can differ in their last four urinals. By the application of Animation Magic, we can see that grouping the arrangements of S(5) in this way reveals it to be nothing more than S(4) and S(3) taken together, with some urinals strategically tacked on the front.
In general we have the recurrence relation |S(n)|=|S(n – 1)|+|S(n – 2)|, and our initial conditions are |S(0)|= 1 and |S(1)|= 2 (which you can verify by drawing the pictures out yourself).
This is the Fibonacci sequence, but shifted by two places! If we write the nth Fibonacci number as F_n, then we have
Man, that Fibonacci guy really does show up in everything.
A formula for |S(n, k)|.
We were able to gain insight into S(n) by strategically removing certain urinals. In order to understand S(n, k), we will employ a more complicated removal process.
Above we have S(7, 3), the set of well-spaced arrangements of three people at seven urinals. Since the arrangements are well-spaced, there is guaranteed to be at least one urinal between persons 1 and 2, and another between persons 2 and 3. If we remove a urinal from each of the spaces between people, we end up with standing arrangements of three people at five urinals. In fact, we end up with all standing arrangements of three people at five urinals, both well-spaced and, uh, ill-spaced, I guess. In this way, we eliminate the spacing requirement and our question boils down to this: How many ways can we put three (identical) things into five spots? Well that’s just a binomial coefficient! You know, those numbers in Pascal’s triangle.
|S(7, 3)| is equal to the binomial coefficient we call “five choose three,” which equals ten. If we have k people at n urinals, then we end up removing k – 1 urinals, so we have
And with that, we’ve achieved everything we’ve set out to do.
But wait, there’s more!
We know from their definitions that |S(n)| is the sum of the |S(n, k)|’s over all² k,
We found a formula for the left side and we also found a formula for every term on the right side. Invoking those formulas gives us
which we can rewrite as
Woah. This elegant formula gives us a way to compute a large Fibonacci number without computing all the Fibonacci numbers before it!
The next time you pee at a urinal, I hope you think about how the thing you’re aiming at is the mathematical link between Fibonacci numbers and binomial coefficients. At the very least, I hope you’re able to ward off unwanted restroom companions with well-informed complaints.
- Unless there’s no other choice, of course. The rule mainly condemns the people who choose to stand right next to you when open urinals are aplenty.
- We are free to let k increase forever because once k gets big enough, all subsequent terms in the sum are zero. For instance, what’s the number of well-spaced arrangements of four people in six urinals?