TITLE: How fat is a triangle?
QUESTION [17 upvotes]: The slimness factor of a geometric shape in 2 dimensions is the ratio between the side-length of its smallest containing square and its largest contained square. This is an important factor in computational geometry. So the slimness of a square is 1, the slimness of a circle is $\sqrt 2$, but what is the slimness factor of a given triangle?
After trying unsuccessfully to solve this geometrically, I decided to try a purely analytical solution. Here it is:
The triangle
The fatness obviously does not depend on scale. Hence two parameters are sufficient to define the triangle. I choose as parameters an angle $\theta$ adjacent to the longest side and the ratio $D$ between the side next to that angle and the longest side.  We have to find the fatness as a function of $\theta$ and $D$.
Normalize the triangle so that its longest side lies on the x axis, between $(0,0)$ and $(1,0)$. Define $\theta$ as the angle at the origin. Rotate the triangle such that $\theta$ is between $0^\circ$ and $90^\circ$. For brevity, let $C=\cos \theta$ and $S=\sin \theta$. $D$ is the length of the side starting at the origin, so that the 3rd vertex of the triangle is at $(DC,DS)$, where $0<D<1$, $0\leq C<1$ and $0\leq S<1$.
The slimness factor should be calculated as a function of the parameters $D$, $C$ and $S$. 
The containing square
Consider the unit square $[0,1]\times[0,1]$. We want to transform it so that it contains the triangle. A general transformation of a point $(x,y)$ is: $(rcx+rsy+h, rsx-rcy+v)$ where: $r$ is the dilation factor, $s$ and $c$ are sine and cosine of the rotation angle (we can assume they are both in $[0,1]$ because of the rotational symmetry of the square), $h$ is horizontal translation and $v$ is vertical translation. So a general transformation of the unit square has the following corners:

$(h,v)$
$(rc+h,rs+v)$
$(rs+h,-rc+v)$
$(rc+rs+h, rs-rc+v)$

and the following sides:

$s(x-h)=c(y-v)$
$s(x-h-rs)=c(y-v+rc)$ which is the same as $s(x-h)=c(y-v)+r$
$c(x-h)=-s(y-v)$
$c(x-h-rc)=-s(y-v-rs)$ which is the same as $c(x-h)=-s(y-v)+r$

In order to contain the triangle, each vertex $(x,y)$ of the triangle must be in the 4 half-planes defined by the 4 sides of the square:

$c(y-v)\leq s(x-h)\leq c(y-v)+r$
$-s(y-v)\leq c(x-h)\leq -s(y-v)+r$

Now, substitute each of the 3 vertices of the triangle and get, for $(0,0)$, $(1,0)$ and $(DC,DS)$ respectively:

$-cv\leq -sh\leq -cv+r$
$sv\leq -ch\leq sv+r$
$-cv\leq s-sh\leq -cv+r$
$sv\leq c-ch\leq sv+r$
$c(DS-v)\leq s(DC-h)\leq c(DS-v)+r$
$-s(DS-v)\leq c(DC-h)\leq -s(DS-v)+r$

There are a total of 12 inequalities here. Our goal is to find the smallest $r$ such that there are $c,s,h,v$ satisfying all these 12 inequalities.
Removing some redundant inequalities and ordering, we get:

$r\geq s+cv-sh$
$cv-sh\geq 0$
$r\geq c-ch-sv$
$-ch-sv\geq 0$
$r\geq s(DC-h)-c(DS-v)=sDC-cDS+cv-sh$
$r\geq c(DC-h)+s(DS-v)=cDC+sDS-ch-sv$

To make $r$ as small as possible, we should select $h$ and $v$ such that inequalities 2 and 4 become zero. Then we remain with the following inequalities which $r$ must satisfy:

$r\geq s$
$r\geq c$
$r\geq cDC+sDS$

Here I am stuck: how can I solve this optimization problem?
The contained square
Again consider the unit square $[0,1]\times[0,1]$. Now we want to transform it so that it is contained in the triangle. The 4 corners of the square must satisfy the 3 inequalities dictated by the sides of the triangle, which are:

$y\geq 0$
$xDS\geq yDC$
$(1-x)DS\geq (1-DC)y$

Substituting the 4 corners of the square gives the following 12 inequalities which r must satisfy, some of which are redundant:

