How to maximize area of a square inscribed in a equilateral triangle? We have an equilateral triangle and want to inscribe a square, in such way that maximizes the area of the square.

I sketched two possible ways, not to scale and not perfect. 
Note I am not sure if the second way will really have all square corners touching the triangle sides.
The second case appears to have bigger side-lengths of the square, so bigger area. But I do not know how to determine the angles involved. How to solve this?


Let $a_1$ and $a_2$ be the side lengths of the two squares. To determine which one is larger, we simply look at their ratio below.
With the angles in the diagram,
$$d_1=\frac{1}{2\tan 30}a_1=\frac{\sqrt{3}}{2}a_1$$
$$d_2=\frac{\sin 15}{\sin 30}a_2=\frac{1}{2\cos 15}a_2$$
Assume both equilateral triangles have unit height.
$$1=a_1+d_1=\left(1+\frac{\sqrt{3}}{2}\right)a_1=\frac{1}{2}(2+\sqrt{3})a_1$$
$$1=\sqrt{2}a_2+d_2=\left(\sqrt{2}+\frac{1}{2\cos 15}\right)a_2=\frac{1}{2}(\sqrt{2}+\sqrt{6})a_2$$
So, their ratio is
$$\frac{a_1}{a_2}= \frac{\sqrt{2}+\sqrt{6}}{2+\sqrt{3}} =\left(\frac{8+4\sqrt{3}}{7+4\sqrt{3}}\right)^{\frac{1}{2}} > 1$$
