A square inside an equilateral triangle

As $DF=DE\sqrt 2$ and the angle $\angle EDF=45^{\circ},$ the point $F$ is obtained from $E$ through the rotation composed with the homothety (common center $D$, angle and ratio as above).

Construct in this transformation the image of the side that should contain $E.$ Its intersection (if it exists) with the side that doesn't contain $D$ is $F.$ enter image description here


Let

the vertex of the triangle between $D$ and $E$ be $A$

and

the vertex of the triangle between $E$ and $F$ be $C$

Let the length of the side of the triangle be $a$

length of the side of the square be $u$

$\angle ADE = \theta$ (therefore, $\angle EFC = \frac{5 \pi}{6} - \theta$)

length of $AE$ be $x$, therefore length of $CE$ is $a-x$

length of $AD$ be $y$

Then consider the triangle $ ADE$ and use Sine rule:

$\displaystyle \frac{u}{\sin \frac{\pi}{3}} = \frac{x}{\sin \theta} = \frac{y}{\sin \left(\frac{2 \pi}{3} - \theta \right)}$ ........ (1)

Next consider triangle $CEF$ and use Sine rule:

$\displaystyle \frac{u}{\sin \frac{\pi}{3}} = \frac{a-x}{\sin \left( \frac{5 \pi}{6} - \theta \right)}$ ........ (2)

All the above quantities of (1) and (2) are equal to

$\frac{a}{\sin \theta + \sin \left( \frac{5 \pi}{6} - \theta \right)}$

[Ratio of the sum of the numerators and denominators of $\frac{x}{\sin \theta}$ and $\frac{a-x}{\sin \left( \frac{5 \pi}{6} - \theta \right)}$]

Hence

$\displaystyle u = \frac{a \sin \frac{\pi}{3}}{\sin \theta + \sin \left( \frac{5 \pi}{6} - \theta \right)}$

$\displaystyle x = \frac{a \sin \theta}{\sin \theta + \sin \left( \frac{5 \pi}{6} - \theta \right)}$

$\displaystyle y = \frac{a \sin \left(\frac{2 \pi}{3} - \theta \right)}{\sin \theta + \sin \left( \frac{5 \pi}{6} - \theta \right)}$

Note:

  1. Suppose only $y$ is known. You can easily find $\theta$ and then calculate $u$ and $x$

  2. Not all the values of $y$ are admissible. For example, if $y > \sqrt{3} a$, then the equation does not have any solution. Practically, $0 \leq y \leq a$