24

I believe smallest possible triangle to cover a square is well studied... But how about square covering a triangle? I read the post here, but I think that I don't want such a general question (and complicated solution), just right triangle.

I first encounter the problem, which is, find the square with minimum length that covers a triangle with sides $5,12,13$ completely. The answer is a square with length$\frac{144}{\sqrt{193}}$ and I believe so, using the method here.

But the problem is, why is it the smallest possible square covering the triangle?

My attempts:


If a square covers the triangle and at the same time they have some vertex(s) coinciding:
If it is $\angle BAC$ touching vertex of square, see here, the square covering it should have side length of at least 12.
If it is $\angle BCA$ touching the vertex of square, see here, the square covering it should also have side length of at least 12.
This leaves us to the problem of $\angle ABC$, see here or below:enter image description here It is the smallest because whatever it is rotated clockwise/anti-clockwise through the origin, the side length of square will be larger.

For every square covering a triangle, there is a smaller square covering the same triangle while touching at least a vertex using its vertex(s). But how does it implies that the side length of square is at least $\frac{144}{\sqrt{193}}$? I mean, a square which touches the triangle with its vertex may have a shorter side length, but why is there no square with side length even shorter (doesn't touch the triangle using its vertex)? Why do we need only to consider these three cases?

Any help will be appreciate! Thank you.

Tony Ma
  • 2,358
  • 2
    I find your analysis pretty compelling. It might make it clearer to reverse the roles to fix a square of (say) unit size, and within it consider moving and enlarging a triangle with fixed aspect ratio (as the specified right triangle for example). It will be shown that the longest side and hypotenuse wind up in a corner of the square in order that each side of the square "touches" the triangle (otherwise the triangle could be moved and expanded further). I'll try my hand at writing something up for you. – hardmath May 04 '19 at 02:59
  • Okay, thank you. – Tony Ma May 04 '19 at 03:03
  • @hardmath Excuse me, but how is it going? – Tony Ma May 05 '19 at 02:15
  • Hi, Tony... I was actually just thinking about the write-up! – hardmath May 05 '19 at 02:20
  • um... sorry for misunderstanding :) – Tony Ma May 05 '19 at 02:21

5 Answers5

8

Geometric argument

Let's start with a geometric approach that reverses the roles of the square and the triangle, fixing a (say) unit square and finding the largest right triangle with sides in proportion to 5:12:13 that can fit within.

Clearly the largest such triangle would touch the square's perimeter, since otherwise the triangle can be uniformly enlarged. Indeed there must be at least two vertices in contact, since if there were only one vertex on the perimeter, we could expand the triangle from that vertex.

For some triangle shapes placing just two vertices in contact with the perimeter gives the largest triangle, namely for those shapes where the longest side can be placed along a diagonal of the square and the third vertex falls inside one or the other half of the square. A picture of a semicircle drawn on the diagonal of the square should convince us that among right triangles, only the isosceles right triangle can be be so positioned. Thus the 5:12:13 triangle will not fit in that way.

Building on this, we claim (A) that the largest triangle with this 5:12:13 shape will have all three vertices on the square's perimeter and (B) that such a triangle will touch all four sides of the square. We will briefly sketch arguments for both claims, motivated by noting that from these it follows one of the triangle's vertices must touch upon two sides of the square, i.e. at a corner of the square.

Claim A: The cases of zero or one vertex being on the square's perimeter have already been sufficiently described. Suppose exactly two vertices are on that perimeter, e.g. the endpoints of one edge of the triangle. Here are the possible cases:

  1. Both endpoints on a common edge of the square. If not the entire edge, then the triangle can be enlarged to cover more of it or cause the third vertex to touch the square's perimeter. If it is then entire edge, the triangle can be rotated about one of these endpoints (having an acute angle), lifting the other endpoint off the perimeter.

  2. The two endpoints are incident to adjacent edges of the square (but not as in case 1). Except when this edge coincides with the square's diagonal (previously ruled out), the triangle can again be rotated about one of these endpoints to lift the other endpoint off the perimeter.

  3. The two endpoints are incident to opposing edges of the square (but not as in case 2). The triangle can be rotated about the midpoint of that edge (since neither is in a corner of the square). lifting both away from the perimeter.

