## Men’s Room Mathematics

The first floor men’s room in Carnegie Mellon’s Baker Hall has four urinals.  Every time I visited this facility I remarked the pointlessness of the fourth urinal: as the universal law of the men’s room mandates a buffer of at least one urinal, a bank of four urinals can only accommodate two men.  The construction company might as well have saved some money and installed only three.

This observation alone would not be worth writing about; recently, however, I discovered that generalizing it results in a mathematical system with some very interesting properties.  The system is based on three axioms:

Axiom 1: The first man who enters the men’s room must select an end urinal.

Axiom 2: Any subsequent entrant must select the urinal that maximizes the space between him and his nearest neighbor.

Axiom 3: A buffer of at least one urinal must be maintained between any two men.

These axioms create a mapping y =U(x) between the number of actual urinals (x) and the number of effective urinals (y).  The pairs (1, 1) and (2, 1) are trivial, and we’ve already seen the pairs (3, 2) and (4, 2).  It’s easy to see that adding a fifth urinal increases the number of effective urinals to three, but that a sixth is superfluous; thus (5, 3) and (6, 3).

A first guess at the function that produces this mapping might be U(x) = ceiling((x+1)/2), where ceiling(x) is the smallest integer not less than x (see the Wikipedia entry on floor and ceiling functions).  This function produces the mapping (7, 4), which seems to make sense; if there are seven urinals, men can occupy urinals 1, 3, 5, and 7.

Such an arrangement, however, would violate Axiom 2!  The first two men to enter the toilet will take urinals 1 and 7; what about the third?  In order to maximize the space between himself and his nearest neighbor, he must take urinal 4.  The poor fourth man must either wait or piss in the sink, as there is no way to create the requisite 1-urinal buffer.  Thus, the efficient arrangement (1, 3, 5, 7) is impossible.

Consider the situation after the third man enters the room, in which urinals 1, 4, and 7 are occupied.  We can treat this as two banks of four urinals, with urinal 4 serving as the right endpoint for one bank and the left endpoint for the other.  With this in mind, we can define the Urinal Mapping Function recursively:

U(1) = 1

U(2) = 1

U(3) = 2

for x > 3, U(x) = U(ceiling((x+1)/2)) + U(floor((x+1)/2)) – 1

I used this function to generate the mapping out to x = 10,000; here’s the function depicted graphically:

The Urinal Mapping Function

The linear increases followed by long flat plateaus constitute an interesting pattern (fractal?).  Observe the first 26 values of U(x): 1, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10.  Notice that there are two twos, three threes, five fives, and nine nines.  All other values (except for 1) appear exactly once.  This pattern holds true for the remainder of the sequence; for example, any number of urinals between 4,097 and 6,115 yields 2,049 effective urinals.  I therefore submit the following hypotheses:

Hypothesis 1: U is a surjection.

Hypothesis 2: each value U(x) appears either once or exactly U(x) times.

Hypothesis 3: If a value U(x) > 2 appears more than once, it is odd.

I don’t know how to prove these hypotheses or why they might be true.  I am also at a loss to identify what properties all repeated values of U(x) share.  I’ll leave these problems to our mathematically inclined readers.

Another way to look at the problem is to ask what fraction of actual urinals are effective urinals.  This is easily done by examining the behavior of U(x)/x, which is illustrated below:

We see that the ratio oscillates between a maximum of just over 1/2 – specifically, (x + 1)/ 2 – and a minimum of floor(x/3) + 1.  Looking at the local maxima and minima, two concepts suggest themselves:

Definition: A number of urinals n is maximally efficient if U(n) > U(n-1).

Definition: A number of urinals n is maximally inefficient if U(n) = U(n-1) and U(n) < U(n+1).

In other words, a number of urinals is maximally efficient if removing one would reduce the number of effective urinals, and a number of urinals is maximally inefficient if adding one would increase the number of effective urinals but removing one would not make a difference.  1, 3, 5, 8, 9, and 17 are maximally efficient, while 2, 4, 7, 13, and 25 are maximally inefficient.  I’ll leave it to readers to figure out the properties of maximally efficient and maximally inefficient numbers.

