# Fitting a piece of furniture through a corridor

In a few days I'm facing the task of trying to move a piece of furniture into my apartment and the situation inspired me mathematically. Above is a sketch of the situation. We are trying to slide a small box of dimensions $h'$ and $w'$ through a corridor of dimensions $h$ and $w$ with entrance and an exit of widths of $a$ and $b$. No assumptions about any variables can be made except that $a$ > $h'$ and $b$ > $h'$, even if the picture suggests some relative dimensions. The box or any other dimension cannot obviously be stretched. The box can be turned freely.

I'm looking for the simplest way to calculate if it is possible to fit the box through the corridor, and how. I have come up with some tedious ways of trigonometry but somehow a simple and elegant solution eludes me. Help will be greatly appreciated!

EDIT: As pointed out in a comment, the box can be turned freely unlike my original question implied.

EDIT2: If it simplifies things, the length $h$ can be for my specific problem be assumed be bigger than $w'$ and $h'$, although it would be interesting to know a fully general case.

• If the box cannot be turned, it will fit iff $w'\le w$. Maybe you meant something else? – Taneli Huuskonen Jan 3 '18 at 19:02
• @TaneliHuuskonen Oops! That was a mistake indeed, of course the box can be turned! Thank you, I made corrections to the question. – S. Rotos Jan 3 '18 at 19:04
• This reminds me of the Moving sofa problem, which I first read about in an Ian Stewart column. – Matthew Leingang Jan 3 '18 at 19:25
• @MatthewLeingang Quite true. And still people say math doesn't have real-life applications :) – S. Rotos Jan 3 '18 at 19:43
• It would be interesting to draw the permitted region of the configuration space $(x,y,\theta)$ as a shape in 3D. A solution exists if there is a path from $(0,a/2,0)$ to $(w,h-b/2,0)$ inside the region. – Rahul Jan 3 '18 at 21:48

(The following is a partial answer at best, but too long for a comment.)

Suppose $\,a \le b\,$, otherwise flip the corridor around. If the box gets fully in through door $\,a\,$, then it will be able to get out through $\,b\,$ by symmetry, so it's enough to consider the move through $\,a\,$.

First step is to slide the box in at the maximum possible angle $\alpha$. If it can not get in the position depicted below without hitting the opposite walls first, then the move is impossible.

The angle $\alpha$ is determined by:

• $\,a \cos \alpha = h'\,$

Then the conditions for the inside corners of the box to fit are:

• $w' \cos \alpha \le w$

• $w' \sin \alpha + h' \cos \alpha \le h$

(As a side comment, the first condition is equivalent to $\,h' \cdot w' \le a \cdot w\,$ i.e. the area of the box no larger than the area from the door to the opposite wall.)

These are necessary conditions, and no solution is possible if they don't hold. They are not sufficient conditions in general, though.

The next step would be to rotate the box towards vertical position by sliding the bottom corner to the right while keeping the top side in contact with the door edge. Such rotation, however, requires additional room at the top, and possibly to the right as well. Exactly how much room reduces in the end to finding the extrema of some trig functions, to which I did not find "nice" closed solutions.

Still, there are a couple of cases where the above conditions are sufficient as well (both of which assume that the length of the corridor is larger than the diagonal of the box $\,h \ge \sqrt{w'^2+h'^2}\,$).

• If there is no perpendicular wall right next to $\,a\,$ i.e. if the bottom horizontal line in the drawing is missing, then the rotation can always be completed by sliding the bottom corner down and to the right, such that the box stays in contact with both edges of the door. In this case, the rightmost corner of the box never moves any closer to the right wall than it was before, so the previous condition is sufficient.

• If the horizontal'ish diagonal of the red box has an upwards slope in that position (unlike the slightly downwards one in the picture), then again the rotation can be completed without requiring additional room on the right. This is the case when $\,\varphi \ge \frac{\pi}{2} - \alpha\,$ where $\,\varphi\,$ is the angle between the diagonal of the box and its wide side, which translates to $\,a \ge \frac{h'}{\sin \varphi}=\frac{h' \sqrt{h'^2+w'^2}}{w'}\,$.

(The above leaves out some trivial cases such as $w'\le w$ when the box can be simply translated all the way, or $w' \le a, h' \le w$ when the box can be first turned sideways then translated, but in my practice of having moved large boxes around corners those cases never happen ;-))

• Very nice effort, thank you! I took your approach and found similar results, I wasn't able to find very nice expressions for the general case. However, your answer took me much closer than I was earlier and is sufficient for the problem I'm currently facing. Accepted. – S. Rotos Jan 6 '18 at 23:35
• @S.Rotos Thanks. The problem is deceivingly trickier than first looks, indeed. While I didn't find a "nice" solution, I don't have a good argument that one such doesn't exist, either, which makes it doubly annoying. – dxiv Jan 7 '18 at 0:00
• True, I am also surprised to find this problem to be trickier than anticipated. I'll let you know if I find something interesting. – S. Rotos Jan 7 '18 at 14:41

I have found 3 sets of restrictions, and I believe that if they're respected, the furniture will fit through the corridor.
First two restrictions to deal with angling after fitting through the door, where if the width of the furniture is too long, it won't be able to turn after reaching the wall. $$w' < \frac{h'}{a}*w - a*sin(90 -cos^{-1}\frac{h}{a})$$ $$w' < \frac{h'}{b}*w - b*sin(90 -cos^{-1}\frac{h}{b})$$ Edit: Dxiv pointed out that the two inequation on top are wrong. I've looked at it again and it should be $$w' < \frac{h'}{a}*w - \sqrt{a^2 - (h')^2}$$$$w' < \frac{h'}{b}*w - \sqrt{b^2 - (h')^2}$$
Edit 2 : Again it seems to go negative with small enough $h'$ so I'll leave a graph here https://www.desmos.com/calculator/p8knda1rwl
Then another one so diagonal length of the furniture doesn't surpass the height of the room $$(w')^2+(h')^2 < h$$ I didn't take into account the third dimension which would complicate this further and didn't seem to be implied in the question and a situation where the furniture could go from the first door straight into the second like so:

• That's a complicated way to write $\,w' \lt \frac{h'}{a} \cdot w - h\,$ since $\,\sin(90 - \arccos \frac{h}{a})=\cos(\arccos \frac{h}{a})=\frac{h}{a}\,$. And it can't be right, since the RHS of $\,w' \lt \frac{h'}{a} \cdot w - h\,$ goes negative for large enough $\,h\,$, which would mean you can't move any box through a really long corridor. – dxiv Jan 4 '18 at 0:16
• yeah I just noticed I wrote it wrong, it's supposed to be $arccos \frac{h'}{a}$ and $arccos \frac{h'}{b}$ which I think I messed up, I think it should be $sin(arccos \frac{h'}{a})$ – SirSoDerp Jan 4 '18 at 15:04
• Still not right, I am afraid. The RHS of $w' \lt \frac{h'}{a}\cdot w - \sqrt{a^2 - (h')^2}$ goes negative for small enough $\,h'\,$, which would mean that very narrow boxes cannot be moved through at all. – dxiv Jan 4 '18 at 23:23
• I think that might be due to arccos or arcsin restriction, and I lost the paper on which I did my calculations. I'll leave it like that and include this problem. Also it seems to have an upper limit as well, similarly to how arccos and arcsin are limited both in domain and codomain – SirSoDerp Jan 5 '18 at 16:02