# Finding the area remaining after flipping a rectangle inside a rectangle

Let $r$ be the inside rectangle of base $b$ and height $h$.

Let $R$ be the outside rectangle of base $B$ and height $H$

The dimensions of $r$ and $R$ are related in the following way:

I want to find the area left when you flip $r$ against the walls of the outside triangle until its back in it's original position, here is a diagram of the area left after a few flips (orange region):

The pink rectangle indicates where the rectangle was before we started flipping it.

• How will the rectangle pass over the centre of the bigger rectangle? Jun 20, 2015 at 7:04
• This is such an interesting problem. In some cases, the remaining area is area, I think the condition for that to happen is $b>2h$ or $h>2b$. Would it be easier if we limit it to some special cases first? For example, what would the answer be when $h=b$? Jun 20, 2015 at 7:43
• The following (special case) assumes that $kb+(k+1)h|B$ or $(k+1)b+kh|B$ or $b+h|B$, and similarly for $H$. I.e., any sum of iterated flips of $r$ always fits "snugly" in both $B$ and $H$. Start with $BH-(n-1)bh$, where $n$ is the number of flips. That is, first we only subtract the area of the smaller rectangle the number of times that it is flipped without counting the initial position twice. Then calculate how much additional area each turn of $r$ subtends: $f(h,b)$. I suspect that in this case corners pose no additional problems? So the remaining area would be $BH-(n-1)bh-nf(h,b)$? Jun 22, 2015 at 18:26
• The above (special) case also assumes that both $B$ and $H$ are at least twice as long as the diagonal of $r$, i.e. $\text{min} \{ B,H \} /2 \ge \sqrt{b^{2} + h^{2}}$, since that's the "furthermost" that $r$ will ever subtend the inner area of $R$, and the above solution to the special case doesn't take into account "inner overlaps". This is a rather restricted case, but it's a start isn't it? Jun 22, 2015 at 18:44
• Does it hold that $2h+b=B$ and $2b+h=H$?
– san
Jun 25, 2015 at 2:34

The untouched area for $b=h$ (ie, when $B H$ is a square), is $$\text{ area}=b^2 \left(-2 \sqrt{3}-\sqrt{7}+\frac{2 \pi }{3}+7-4 \csc ^{-1}\left(\frac{4}{\sqrt{7}}\right)\right):$$

Here, $B:H=1:1.$ It is likely this is either optimal, or close to optimal.

The area $=0$ for $h\geq\left(\sqrt{7}-2\right) b$ - or, of course, for $b\geq\left(\sqrt{7}-2\right) h:$

Here, $B:H=1:\left(14+3 \sqrt{7}\right)/19$

Some Mathematica code to play with (example implementation: areaBH[2,2] and manipulateBH[2,2]).

# Update

The total untouched area can therefore be calculated with:

Area $=$

If $\left(\sqrt{7}-2\right) b<h< \left(\sqrt{3}-1\right),$

\begin{align}{r} \frac{1}{2} \left(h \left(-\sqrt{4 b^2+3 h^2}-2 \sqrt{b (3 b-4 h)}+4 h\right)+4 \left(b^2+h^2\right) \times\\ \left(\tan ^{-1}\left(\frac{\sqrt{b (3 b-4 h)}}{b+2 h}\right)-\tan ^{-1}\left(\frac{h}{\sqrt{4 b^2+3 h^2}}\right)\right)+2 b h-b \sqrt{b (3 b-4 h)}\right)\\ \end{align}

If $\left(\sqrt{3}-1\right) b<h<b/(\sqrt{3}-1),$

\begin{align} &\frac{1}{2} \left(-b \left(\sqrt{3 b^2+4 h^2}-6 h\right)-h \left(\sqrt{4 b^2+3 h^2}+2 \left(\sqrt{3}-2\right) h\right)+4 \left(b^2+h^2\right) \times\\ \left(-\tan ^{-1}\left(\frac{h}{\sqrt{4 b^2+3 h^2}}\right)+\cot ^{-1}\left(\frac{b}{\sqrt{3 b^2+4 h^2}}\right)-\tan ^{-1}\left(\frac{b+\sqrt{3} h}{\sqrt{3} b-h}\right)+\tan ^{-1}\left(\frac{\sqrt{3} h-b}{\sqrt{3} b+h}\right)\right)-2 \left(\sqrt{3}-2\right) b^2\right)\\ \end{align}

If $b/(\sqrt{3}-1)<h<b/(\sqrt{7}-2),$

\begin{align} b \left(-\frac{1}{2} \sqrt{3 b^2+4 h^2}-\sqrt{h (3 h-4 b)}+h\right)+2 \left(b^2+h^2\right) \left(\cot ^{-1}\left(\frac{b}{\sqrt{3 b^2+4 h^2}}\right)-\tan ^{-1}\left(\frac{2 b+h}{\sqrt{h (3 h-4 b)}}\right)\right)+2 b^2-\frac{1}{2} h \sqrt{h (3 h-4 b)}\\ \end{align}

otherwise, $0.$