$-rc+v\geq 0$
$v\geq 0$ (redundant)
$rs+v\geq 0$ (redundant)
$rs-rc+v\geq 0$ (redundant)
$hDS\geq vDC$
$(rc+h)DS\geq (rs+v)DC$
$(rs+h)DS\geq (-rc+v)DC$ (redundant)
$(rc+rs+h)DS\geq (rs-rc+v)DC$ (redundant)
$(1-rc-h)DS\geq (1-DC)(rs+v)$
$(1-h)DS\geq (1-DC)v$ (redundant)
$(1-rc-rs-h)DS\geq (1-DC)(rs-rc+v)$
$(1-rs-h)DS\geq (1-DC)(-rc+v)$ (redundant)

These imply the following 5 inequalities (note that this time the direction of the inequalities is inversed because we are looking to maximize $r$ subject to the inequalities):

$cr \leq v$
$0\leq hDS-vDC$
$(sDC-cDS)r  \leq hDS-vDC$
$(s-sDC+cDS)r\leq DS-v-hDS+vDC$
$(s-c-sDC+cDC+sDS+cDS)r\leq DS-v-hDS+vDC$

Here, again, I am stuck...
The last step is just to divide the two $r$'s, but, how do I find each $r$?
Note
I am looking for a formula that gives fatness as a function of $\theta$ and $D$. However, if you think there is another pair of parameters by which it is more convenient to represent the fatness (e.g. the two smaller angles), then this is also welcome.

REPLY [2 votes]: After all those appetizer comments of mine, the OP himself is asking for : what formula describes the slimness of a triangle, based on Steiner Ellipses?
So it's time to feed some meat to the public :-)
Needed for the Steiner ellipse, or best fit ellipse, or ellipse of inertia (they are
all similar) are the variances (in statistics terms) of moments of inertia (in physics
terms). To calculate the latter, there are three possibilities:

Simplest case: all triangle weight is in the vertices $(x_1,y_1),(x_2,y_2),(x_3,y_3)$
The triangle consists of three rods and all weight is in there
The triangle is cut from a plate and the weight is distibuted uniformly over its area

The area point of view has been worked out in the reference
Steiner Ellipses and Variances.
At the last page of this reference is also the important statement that the best fit ellipse of
a triangle is an inertial ellipse and is the inner Steiner ellipse.
For simplicity, we shall adopt the weight at vertices case here. See the reference, or work out the second case yourself, if you want otherwise.
$$
\mu_x = (x_1+x_2+x_3)/3 \quad ; \quad
\mu_y = (y_1+y_2+y_3)/3 \\
\sigma_{xx} = (x_1^2+x_2^2+x_3^2)/3 - \mu_x^2 =
\frac{2}{9}(x_1^2+x_2^2+x_3^2-x_1x_2-x_1x_3-x_2x_3) \\
\sigma_{yy} = (y_1^2+y_2^2+y_3^2)/3 - \mu_y^2 =
\frac{2}{9}(y_1^2+y_2^2+y_3^2-y_1y_2-y_1y_3-y_2y_3) \\
\sigma_{xy} = \left[(x_1-\mu_x)(y_1-\mu_y)+(x_2-\mu_x)(y_2-\mu_y)+(x_3-\mu_x)(y_3-\mu_y)\right]/3 = \\
\frac{1}{9}(2x_1 y_1 + 2x_2 y_2 + 2x_3 y_3 - x_1 y_2 - x_2 y_1 - x_2 y_3 - x_3 y_2 - x_1 y_3 - x_3 y_1)
$$
The best fit ellipse of inertia is:
$$
\frac{\sigma_{yy}(x-\mu_x)^2 - 2\sigma_{xy}(x-\mu_x)(y-\mu_y) + \sigma_{xx}(y-\mu_y)^2}
{\sigma_{xx}\sigma_{yy}-\sigma_{xy}^2} = 2
$$
The eigenvalues of the covariance matrix (of inertia) are related to the axes of the ellipse:
$$
\left| \begin{matrix}
\sigma_{xx}-\lambda & \sigma_{xy} \\ \sigma_{xy} & \sigma_{yy}-\lambda 
\end{matrix} \right| = 0 \qquad \Longleftrightarrow \qquad
\lambda^2 - (\sigma_{xx}+\sigma_{yy})\lambda + (\sigma_{xx}\sigma_{yy}-\sigma_{xy}^2) = 0
$$
Rename (Trace and Determinant):
$$
\mbox{Tr} = \sigma_{xx}+\sigma_{yy} \qquad ; \qquad \mbox{Det} = \sigma_{xx}\sigma_{yy}-\sigma_{xy}^2
$$
Then the solutions are (very much real and positive):
$$
\lambda_{\pm} = \mbox{Tr}/2 \pm \sqrt{\left(\mbox{Tr}/2\right)^2 - \mbox{Det}}
$$
The excentricity of the ellipse is:
$$
\epsilon = \sqrt{\frac{\lambda_{+}}{\lambda_{-}}} = \frac{\sqrt{\lambda_{+}\lambda_{-}}}{\lambda_{-}} = \frac{\sqrt{\mbox{Det}}}{\lambda_{-}} = \frac{\lambda_{+}}{\sqrt{\mbox{Det}}}
$$
Which is the formula you asked for (hopefully).
(Un)fortunately I have only a program that generates pictures for the case that the weight of the triangle is uniformly distributed over its area (which anyway seems to be the more interesting):

