Squares $BAXX^{'}$ and $CAYY^{'}$ are drawn in the exterior of a triangle $ABC$ with $AB = AC$. Let $D$ be the midpoint of $BC$, and $E$ and $F$ be the feet of the perpendiculars from an arbitrary point $K$ on the segment $BC$ to $BY$ and $CX$, respectively.
$(a)$ Prove that $DE = DF$ .
$(b)$ Find the locus of the midpoint of $EF$ .
### Part (a): Prove that \( DE = DF \)

1. **Identify Key Points and Angles:**
   - Let \( P = XC \cap BY \).
   - Note that \(\triangle AXC\) and \(\triangle AYB\) are congruent and isosceles.
   - Therefore, \(\angle CXA = \angle ACX = 45^\circ - \frac{A}{2}\).

2. **Angle Chasing:**
   - Since \( XA \perp AB \), we have \( \angle XAB = 90^\circ \).
   - Similarly, \( YA \perp AC \), so \( \angle YAC = 90^\circ \).
   - Using these perpendicularities and the fact that \(\triangle AXC\) and \(\triangle AYB\) are congruent, we can deduce that \( XP \perp BP \) and \( CP \perp YP \).

3. **Right Isosceles Triangle:**
   - Since \( XP \perp BP \) and \( CP \perp YP \), it follows that \( XC \perp YB \).
   - By symmetry, \( BP = CP \), making \(\triangle BPC\) a right isosceles triangle.

4. **Rectangle Formation:**
   - The quadrilateral \( KFPE \) is a rectangle because \( K \) is on \( BC \) and \( E \) and \( F \) are the feet of the perpendiculars from \( K \) to \( BY \) and \( CX \), respectively.

5. **Distance Calculations:**
   - Let \( PB = CP = a \).
   - The distance from \( D \) (midpoint of \( BC \)) to \( PB \) and \( CP \) is \( \frac{a}{2} \).
   - If the distance from \( K \) to \( PB \) is \( b \), then the distance from \( K \) to \( CP \) is \( a - b \).

6. **Projection and Right Triangles:**
   - Let \( D' \) be the projection of \( D \) onto \( PB \). The right triangle \( DD'E \) has legs of length \( \frac{a}{2} \) and \( \left| b - \frac{a}{2} \right| \).
   - Similarly, let \( D'' \) be the projection of \( D \) onto \( CP \). The right triangle \( DD''F \) has the same legs.

7. **Applying the Pythagorean Theorem:**
   - Since both right triangles \( DD'E \) and \( DD''F \) have the same legs, by the Pythagorean theorem, we have \( DE = DF \).

\(\blacksquare\)

### Part (b): Find the locus of the midpoint of \( EF \)

1. **Coordinate System Setup:**
   - Place \(\triangle BPC\) on the Cartesian plane with \( P = (0, 0) \), \( B = (a, 0) \), and \( C = (0, a) \).

2. **Coordinates of \( E \) and \( F \):**
   - For some \( x \in [0, a] \), the coordinates of \( E \) are \( (x, 0) \).
   - The coordinates of \( F \) are \( (0, a - x) \).

3. **Midpoint Calculation:**
   - The midpoint of \( EF \) is given by:
     \[
     \left( \frac{x + 0}{2}, \frac{0 + (a - x)}{2} \right) = \left( \frac{x}{2}, \frac{a - x}{2} \right)
     \]

4. **Equation of the Locus:**
   - The coordinates of the midpoint can be written as:
     \[
     \left( \frac{x}{2}, \frac{a}{2} - \frac{x}{2} \right)
     \]
   - This simplifies to the line equation:
     \[
     y = -x + \frac{a}{2}
     \]

5. **Conclusion:**
   - Therefore, the locus of the midpoint of \( EF \) is the line parallel to \( BC \) that passes through the midpoints of \( BP \) and \( CP \).

\(\blacksquare\)

The final answer is \( \boxed{ y = -x + \frac{a}{2} } \)