The math of swing doors

Have you seen those bidirectional swing doors (as I’ll call them)?

Swing doors

They’re usually transparent, made of glass, and used in clinics, fast food restaurants, offices and department stores. Something weird happens when two people arrive at the swing doors on opposite sides at the same time. Have you ever walked along a street and happened to nearly bump into another person, and both of you were trying to figure out which way the other was going to go?

“Is he going to move to his left? Then I’ll move to my left. Wait! He’s moving in the same direction as me! Ok, I’ll go to my right. What?! He’s moving to my right too!”

I usually just stop, step to one side and let the other person choose a direction, and both of us will be on our merry way. Why are we talking about this again? Oh right, swing doors.

Swing door dilemma

So this stranger Bob is on the outside and I’m on the inside. Bob’s thinking if he should quickly push the door on his side and come in, but is scared of knocking me. I’m thinking if I should quickly pull the door on my side and go out, but is scared of him knocking me. It’s a dilemma, I tell ya.

So what do I do? Being the gentleman that I am, I pull the door open and I stay on the inside, silently beckoning Bob to come in. I don’t mind being a doorman for a while. Besides, I get to train my bulging biceps from pulling the door and holding it open.

Me as a doorman

Apparently, Bob is taken aback at being treated like a hotel guest. And stays shocked still for a couple of seconds. Could be stunned by the sight of my bulging biceps though, I’m not sure…

At this point, I have to digress and talk about the finer points of opening a swing door. To open a swing door with the least effort, you should use your full body weight to help. This can be done by fully leaning onto the door and push. Or you can straighten your arms, locking at the elbow and pull.

For some reason, people like to push. I also noted that few people actually straighten arms, whether it’s pushing or pulling. Maybe it doesn’t look natural? Or it looks funny?

Anyway, I attempted to fathom this, and concluded with 3 reasons. Based on the embarrassment factor, you’d probably bend your arm instead of straightening it. Pushing involves more of the triceps, whereas pulling involves more of the biceps. Since triceps are a larger muscle group than biceps, your triceps are probably stronger than your biceps. Hence pushing is easier. Doctors and physiologists, please feel free to correct me. That’s the first reason.

The second one is sight. You can’t see behind you, and you might knock someone over if you pull without looking back. The third is momentum. You’re striding towards the swing door, and you don’t want to stop and pull. The natural flow is to push the door.

So what does Bob do? He pushes the door.

No, no, no, no, no, no, NO! And I’m going to mathematically prove to you why that’s a bad decision.

First, let’s define the door gap distance as the shortest distance between the tips of both doors. So when both doors are closed, the door gap distance is zero. So opening swing doors means maximising the door gap distance so you can pass through. And what’s the shortest path between two points? A straight line.

Let’s consider the case where I open the door on my side 90 degrees. Let the doors each be 1 unit wide. Thus we have the following diagram.

Swing door minimum distance

What’s the door gap distance in this case? Using Pythagoras’ Theorem, d = sqrt(2).

What’s the angle if you open the other door such that the door gap distance is the smallest? Remember the shortest path? There should be a straight line.

Swing door minimum angle

So using Pythagoras’ Theorem again, we have
d = (length of hypotenuse) – 1 = sqrt(2^2 + 1^1) – 1
= sqrt(5) – 1
This is less than sqrt(2), which is when the door was closed.

The angle theta is calculated by taking the inverse tangent of 1/2. At this point, I have to digress into some basic trigonometry in case you can’t follow.

Angles in trigonometry

The hypotenuse is the side opposite the right angle in a right-angled triangle. The opposite and adjacent sides depend on the angle you’re looking at. And now, I’m going to give you a mnemonic.

toa cah soh

In the Chinese dialect, Hokkien, it translates to “big foot lady” or some such. At least, that’s how my teacher taught me to remember. So “toa” is tangent equals opposite over adjacent. “cah” is cosine equals to adjacent over hypotenuse. And “soh” is sine equals to opposite over hypotenuse.

What’s that got to do with the inverse tangent? Well,
tan(theta) = (opposite) / (adjacent) = 1 / 2
Therefore, theta = inverse tangent of 1/2, which is roughly 26.5651 degrees.

Notice that at this angle, the door gap distance is smaller than when the door was closed (that is, the angle is zero). This means opening the door actually shrunk the door gap distance. What were we trying to do with opening the door? Maximising the door gap distance. Peculiar, isn’t it?

Which leads me to the next question. At what angle would we have the door gap distance to at least be as when we left the door closed?

Next angle with same closed door gap distance

You’ll have to study the diagram carefully for the following discussion. From the sides formed by p, q and d, we have
p^2 + q^2 = 2 (Pythagoras’ Theorem)

We also have
p + r = 2 (convince yourself of this by inspection)

We also have
sin(theta) = (opp) / (hyp) = (1-q) / 1 = 1-q

We also have
cos(theta) = (adj) / (hyp) = r/1 = r

From a trigonometry property (I can’t remember what it’s called), the sum of squares of sine’s and cosine’s of an angle is 1. So
(sin(theta))^2 + (cos(theta))^2 = 1
(1-q)^2 + r^2 = 1
=> 1 – 2q + q^2 + r^2 = 1
=> -2q + q^2 + r^2 = 0

Note that p + r = 2, so r = 2-p.
We also have p^2 + q^2 = 2, so q^2 = 2 – p^2

Substituting, we have
-2q + 2 – p^2 + (2-p)^2 = 0
=> -2q + 2 – p^2 + 4 – 4p + p^2 = 0
=> 6 – 2q – 4p = 0
=> p = (3-q) / 2

Substituting into p^2 + q^2 = 2, we have
((3-q) / 2)^2 + q^2 = 2
=> 5q^2 – 6q + 1 = 0

Using the quadratic formula, we solve for q,
q = [ -(-6) ± sqrt( (-6)^2 – 4(5)(1) ) ] / 2(5)
= 1 or 1/5

Since q should be less than 1, therefore q = 1/5. With that, remember that
sin(theta) = 1-q = 4/5
Using the inverse sine, we have theta = 53.13 degrees.

There’s actually an easier way to calculate theta. I was puzzling through the arcane math formulae that I’ve not touched for a long time and gotten a wrong result (both my q’s were greater than 1). I needed to bathe anyway, so I took a break.

As soon as the water from the shower head hit me, it hit me. There’s a simple and more elegant solution to this!

Swing door mirror angle solution

The angle to reach at least the door gap distance when the door was closed, was double the angle when the door gap distance was the minimum! It’s a mirror image! Just look at the diagram above and convince yourself of that. So the angle is 2 * 26.5651, which is roughly 53.13 degrees.

Yeah, I’m a dunce. Goes to show that sometimes, taking a break really does give you a new perspective on things. Elegant solutions can pop out of the most obscure circumstances. Well, at least I got some practice with algebra and trigonometry functions. Oh right, I nearly forgot why we’re doing all this.

Are you telling me you’re going to push the door 53 degrees in, when you could have the same door gap distance without doing anything in the first place?!

The other obvious solution to this is to open the door the other way, so the door gap distance becomes larger immediately. But we’ve already established that most people don’t like to pull on doors. And now, I’m telling you there’s a subtler solution without using much more energy. Check this out.

Swing door subtle solution

Some people can’t just accept a polite gesture, can they?

P.S. There’s a flaw in the argument I’ve presented in this entire article. Can you spot it?

Comments are closed.