Of course once the number of vertices on the perimeter is reduced, the triangle can be enlarged until vertices again meet the perimeter. The largest possible 5:12:13 triangle will thus have all three vertices on the square's perimeter.

Claim B: We sketch an argument valid for all right triangles, noting that it falls short when applied to (strictly) acute triangles. Suppose a 5:12:13 (right) triangle has all three vertices on the perimeter of the square. In order to enlarge it (without touching all four sides), we intend to rotate the triangle so that one vertex moves inside the square, after which claim A can be applied.

If the triangle does not touch a pair of opposing sides, i.e. it touches at most a pair of adjacent sides of the square, then we can already enlarge it until an opposing side is reached. So without loss of generality we may assume the triangle touches all but one of the four sides of the square. To make a mental image, assume it is the top edge of the square untouched by the triangle.

We've already mentioned that the isoceles right triangle can be maximized by aligning it with the square's diagonal, and of course in this position it touches all four edges. Now assuming we have another kind of right triangle, it must be a scalene triangle (all sides are different lengths). For convenience we can refer to the short leg, the longer leg, and the (longest) hypotenuse.

The possibilities can be classified by asking where the right angle of the triangle touches the square. (1) It might be in a corner of the square (bottom edge), so that the longer leg is actually shared with the square's bottom edge. (2) It might be in the interior of the square's bottom edge. (3) It might be on the left or right edge of the square (but not in the corner).

In case (1) the triangle can be rotated "up" from the bottom edge around the vertex where the shorter leg and hypotenuse of the triangle meet.

In case (2) the triangle can be rotated "up" from the bottom edge around whichever vertex on the left or right edge is lower (either of them if they are at the same height).

In case (3) the triangle can be rotated "up" around the right angle vertex (whether it touches the left or the right side of the square).

Some pictures will of course be helpful here to supplement the mental image, and I will try to find time to post them.

Now, as previously remarked, the claims A and B suffice to force one of the vertices of the triangle to coincide with a corner of the square (because we have the three triangle vertices touching the four edges of the square). A little thought shows further that this can only be accomplished if the vertex of the triangle with the smallest angle (opposite the shortest leg) is the one incident with a corner of the square.

With that observation we are nearly finished determining the largest (similar) 5:12:13 right triangle that can be fitted into (say) a unit square. Indeed the Question itself presents an image of that arrangement. Instead of providing the calculations here, I will instead provide a more rigorous computation involving the so-called rotating calipers approach.

hardmath
  • 37,015
  • Thank you for detailed geometric argument,I think that's what I want...It's just that I could not yet understand."Of course once the number of vertices on the perimeter is reduced, the triangle can be enlarged until vertices again meet the perimeter."Why does it show that the triangle should have vertices all on perimeter? I mean,couldn't it be that I enlarge and then the triangle still have only 2 vertices on perimeter,so on and so on?Btw,last sentence,"rotating calipers approach"-is it the name of the approach in this post?My grammar is poor as you said "I will". – Tony Ma May 08 '19 at 08:58
  • If it's because every time it enlarges so as the area increases but the area is bounded... infinite product could be finite... – Tony Ma May 08 '19 at 09:13
  • By "rotating calipers" I mean a different approach, analytic rather than geometric. I'll add it to the end for comparison. – hardmath May 08 '19 at 12:57
  • How about what I asked above? – Tony Ma May 08 '19 at 12:59
  • The first part of the claims is that if the right triangle has fewer than three vertices on the boundary, then it is not as big as possible. – hardmath May 08 '19 at 13:17
5

Let us solve the general problem of fitting any given right triangle into a minimal enclosing square.

Place it like in the following diagram so that WLOG $b$ is the shortest leg and $B$ is at the origin:

enter image description here

Note the gray enclosing rectangle parallel to the axes. Finding the minimal enclosing square corresponds to minimizing the longest side of this rectangle. In our analysis, the following observations can be utilized:

  • We only need consider $90^\circ$ degrees rotation since after that the axes-parallel rectangles essentially repeat the same pattern (this was already noted in the more general related question).
  • We know that $a$ is a candidate side length for the minimal enclosing square, so we need not consider the cases where $A$ exceeds above the line $y=a$.
  • As the triangle rotates away from the $x$-axis, the height of the gray rectangle increases while the width decreases.