Anyhow, the area that the OP asked for can be found with the functions areaBH[b,h] (which is slower) or fBH[b,h] (the formula given above) for any $b$ and $h.$

eg fBH[N[100],80] gives $470.616$ almost immediately, whereas fBH[100,80]//FullSimplify gives $-200 \left(82 \sqrt{3}+8 \sqrt{37}+5 \sqrt{139}+\frac{164 \pi }{3}-284-164 \cot ^{-1}\left(\frac{9}{\sqrt{5843-80 \sqrt{5143}}}\right)\right),$ which takes a little longer to calculate.

Note

If $\dfrac{\text{area}}{BH}$ is plotted instead of just $\text{area},$ the maximum value returns to $h=b$ as expected:

With[{b = 1}, Plot[fBH[b, h]/((2 h + b) (2 b + h)), {h, b (Sqrt@7 - 2),
b/(Sqrt@7 - 2)}, Filling -> Axis, Axes -> False, Frame -> True,
GridLines -> {{b, b (Sqrt@7 - 2), b/(Sqrt@7 - 2)}, {0, fBH[b, b]/((2 b + b)
(2 b + b))}}]]


so $b=h$ is indeed optimal, when scaled properly against $BH.$

• For the GIF illustrations! +1
– MonK
Jul 3, 2015 at 11:39

First of all let us consider the area swept after a one flip (the white area in your diagram and the cyan area in mine) by the rectangle $ABCD$ with base $b=AB$ and height $h=AD$ on a line (in other words, the corners of the outside rectangle aren't taken into account, yet):

It can be seen that this area is composed of the circular segment $DD'$ and triangles $ADB$ and $C'BD'$.

Furthermore, since $\angle ADB + \angle DBA = \pi/2$ radians, $\angle DBC = \angle BDA$ and $\angle A'BD' = \angle DBA$ then $\angle DBD' = \angle A'BD' + \angle DBC = \pi/2$ radians and the circular sector $DD'$ is a quarter circle.

Thus the area of this sector is simply $$\frac{\pi*DB^2}{4} = \frac{\pi*(\sqrt{AD^2+AB^2})^2}{4} = \frac{\pi*(b^2+h^2)}{4}$$ It can be seen that the triangles $ADB$ and $C'BD'$ together make the rectangle $ABCD$ with area $AB*AD=b*h$, thus the total swept area (in cyan) is: $$A = \frac{\pi*(b^2+h^2)}{4} + bh$$

Now let us consider the area (the total colored area in diagram) after a second flip:

This area is composed of the two quarter circles $DD'$ and $A'A''$ (with area $\frac{\pi*(b^2+h^2)}{4}$ each), the two equal triangles $ADB$ and $C'A''D''$ (that together make the original rectangle and thus together have area $bh$) and the triangle $YBC'$, however the two quarter circles overlap, so we must subtract the area of triangle $A'D'Y$ (which is equal to $YBC'$) and the shape $XA'D'$ So the total area is $$A = (A_{DD'}+A_{A'A''}) + (A_{ADB}+A_{C'A''D''}) + (A_{YBC'} - A_{A'D'Y}) - A_{XA'D'} =$$ $$=\frac{\pi*(b^2+h^2)}{2} + bh - A_{XA'D'}$$

The area of shape $XA'D'$ doesn't seem that easy to calculate though, so let us make some extra constructions:

Due to symmetry the shape $XZA'$ is equal to the shape $XZD'$ The area of $XZA'$ can be calculated by subtracting the area of triangles $XC'Y$ and $ZYA'$ from the area of the circular sector $A'X$.

If we let $\angle XC'A'=\alpha$, then the area of $A'X$ is simply $$\frac{\alpha*C'A'^2}{2} = \frac{\alpha*(b^2 + h^2)}{2}$$

Since $A'Z=A'D'/2 = AD/2 = h/2$ and $ZY=A'B/2 = AB/2 = b/2$ the area of $A'ZY$ is $$\frac{A'Z*ZY}{2}=\frac{bh}{8}$$

Notice that $C'Y=C'A'/2=C'X/2$ so the area of $XYC'$ is given by $$\frac{C'Y*C'X*\sin(\alpha)}{2}=\frac{C'X^2*\sin(\alpha)}{4} = \frac{\sin(\alpha)*(b^2+h^2)}{4}$$

Now $\alpha = \angle XC'A' = \angle D'C'A'-\angle D'C'X = \angle D'C'A'-\angle X C'W$ since both triangle $D'C'A'$ and triangle $XC'W$ are straight edge triangles, the the according angles can be simply expressed as arcsines:

