What is the locus of a variable point inside a square? Recently, I have been reading about Euclidean geometry, specifically loci, and I came across this problem:
"An equilateral triangle XYZ is inscribed inside a square ABCD such that X lies on AB, Y lies on BC, and Z lies on CD. As XYZ varies, the midpoint of XY traces out a set of points. What is this locus, and prove your assertion."
I am currently stumped on this problem, and I have a vague suspicion that the locus is part of a circle, but I do not have an idea of how to show this, or how to describe exactly how much of the circle is traced out, or where the possible center is. Does anyone have any insight on how to solve this?
 A: Adding just a visual hint for now, in order to address the first part of the problem (i.e. to construct those equilateral triangles):

Moving relevant comments into the answer:


*

*If $XYZ$ is an equilateral triangle meeting the wanted constraints, $Z$ is the image of $Y$ with respect to a counter-clockwise $60^\circ$ rotation centered at $X$, hence $Z$ lies at the intersection of $CD$ and the image of $BC$ with respect to the previous rotation. These segments do not always intersect, hence $X$ has to be picked in a neighbourhood of $A$. Once $X$ and $Z$ have been constructed $Y$ can be taken as the intersection between $BC$ and the perpendicular bisector of $XZ$;

*You may assume that $B$ is the origin, $A=(0,1)$ and $C=(1,0), X=(0,y)$. Then you may compute $Z=(1,f(y))$ and $Y=(g(y),0)$. In order to prove that the midpoint of $XY$ lies on a segment, it is enough to show that both $f(y)$ and $g(y)$ are linear functions, but that is pretty evident.


Addendum: you may also notice that the midpoint of $XZ$ is always the same point.
This leads to a simplified & improved diagram:

Now an approach without explicit coordinates. Let $E$ be the point inside $ABCD$ such that $BCE$ is equilateral. Given any $X\in AB$ sufficiently close to $A$, let $Z=XE\cap CD$ and let $Y$ be the intersection between $BC$ and the perpendicular bisector of $XZ$. It is not difficult to show that $XYZ$ is equilateral: indeed, $XY=YZ$ by construction, and since both $XEYB$ and $EZCY$ are cyclic quadrilaterals,
$$\widehat{XYE}=\widehat{XBE}=30^{\circ}=\widehat{ZCE}=\widehat{ZYE}$$
so $\widehat{XYZ}=60^\circ$. The midpoint of $XY$ is the circumcenter of $XEYB$, so it is constrained to lie on the perpendicular bisector of $BE$ and the wanted locus is a segment.
A: Let $[0,s]^2$ be the square, let $\angle(BXY)=:\alpha$,  and let $2a$ be the side length of the triangle. If $(x,y)$ are the coordinates of the point $M$  in question then
$$s=2a\sin(\alpha +60^\circ),\quad x=a\sin\alpha,\quad y= a\cos\alpha\ .$$
It follows that
$$x+\sqrt{3}y=2a\left({1\over2}\sin\alpha+{\sqrt{3}\over2}\cos\alpha\right)=s\ .$$
This shows that $M$ lies on a falling line through the point $C$ making an angle $30^\circ$ with the horizontal axis.