Now we can describe the rotated triangle via the unit vectors as shown in the diagram: $$ \color{red}{ \mathbf e_1= \begin{bmatrix} t\\ \sqrt{1-t^2} \end{bmatrix} } \qquad\text{and}\qquad \color{darkgreen}{ \mathbf e_2= \begin{bmatrix} -\sqrt{1-t^2}\\ t \end{bmatrix} } $$ In the relevant region (where $A$ is below $y=a$), we can deduce that the gray rectangle has the following dimensions: $$ \begin{align} \text{width}&=at\\ \text{height}&=a\sqrt{1-t^2}+bt \end{align} $$ And so we can find the minimal square by solving: $$ \text{width}=\text{height}\iff at=a\sqrt{1-t^2}+bt $$ which can be solved for $t$: $$ t=\frac{a}{\sqrt{a^2+(a-b)^2}} $$ and so the minimal square has side length: $$ \text{width}=at=\frac{a^2}{\sqrt{a^2+(a-b)^2}} $$ Finally, plugging in $a=12,b=5$ yields: $$ \text{width}=\frac{144}{\sqrt{193}} $$ As a last comment, note that in case $a=b$ the formula yields $\text{width}=a$ which is correct for that case too, so this covers all cases for right angled triangles.

Tony Ma
  • 2,358
String
  • 18,395
  • Sorry... I do know that if the vertex of smallest angle touches a vertex of square, the best way is when $\text{square width}=\frac{144}{\sqrt{193}}$. What I don't know (how to prove) is that why does it need to be placed at the corner of square (or origin, in this analysis here). – Tony Ma May 08 '19 at 09:47
  • @TonyMa: The point of my analysis is that it considers minimal enclosing rectangles for all relevant rotations of the triangle. This includes the cases where $B$ is not in a corner of that rectangle (namely when $A$ is rotated beyond the $y$-axis). So it makes no such assumption. – String May 08 '19 at 09:50
  • But why must the enclosing rectangles have sides parallel to axes? – Tony Ma May 08 '19 at 09:52
  • @TonyMa: Because we fix the orientation of the rectangles and rotate the triangle instead. To put it differently, if we enclose a triangle with sides $a,b,c$ in a rectangle, the side $a$ must be at a non-obtuse angle to one of the sides of that rectangle. This analysis runs through all possible angles $[0^\circ,90^\circ]$. – String May 08 '19 at 09:55
  • Alright... let me think... – Tony Ma May 08 '19 at 10:03
  • What does WLOG stand for? –  Jun 29 '23 at 18:57
  • @SnackExchange Without Loss Of Generality. There is no loss when assuming that the shortest side has a particular name rather than the other name, since such an assumption is symmetric. – String Jul 01 '23 at 13:40
  • @String I suspect there aren't any minimum side length of a rational number for any square which cover right triangles with integer side lengths. Am I true? –  Jul 08 '23 at 00:47
  • @SnackExchange Well, if I understand you correctly, then you are asking if the formula for the width could yield a rational number. This could indeed be the case as long as $a^2+(a-b)^2$ is a rational square. The easiest example would be if $a,b$ are integers, so for instance $a=4,b=1$ which renders the sum equal to $5^2=4^2+(4-1)^2$. Any Pythagorean triple will work: $(a,x,c)$ is a triple such that $$a^2+x^2=c^2\iff a^2+(a-b)^2=c^2$$ where $b=a-x$. – String Jul 08 '23 at 07:09
  • @String But with two sides of the right triangle to be $4$ and $1$, the hypotenuse will have an irrational length of $\sqrt{17}$. But I stated "right triangles with integer side lengths" in my previous comment (e.g. Pythagorean triples). –  Jul 08 '23 at 08:18
  • @SnackExchange Ah, sorry! My bad. You may indeed be correct! – String Jul 08 '23 at 08:27
4

This answer shows that $\frac{144}{\sqrt{193}}$ is the smallest possible side length.

(This is an answer to the question "why is it the smallest possible square covering the triangle?", but I have to say that this is not an answer to the question "Why do we need only to consider these three cases?". Anyway, I hope this helps.)


Let $A(0,0), B(5,12), C(5,0)$.

First, let us consider the condition that three points $A,B,C$ exist between two parallel lines $L_1$ and $L_2$ whose slope is $\tan\theta\ (0\lt \theta\lt\frac{\pi}{2})$ where the distance between $L_1$ and $L_2$ is $d$.