$$\angle D'C'A'=\arcsin\left(\frac{A'D'}{C'A'}\right)=\arcsin\left(\frac{b}{\sqrt{b^2+h^2}}\right)$$ $$\angle X'C'W=\arcsin\left(\frac{C'W}{XC'}\right)=\arcsin\left(\frac{\frac{C'B}{2}}{XC'}\right)=\arcsin\left(\frac{b}{2\sqrt{b^2+h^2}}\right)$$ $$\alpha =\arcsin\left(\frac{b}{\sqrt{b^2+h^2}}\right)-\arcsin\left(\frac{b}{2\sqrt{b^2+h^2}}\right)$$ Sparing some simplifications: $$\sin(\alpha)=\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}$$ $$\alpha = \arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)$$ So the area of $XA'D'$ is $$A_{XA'D'} = 2* A_{XA'Z}=2*\left(\frac{\alpha*(b^2 + h^2)}{2} -\frac{\sin(\alpha)*(b^2 + h^2)}{4}- \frac{bh}{8} \right) =$$ $$= \arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)*(b^2 + h^2) - \frac{b(\sqrt{3b^2+h^2}-h)}{4} - \frac{bh}{4} =$$ $$=\arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)*(b^2 + h^2)-\frac{b\sqrt{3b^2+h^2}}{4}$$

And the total area after the second flip is $$A=\frac{\pi*(b^2+h^2)}{2} + bh - A_{XA'D'} =$$ $$=\frac{\pi*(b^2+h^2)}{2} + bh+\frac{b\sqrt{3b^2+h^2}}{4} - \arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)*(b^2 + h^2)$$

Now let us look at the area after three flips:

Now, the area is made out of three quarter circles ($DD'$,$A'A''$,$B''B'''$), one triangle on each side that add up to $bh$ (the triangles $ADB$ and $A'''D''B'''$) and some triangles in the middle that are compensated by the triangles that overlap (the triangles $YBC'$ and $Y'C'D''$ are compensated by $A'D'Y$ and $A''B''Y$ respectively), and two overlapping shapes ($XA'D'$ and $X'B''A''$). The area of $X'B''A''$ can be calculated in similiar fashion to $XA'D'$ to be $$\arcsin\left(\frac{h(\sqrt{3h^2+b^2}-b)}{2*(b^2+h^2)}\right)*(b^2 + h^2)-\frac{h\sqrt{3h^2+b^2}}{4}$$ The area is given by: $$A=bh+ 3*\frac{\pi*(b^2+h^2)}{4} + \frac{h\sqrt{3h^2+b^2}}{4} - \arcsin\left(\frac{h(\sqrt{3h^2+b^2}-b)}{2*(b^2+h^2)}\right)*(b^2 + h^2) + \frac{b\sqrt{3b^2+h^2}}{4}-\arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)*(b^2 + h^2)$$

Now that we know all the essential areas to calculate the area in case of $n$ flips: $$A(n) = bh + n*\frac{\pi*(b^2+h^2)}{4} -$$ $$-\left[\frac{n}{2}\right]*\left(\arcsin\left(\frac{b(\sqrt{3b^2+h^2}-h)}{2*(b^2+h^2)}\right)*(b^2 + h^2)-\frac{b\sqrt{3b^2+h^2}}{4}\right)-$$ $$- \left[\frac{n-1}{2}\right]*\left(\arcsin\left(\frac{h(\sqrt{3h^2+b^2}-b)}{2*(b^2+h^2)}\right)*(b^2 + h^2) - \frac{h\sqrt{3h^2+b^2}}{4}\right)$$

Where $[x]$ is the floor operation.

Now to corners: First of all let us look at a "nice" corner: Notice that the total area is given by two quarter circles $DD'$ and $BB''$, three equal triangles and the overlapping shape $D'XB$ so the total area is $$A_c=3*\frac{bh}{2} + 2*\frac{\pi*(b^2+h^2)}{4} - A{D'XB}$$

Notice that the triangle $D'XB$ is equilateral, so $\angle XBD'=\angle XD'B=\pi/3$ thus the areas of the sectors $D'X$ and $XB$ are equal and given by $A_{XB}=\frac{\pi*(b^2+h^2)}{6}$. Now the area of the shape $D'XB$ is equal to $$2*A_{XB}-A_{\triangle D'XB} = \frac{\pi*(b^2+h^2)}{3} - \frac{(b^2+h^2)*\sqrt{3}}{2}$$ Thus the total area of a corner is $$A_c=3*\frac{bh}{2} + \frac{\pi*(b^2+h^2)}{2}-\frac{\pi*(b^2+h^2)}{3} + \frac{(b^2+h^2)*\sqrt{3}}{2} = 3*\frac{bh}{2}+\frac{(\pi+3\sqrt{3})*(b^2+h^2)}{6}$$

Thus in the case where the outer rectangle is "nice" (all the corners are "nice"), if a total of $n_B$ and $n_H$ flips fit into the sides $B$ and $H$ respectively, then we can calculate the total swept area as $$A = 4*A_c + 2*A(n_B-2) + 2*A(n_H-2)$$

So the area left (the orange area in your diagram) would be $$B*H-A=B*H-4*A_c - 2*A(n_B-2) - 2*A(n_H-2)$$

(This is a very hard to fully answer question, as there are still so many cases that need to be looked into (not even talking about the cases where the inner rectangle reaches its starting position after 2 or more (or even infinite) circles around the outer rectangle), and I plan on adding more on not "nice" corners and not "nice" rectangles later but i tought what little there was would still help)