Square $AXYZ$ is inscribed in equiangular hexagon $ABCDEF$ with $X$ on $\overline{BC}$, $Y$ on $\overline{DE}$, and $Z$ on $\overline{EF}$. Suppose that $AB=40$, and $EF=41(\sqrt{3}-1)$. What is the side-length of the square? [asy] size(200); defaultpen(linewidth(1)); pair A=origin,B=(2.5,0),C=B+2.5*dir(60), D=C+1.75*dir(120),E=D-(3.19,0),F=E-1.8*dir(60); pair X=waypoint(B--C,0.345),Z=rotate(90,A)*X,Y=rotate(90,Z)*A; draw(A--B--C--D--E--F--cycle); draw(A--X--Y--Z--cycle,linewidth(0.9)+linetype("2 2")); dot("$A$",A,W,linewidth(4)); dot("$B$",B,dir(0),linewidth(4)); dot("$C$",C,dir(0),linewidth(4)); dot("$D$",D,dir(20),linewidth(4)); dot("$E$",E,dir(100),linewidth(4)); dot("$F$",F,W,linewidth(4)); dot("$X$",X,dir(0),linewidth(4)); dot("$Y$",Y,N,linewidth(4)); dot("$Z$",Z,W,linewidth(4)); [/asy] (diagram by djmathman)
First, we want to angle chase. Set $<YXC$ equal to $a$ degrees. Now the key idea is that you want to relate the numbers that you have. You know $\overline{AB} = 40$ and that $\overline{EZ} + \overline{ZF} = 41(\sqrt{3}-1)$. We proceed with the Law of Sines. Call the side length of the square x. Then we are going to set a constant k equal to $\frac{\sin 120^{\circ}}{x}$, and this is consistent for every triangle in the diagram because all the angles of the hexagon are equiangular (and so they are all $120^{\circ}$). Then we get the following process: \[\frac{\sin(90-a)}{40} = k\] \[\cos a = 40k\] \[\frac{\sin(a-30)}{\overline{EZ}} = k\] \[\sin(a-30) = \overline{EZ}\cdot k\] \[\frac{\sin(60-a)}{\overline{ZF}} = k\] \[\sin(60-a) = \overline{ZF}\cdot k\] \[\sin(a-30) + \sin(60-a) = k\cdot 41(\sqrt{3}-1)\] And now expanding using our trig formulas, we get: \[(\sin a + \cos a)(\frac{\sqrt{3}-1}{2} = k\cdot 41(\sqrt{3}-1)\] \[\sin a + \cos a = 82k\] \[\sin a = 42k\] And so now we have a triangle where $\cos a = 40k$ and $\sin a = 42k$. Put them in a triangle where the hypotenuse is 1. Then, by the Pythagorean Theorem, we get: \[\sqrt{(40k)^2 + (42k)^2} = 1\] \[3364k^2 = 1\] \[k = \frac{1}{58}\] And since $k = \frac{\sin(120^{\circ})}{x}$, then: \[x = \frac{\sqrt{3}}{2}\cdot58\] \[x = \fbox{29\sqrt{3}}\] Solution by IronicNinja