We may suppose that $L_1$ passes through $C$, so we may write $$L_1 : y=\tan\theta\ (x-5),\qquad L_2 : y=\tan\theta\ x+\frac{d}{\cos\theta}-5\tan\theta$$

The condition that three points $A,B,C$ exist between $L_1$ and $L_2$ is $$0\le \tan\theta\times 0+\frac{d}{\cos\theta}-5\tan\theta\quad \text{and}\quad 12\le\tan\theta\times 5+\frac{d}{\cos\theta}-5\tan\theta,$$ i.e. $$\sin\theta\le\frac d5\quad\text{and}\quad \cos\theta\le\frac{d}{12}\tag1$$


Next, let us consider the condition that three points $A,B,C$ exist between two parallel lines $L_3$ and $L_4$ whose slope is $\tan(\theta+\frac{\pi}{2})\ (0\lt \theta\lt\frac{\pi}{2})$ where the distance between $L_3$ and $L_4$ is $d$.

We may suppose that $L_3$ passes through $A$, so we may write $$L_1 : y=\tan\left(\theta+\frac{\pi}{2}\right)x,\qquad L_2 : y=\tan\left(\theta+\frac{\pi}{2}\right)x+\frac{d}{\sin\theta}$$

The condition that three points $A,B,C$ exist between $L_3$ and $L_4$ is $$0\le \tan\left(\theta+\frac{\pi}{2}\right)\times 5+\frac{d}{\sin\theta}\quad \text{and}\quad 12\le\tan\left(\theta+\frac{\pi}{2}\right)\times 5+\frac{d}{\sin\theta},$$ i.e. $$\cos\theta\le\frac d5\quad\text{and}\quad 12\sin\theta+5\cos\theta\le d\tag2$$


Finally, let us prove that if there exists a pair of $(d,\theta)$ satisfying both $(1)$ and $(2)$, then $d\ge \frac{144}{\sqrt{193}}$.

We have $$\small\begin{align}&(1)(2)\\\\&\implies\cos\theta\le\frac{d}{12}\quad\text{and}\quad \sqrt{1-\cos^2\theta}\le\frac{d-5\cos\theta}{12} \\\\&\implies \cos\theta\le\frac{d}{12}\quad\text{and}\quad 1-\cos^2\theta\le \frac{d^2-10d\cos\theta+25\cos^2\theta}{144} \\\\&\implies \cos\theta\le\frac{d}{12}\quad\text{and}\quad 169\cos^2\theta-10d\cos\theta+\color{blue}{d^2-144}\ge 0 \\\\&\implies \frac{5d+12\sqrt{169-d^2}}{169}\le \cos\theta\quad\text{and}\quad \cos\theta\le\frac{d}{12} \\\\&\left(\because\ \text{we already know that $d=\frac{144}{\sqrt{193}}\approx 10.4$ is possible, so we may suppose that $\color{blue}{d^2-144}\lt 0$}\right) \end{align}$$

In order for such $\theta$ to exist, we have to have $$\begin{align}&\frac{5d+12\sqrt{169-d^2}}{169}\le \frac{d}{12} \\\\&\implies\sqrt{169-d^2}\le\frac{109}{144}d \\\\&\implies 169-d^2\ge 0\quad\text{and}\quad 169-d^2\le \left(\frac{109}{144}d\right)^2 \\\\&\implies 0\lt d\le 13\quad\text{and}\quad d\ge\frac{144}{\sqrt{193}} \\\\&\implies \frac{144}{\sqrt{193}}\le d\le 13\qquad\blacksquare\end{align}$$

mathlove
  • 139,939
4

We work with a right triangle having legs $a\geq b$ and hypotenuse $c$. Its angles then satisfy $$0<\beta\leq{\pi\over4}\leq\alpha<\pi\ .$$ We circumscribe rectangles around this triangle, starting with the black rectangle in the figure. This rectangle is either turned to the right by an angle $\psi\in[0,\beta]$ (drawn as red rectangle), or is turned to the left by an angle $\phi\in[0,\alpha]$ (drawn as blue rectangle).

enter image description here

