Smallest square to cover a right triangle 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:
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.
 A: 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:


*

*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.

*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.

*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.
A: 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:

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.
A: 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}$$
A: 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).

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}}$.
A: 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\\
25z = 144(x-y)\\
z^2+y^2=144
\end{cases}
\quad\rightarrow\quad
\begin{cases}
x+y = t^{-1}\\
x-y=25t\\
144(144t^2-1)+y^2=0, 
\end{cases}$$
where $$z = 144t.\tag2$$
Then 
$$(t^{-1}-25t)^2 + 576(144t^2-1)=0,$$
$$(1-25t^2)^2 +576t^2(144t^2-1) = 0,$$
$$83569t^4 - 626t^2+1=9,$$
$$(193t^2-1)(433t^2-1)=0,$$
with the correct solution ($x\in(0,z]$)
$$t=\dfrac1{\sqrt{193}},$$

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

I,e., OP solution presents the single minimum.
I think this consideration solves the given  problem.