Update. It may be questioned if choosing one of the triangle views, as 3 vertices (1),
as 3 rods (2), as a flat plate (3), has any influence on the slimness factor.
It can be easily proved that the center of gravity / midpoint of the triangle in all three
cases is the same : $\mu_x = (x_1+x_2+x_3)/3 \; ; \; \mu_y = (y_1+y_2+y_3)/3$ .
Now define the following quantities, where it is noted that the last two can be derived
from the first one:
$$
s_{xy} = (x_1-x_2)(y_1-y_2)+(x_2-x_3)(y_2-y_3)+(x_3-x_1)(y_3-y_1) \\
s_{xx} = (x_1-x_2)^2+(x_2-x_3)^2+(x_3-x_1)^2 \quad ; \quad
s_{yy} = (y_1-y_2)^2+(y_2-y_3)^2+(y_3-y_1)^2
$$
Then the second order moments of inertia / variances in the vertex case can be rewritten as:
$\sigma_{xx} = s_{xx}/9$ , $\sigma_{yy} = s_{yy}/9$ , $\sigma_{xy} = x_{xy}/9$ .
Compare this with the quantities of the flat plate case in the abovementioned
paper .
Then it turns out that the formulas are very similar :
$\sigma_{xx} = s_{xx}/36$ , $\sigma_{yy} = s_{yy}/36$ , $\sigma_{xy} = s_{xy}/36$ .
Which means that the ellipse in the vertex case is larger than the ellipse
in the flat plate case, twice as large to be precise, because $\sqrt{36/9}=2$ . In the flate plate case, we get the Steiner Inellipse and
in the vertex case, we get the Steiner Outellipse .
For the slimness factor, this makes no difference.
EDIT. Three Rods case. If I am right with my calculated ratio $3:6:12$ (instead of Matt's $3:8:12$) then we have the following picture for the $\color{green}{vertex}$ case, the $\color{blue}{rods}$ case and the flat $\color{red}{plate}$ case.
Conclusion: The slimness factor in all three cases is the same.

Coordinate independence.
The formula for the Trace can be rewritten as follows:
$$
\mbox{Tr} \sim (s_{xx}+s_{yy})/2 = (a^2+b^2+c^2)/2
$$
Where $a,b,c$ are the lengths of the triangle edges, as usual.
The Determinant is conjectured to be proportional to the square of the area of
the triangle. MAPLE is invoked to confirm this:

A := simplify(s_xxs_yy-s_xy^2);
B := simplify(((x_2-x_1)(y_3-y_1)-(x_3-x_1)*(y_2-y_1))^2);
verify(A,3*B,equal);
                           true

Hence:
$$
\mbox{Det} \sim (s_{xx}s_{yy}-s_{xy}^2) = 3(2A)^2 = 12 A^2
$$
Where $A$ denotes the Area of the triangle.
Quoting a comment: I don't see, where are the angles of the triangle in this formula?
With Heron's formula for the area $A$ and some algebra we find with the above:
$$
\lambda_{\pm} \sim \frac{a^2+b^2+c^2}{2} \pm \sqrt{a^4+b^4+c^4-(a^2b^2+b^2c^2+a^2c^2)}
$$
The sine rule says that, with one and the same proportionality constant $K$ :
$$
a = K\sin(\alpha) \quad ; \quad b = K\sin(\beta) \quad ; \quad c = K\sin(\gamma)
$$
Since in the (square root of) the quotient $\;\lambda_{+}/\lambda_{-}\;$ any proportionality constant will
disappear, it is indeed possible to find a more "closed" formula for the Steiner based slimness factor, as a function of the angles only : simply replace $\;a,b,c\;$ by the corresponding $\;\sin(\alpha),\sin(\beta),\sin(\gamma)$ .