Largest semicircle in a rectangle

1.1k Views Asked by At

We are given a rectangle. Its adjacent sides are $m$ and $n$ ($m \geq n$). We need to find the largest semicircle in this rectangle. How can we find it?

EDIT: Beware of such situations!!

enter image description here

5

There are 5 best solutions below

0
On

So, take a rectangle sides m and n. m is the long side and n is the short. The radius of the semi circle would be n, if m is more than 2n. Half of m > n. Therefore, Rectangle 1/2m,n would be suitable to provide a quarter circle, so man would provide a semi circle. Otherwise,half m would be the radius for a rectangle whose m is less than 2n. This is because 2m would not fit in n, so requires rescaling in order to find the maximum semicircle.

0
On

I suck at diagrams, so please refer to the rectangle provided in the question. I take the lower left vertex to be the origin, and place the coordinate system such that the vertices become $(0,0)$, $(m, 0)$, $(0, n)$ and $(m, n)$. Let the centre of the semicircle be $O(\alpha, \beta)$. For the semicircle to be contained within the rectangle, $|\alpha| = |\beta| = r$. Hence the equation of the circle is:

$$ (x - \alpha)^2 + (y - \beta)^2 = \alpha^2 $$

The circle intersects (note that I'm excluding the points where it just touches) the rectangle at 2 points, say $P$ and $Q$. If the circular sector $POQ$ be a semicircle, the $P$, $O$ and $Q$ must be collinear.

The circle intersects the line $y = n$ at $P$ (there is another point of intersection, but that is out of consideration). Hence,

$ (x - \alpha)^2 + (n - \beta)^2 = \alpha^2 \\ \implies x^2 -2\alpha x + (n -\beta)^2 = 0 \\ \implies x = \alpha - \sqrt{\alpha^2 - (n - \beta)^2}. $

Only 1 root is of interest since $P$ is towards the left of $O$. Hence,

$$ P \equiv \left( \alpha - \sqrt{\alpha^2 - (n - \beta)^2} , n\right) $$

Similarly,

$$ Q \equiv \left(m, \beta - \sqrt{\beta^2 - (m - \alpha)^2}\right) $$

If $P$, $O$, and $Q$ be collinear,

$$ \frac{\beta - n}{\alpha - \alpha + \sqrt{\alpha^2 - (n - \beta)^2}} = \frac{\beta - \sqrt{\beta^2 - (m - \alpha)^2} - n}{m - \alpha + \sqrt{\alpha^2 - (n - \beta)^2}} $$

Since $\alpha, \beta > 0$, putting $\alpha = \beta = r$ and simplifying,

$$ \frac{r-n}{\sqrt{2nr-n^2}} = \frac{r - n - \sqrt{2mr-m^2}}{m - r + \sqrt{2nr-n^2}} \\ \implies (n-r)(m-r) = \sqrt{(2nr-n^2)(2mr-m^2)} $$

Simplifying with the consideration that $r\neq 0$,

$$ r^2 - 2(m+n)r +(m^2+n^2) = 0\\ \implies r = m + n - \sqrt{2mn} $$

The root with the negative sign is chosen because $r < m$ and $r < n$. As is obvious, there is only 1 semicircle that can be fit in a rectangle for a given $m$ and $n$.

For $m > 2n$, we have $r > n$. Thus no semicircle exists for such a rectangle. In general we can say $m \in [n, 2n]$ for a semicircle to be fit in a rectangle. This observation also places a bound on $r$: $r\in [(2-\sqrt{2})n, n]$.

It might also be worth noting that the circle, that the semicircle is a part of, passes through the point $(m,n)$, i.e. the upper right vertex of the rectangle.

0
On

From the bottom left, anti clockwise, we have the rectangle vertices,

$$ \cases{ A = (0,0)\\ B = (L,0)\\ C = (L,H)\\ D = (0,H)\\ } $$

also the common points

$$ \cases{ a = (R,0)\ \ \ \text{tangent to}\ \ \ AB\\ b = \mu_1 B + (1-\mu_1)C,\ \ \ 0\le \mu_1\le 1\\ c = (0,R)\ \ \ \text{tangent to}\ \ \ AD\\ d = \mu_2 D + (1-\mu_2)C,\ \ \ 0\le \mu_2\le 1 \\ p_0 = (x_0,y_0)\ \ \ \text{circle's center}\\ } $$

and now we have the restrictions

$$ \cases{ \|a-p_0\|^2-R^2=0\\ \|b-p_0\|^2-R^2=0\\ \|c-p_0\|^2-R^2=0\\ \|d-p_0\|^2-R^2=0\\ \frac 12(d+b)=p_0 } $$

with the objective function $f = \pi R^2$ we have the lagrangian

$$ L(\mu,R,p_0,\lambda) = f+\lambda_1(\|a-p_0\|^2-R^2)+\lambda_2(\|b-p_0\|^2-R^2)+\lambda_3(\|c-p_0\|^2-R^2)+\lambda_4(\|d-p_0\|^2-R^2)+(\lambda_5,\lambda_6)\cdot(\frac 12(d+b)-p_0) $$

The stationary points are determined by solving for $\mu,R,p_0,\lambda$ the equations

$$ \nabla L = 0 $$

Due to the necessary effort to manipulate the algebraic operations that lead us to the result, we include a MATHEMATICA script that is in charge of solving the equations. It must be said that these same operations could be carried out with paper and pencil. A filter is included at the end of the script to discard infeasible solutions. A plot for the case $H = 5, L = 6$ is included.

Clear[L, H, R]
pA = {0, 0};
pB = {L, 0};
pC = {L, H};
pD = {0, H};
a = {R, 0};
b = l1 pB + (1 - l1) pC;
c = {0, R};
d = l2 pD + (1 - l2) pC;
p0 = {x0, y0};
p = {x, y};
circ[p_] := (p - p0).(p - p0) - R^2
equ1 = circ[a];
equ2 = circ[b];
equ3 = circ[c];
equ4 = circ[d];
equ5 = 1/2 (d + b) - p0;
equs = Join[Join[{equ1, equ2, equ3, equ4}], equ5];

f = Pi R^2;
LG = f + Sum[lambda[k] equs[[k]], {k, 1, 6}];
vars = {l1, l2, R, x0, y0};
EQUS = Grad[LG, Join[vars, Table[lambda[k], {k, 1, 6}]]];
parms = {H -> 5, L -> 6};
EQUS0 = EQUS /. parms;

sols = Solve[EQUS0 == 0, Join[vars, Table[lambda[k], {k, 1, 6}]]];
res = Union[{f, l1, l2, R, x0, y0} /. sols] /. parms;
n = Length[res];
clean = {};
clean = {};
OnlyReals[p_] := Module[{np = Length[p], k}, For[k = 1, k <= np, k++, If[Element[p[[k]] , Reals] == False, Return[False]]]; Return[True]]
n = Length[res];
For[k = 1, k <= n, k++, If[OnlyReals[res[[k]]] && 0 <= res[[k, 2]] <= 1 && 0 <= res[[k, 3]] <= 1 , AppendTo[clean, Thread[{l1, l2, R, x0, y0} -> Take[res[[k]], {2, n}]]]]]
clean

gr1 = ListLinePlot[{pA, pB, pC, pD, pA} /. parms];
gr2 = Graphics[{Thick, Circle[{x0, y0}, R]} /. clean[[1]]];
gr3 = ParametricPlot[(mu d + (1 - mu) b) /. clean[[1]] /. parms, {mu, 0, 1}, PlotStyle -> {Thick, Black}];
Show[gr1, gr2, gr3, AspectRatio -> (H/L) /. parms, Axes -> False]

enter image description here

0
On

Let start from semicircle. Let its center is (0,0), radius is $r$ and starting angle is $\alpha\in (0;\pi)$. Then semicircle arc points can be described by formulae $x=r \cos t$, $y=r\sin t$, $t\in (\alpha;\pi+\alpha)$. Then minimum rectangle $m\times n$ containing this semicircle is determined by $m=\max(x)-\min(x)$, $n=\max(y)-\min(y)$. Exploring cases with various $\alpha$ gives $$m=r (1+|\cos \alpha|),\ n=r(1+|\sin\alpha|)$$

Ratio $\frac{m}{n}$ cannot be greater than 2. That's why if $m>2n$ maximum $r$ is determined by $n$ and is equal $n$.

If $2n\ge m\ge n>0$ we can find $r\in R_+$, $\alpha\in [0,\pi/4]$ such that $m=r(1+\cos\alpha)$, $n=r(1+\sin \alpha)$:

$$r=m+n-\sqrt{2mn},\ \alpha=\arccos \frac{\sqrt{2mn}-n}{m+n-\sqrt{2mn}}$$

Then, answer is $r=n$ for $m>2n$ otherwise $r=m+n-\sqrt{2mn}$

0
On

We have a rectangle $ABCD$, with $AB=m$ and $AD=n$. We want to find points $P$ on $AD$ and $Q$ on $AB$ such that the senicircle with diameter $PQ$ is tangent to $BC$ and $CD$ at $I$ and $H$ (see figure).

Set $x=AQ$ and $y=AP$. If $M$ is the midpoint of $PQ$, from $PM=QM=HM=IM$ one gets: $$ {1\over2}\sqrt{x^2+y^2}=n-{y\over2}=m-{x\over2}. $$ The only solution is: $$ x=-2n+2\sqrt{2mn},\quad y=-2m+2\sqrt{2mn} $$ but to have $x\ge 0$ and $y\ge0$ we must require the condition $m\le2n$, otherwise the construction is impossible.

The radius of the circle can then be computed as $$ r={1\over2}\sqrt{x^2+y^2}=m+n-\sqrt{2mn}. $$

If $m>2n$ then the largest semicircle inside the rectangle has radius $n$ and its diameter on a long side of the rectangle.

enter image description here