These red or blue rectangles are covered by squares of side lengths $$s(\psi)=\max\{c \cos\psi, b\cos(\beta-\psi)\}=c\max\{\cos\psi, \sin\beta\cos(\beta-\psi)\}\qquad(0\leq\psi\leq\beta)\ ,\tag{1}$$ resp., $$s(\phi)=\max\{c\cos\phi, a\cos(\alpha-\phi)\}=c\max\{\cos\phi,\sin\alpha\cos(\alpha-\phi)\}\qquad(0\leq\phi\leq\alpha)\ .\tag{2}$$ Since $\beta\leq{\pi\over4}$ we know that for $\psi\in[0,\beta]$ one has $$\cos\psi\geq\cos\beta\geq\sin\beta\geq\sin\beta\cos(\beta-\psi)\ ,$$ so that $(1)$ gives $s(\psi)=c\cos\psi\geq c\cos\beta$.

Since $\alpha\geq{\pi\over4}$ the first entry $\cos\phi$ on the RHS of $(2)$ is monotonically decreasing in the interval $0\leq\phi\leq\alpha$ from $1$ to $\cos\alpha$. At the same time the second entry $\sin\alpha\cos(\alpha-\phi)$ is monotonically increasing from $\sin\alpha\cos\alpha<1$ to $\sin\alpha\geq\cos\alpha$. It follows that $s(\phi)$ is minimal at the unique point $\phi_*\in[0,\alpha]$ where these two graphs intersect: When $\phi<\phi_*$ then $s(\phi)=\cos\phi>s(\phi_*)$, and when $\phi>\phi_*$ then $s(\phi)=\sin\alpha\cos(\alpha-\phi)>s(\phi_*)$.

Solving $$\cos\phi=\sin\alpha\cos(\alpha-\phi)\tag{3}$$ leads to $$\tan\phi_*={1-\sin\alpha\cos\alpha\over\sin^2\alpha}\ .$$ From $(3)$ we obtain $\cos\phi_*\leq\sin\alpha=\cos\beta$. This makes sure that by choosing $\phi=\phi_*$ we obtain a smaller square than with choosing the $\psi$-side treated before. Therefore the smallest square has side length $$s(\phi_*)=c\cos\phi_*=c{\sin^2\alpha\over\sqrt{1-2\sin\alpha\cos\alpha+\sin^2\alpha}}={a^2\over\sqrt{c^2-2ab+a^2}}\ .$$ For $(a,b,c)=(12,5,13)$ one obtains $s(\phi_*)={144\over\sqrt{193}}$.

2

The task standing contains solution with the square side $z<12.$ This means that the optimal solution achieves when the vertex B is in corner of the square and the points $A,C$ are on the different sides of the square.

Let WLOG $$B=(0,0),\quad A=(x,z),\quad C=(z,y),$$ then the optimal solution should satisfy the conditions in the form of


$$ \begin{cases} x,y\in(0,z]\\ x^2+z^2 = 169\\ (z-x)^2+(z-y)^2=25\\ z^2+y^2=144. \end{cases} \tag1 $$


The system $(1)$ can be resolved: $$\begin{cases} 2(x+y)z = 288\\ x^2-y^2 = 25\\ z^2+y^2=144 \end{cases} \quad\rightarrow\quad \begin{cases} (x+y)z = 144\\ 144(x-y)z=25z^2\\ z^2+y^2=144, \end{cases}$$ $$\begin{cases} 288yz = 144^2-25z^2\\[4pt] 288^2(144-z^2)z^2 = (144^2-25z^2)^2\\[4pt] z^2>\dfrac{13}{\sqrt2}, \end{cases}$$ $$83569 z^4 - 12980736 z^2 + 429981696 = 0,$$ $$(313z^2-20736)^2-120z^4=0,$$ with the correct solution ($x\in(0,z]$)

$$\color{green}{\mathbf{z=\dfrac{144}{\sqrt{193}}}}.$$


I,e., OP solution presents the single minimum.

I think this consideration solves the given problem.

  • 1
    It is nice that the question is algebraic-fied, but I could attain the same result $z=\frac{144}{\sqrt{193}}$ by trigonometric means and then plug in the $x,y,z$ value and it is the only set of solution. But what I want is not a solution, but a formal proof... – Tony Ma May 08 '19 at 09:35
  • @TonyMa In addition, the absence of other minima has been proven. In fact, I was going to solve an optimization problem, but constraints did not allow ... – Yuri Negometyanov May 08 '19 at 10:34