I’m excited to have stumbled upon an apparently new mathematical system; the sequence generated by the Urinal Mapping Function is not found in the On-Line Encyclopedia of Integer Sequences.  It seems to be a very rich and interesting system; I suspect that the properties presented here are merely the tip of the iceberg.  I will continue to ponder the matter, and I encourage readers to present their insights in the comments section.

### 10 Responses to Men’s Room Mathematics

1. Matt Gronke says:

Dividers between urinals would allow for men to stand next to each other, therefore nullifying your results.

2. Dan says:

The axioms are obviously idealizations; there are many circumstances in which they would not actually be obeyed.

That said, if there is a bank of five urinals with dividers and only urinal 1 is occupied, would you be willing to use urinal 2?

3. Jacob Glick says:

Good job on another fine Moral Hazard post. The math is a little bit complicated, but I understand the main point of the post.

4. rpollack says:

This is a noble effort, Dan, and I do hope you keep at it. However, your third axiom is only a “universal law” among insecure neurotics. I do not believe I have ever observed a violation of the first or the second axiom, and if I ever should observe such a violation I suppose I would find it so scandalously bizarre that I would tell people about it and assume some disorder on the part of the violator.

However, when I enter a crowded restroom where only “buffer” urinals are available, I do not consider either waiting or using a stall, both of which I consider beneath my dignity, being neither a child nor a woman but a man, for whom the urinal, if it is functioning and unoccupied, is a right. What’s more, knowing well the prevalence of the “third axiom neurosis,” I frequently judge others by their observing or flouting it. When I am at a urinal and I notice another man enter the bathroom, see me, and then sheepishly enter a stall, I smirk to myself and consider him a chump. When he approaches the urinal undeterred, I consider that a mark in his favor.

5. Dan says:

As I said in my reply to Matt, the axioms are idealizations; without them, the system is uninteresting. I also usually disobey Axiom 3, but I do strictly prefer a buffer to none, as I’m sure you do.

I just learned that in an eerie coincidence, the XKCD guy blogged about this very subject the same morning that I did. Check out his work here.

6. Nick says:

Astonishing! A fellow urinary expert released his study (and subsequent formula) the same time you did. View the simplified formula here:

moralhazard.wordpress.com

This is truly uncanny.

7. Nick says:

Ok, I’m not a dumbass, despite the evidence above. I hate this slow unresponsive bullshit computer. That was intended for xkcd, but my computer thought a spontaneous jump back would make things more fun. It’s also deciding to randomly capitalize words. Excellent. D:<

8. Kelly says:

As the number of toilets (n) increases so does the amount of time needed for the new peeer to figure out which toilet to take. So as (n) gets really big the poor guy’s going to wait, during which time previous peeers may be leaving. Of course this requires the guy to restart his calculation (he can’t always take the vacated spot) delaying him from peeing for EVEN longer! So the finite nature of time to pee means that the efficiency for a given n varies as a function of avg pee time. Maybe a better measure of efficiency would be obtained by a model that accounted for this. Then you might get varying results depending on whether your avg pee time comes from a geriatric ward or a high school locker room.

9. Nick says:

For your thesis, are you going to apply this calculation to troughs?

10. F_D says:

It might be worth noting that there are some additional corollaries that could interfere with Axiom 1. For example, at my place of work, the main men’s room has 4 (flushless!) urinals — of which, the one on the far left is set down lower on the wall. (Why is it lower? For short men? kids? Cotton Hill? I don’t know.) For what it’s worth, there is apparently some stigma attached with using “the short man” and so right out of the gate, if someone is occupying the right-most urinal, you are faced with a decision: do you adhere to Axiom 1? or do you cave to the stigma of “the short man” in order not to violate the pure mathematics of it all?