It is a truth universally acknowledged that people dislike peeing next to each other.

Ok, maybe it’s just a Western thing. Or an American thing. Or a thing for people with large senses of personal space. But no matter what, there is a little dance you do when you go into a multi-stall bathroom. You casually glance (no bending over to check, that’s rude) to see if other stalls are occupied, and if so, how many. If no other stalls are occupied, you pick your favorite stall, maybe because it’s the one that always has toilet paper, maybe it’s the one with a slower automatic flush, maybe it’s got interesting graffiti. Do your thing, come out and all is well (please don’t forget to wash your hands!).

However, what if other stalls are occupied? Then, quick math takes over. You need to pick the stall that is the furthest from other people’s pooping. Sometimes this is easy and you can pick a stall two over, with a single stall barrier in between you and your peeing partner. Sometimes it’s harder. Of course when it reaches maximum capacity you just take whichever one is free, but that mid-capacity occupation is a delicate balance.

And it’s about this time that you begin to wonder…what is the POINT of all this. Most bathrooms are tile, so it’s not like whatever sounds you make will be muffled in any particular stall. Unless you are master of the silent pee, someone will know you’re peeing. And…why does that even MATTER? You’re in the BATHROOM!! What else would you be doing?! (Don’t answer that…).

And of course, I’m a GIRL. Apparently this problem is magnified for men. I have been informed via Twitter that it’s more than just an issue of homophobia or space…

So there you have it. Homophobia, personal space, and “splashback”. Yep. Suffice it to say the Twitter hilarity continued, but we’ve got science to get to.

Anyway, it turns out that men will go to great lengths in partially occupied restrooms to make sure there is adequate urinal spacing between peeing patrons. They will do this SO carefully…that some guys wrote a paper about it. With algorithms and models.

Like this:

(From XKCD, who basically covered this paper…only with less complicated math. Check it out. It’s AWESOME)

Kranakis and Krizanc. “The Urinal Problem” Proceedings of the 5th international conference on Fun with algorithms, 2010.

The idea behind this paper is…which urinal do you pick to maximize your privacy? For this, you’d think a psychology study with loads of dudes and urinals would be used:

But it turns out math works just fine, and doesn’t require IRB approval.

So you enter a restroom. It’s empty. Which urinal do you pick? Well, it’s not just a matter of picking one urinal. It’s a matter of picking one least likely to get people next to it. So you pick has to involve predicting the behavior of the people who are going to come in after you.

Of course, the people who come in after you are ALSO going to pick urinals carefully, not at random. They will also attempt to pick urinals that will give them the most privacy and spacing. Once this is no longer possible, randomness ensues. Assuming that one dude enters per time unit, and you have to stay til you’re done, which urinal do you pick in order to maximize the time until someone stands awkwardly next to you, looking straight ahead? The authors chose a number of models to try and predict behavior.

**1. The lazy model.**

This model states that people are naturally lazy, and that you’re not going walk any further than you have to. You will thus choose the first urinal that will provide you with maximal potential privacy. This will mean that you have two options, based on whether there is an odd or even number of urinals (represented by *n*).

If there’s an odd number of urinals (say 5), and you take the end one, this is optimal. You fill 1, and people come in to fill 3 and 5. You can fit three people at the urinals before people have to come in and deal. This works for even urinals too, but less efficiently. No matter what, the final number of people you can fit at the urinals with empty urinals in between is n/2.

In this case, the best possible choice is one of the end urinals, and if you’re lazy this is the one closest to the door. This ensures that not only will you have the maximal time before someone arrives next to you, you also have an option on only one side.

**2. Cooperative behavior**

This idea states that dudes will cooperate with each other to ensure minimal awkwardness. Again, the best for this is n/2, with dudes filling up every other urinal.

3. Maximizing your distance.

Sadly, people are not always cooperative. Sometimes they are selfish and want the maximum space around them, regardless of whether this will help other people pee in privacy. Here the math gets much more complicated.

Where A(n,i) is the number of guys when all urinals are occupied with maximal privacy for each if the first guy takes position i. B(n) is the maximal number of men if positions 1 and n are filled. It’s too complicated for me and I’m glad I don’t have to choose a urinal here. Notice how the math is easier when everyone is cooperating!

In this case, if you want to maximize the time you have to pee on your lonesome, it’s NOT better to chose the end urinals in some cases. However, if, after all the best urinals are filled, random choice ensues, the end urinals are still your best bet.

4. Random behavior

In this case, everyone is choosing randomly…so does it make a difference if you are the first one in? It does! If you have a group of 5, say, and you choose the middle one, and others are choosing randomly…well you won’t remain alone for long.

However, despite how complicated this gets…the end urinals are still the best choice. And when you think about it, it makes logical sense without all the math. I mean, being on the end is one less space for someone next to you!

Of course there are various other configurations: ones where some urinals are “semi-private” (say the ones on the end if they haven’t filled up yet, or ones where there is a person on one side and an empty urinal on the other). Perhaps these are valued more than the entirely non-private urinals. And course there’s the common issue of going into the bathroom…and you’re not the first one there.

And of course that’s not the biggest issue with all of this math, all of the equations here assume that once a guy enters the bathroom…he never leaves. The math becomes a lot more complicated as people finish up and leave.

But overall, the models predict the same conclusion. In general, when entering a bathroom FIRST, and confronted with a group of stalls or urinals, take the one on the end. It has the highest chance of privacy for the longest period of time. More privacy, less chance of someone eyeing your junk, and less backsplash. You heard it here first.

Kranakis and Krizanc (2010). The Urinal Problem Proceedings of the 5th international conference on Fun with algorithms DOI: 10.1007/978-3-642-13122-6_28