How does the filled square retract to three of its boundary lines? In Example 0.15 of Allen Hatcher's Algebraic Topology, he uses the fact that, for $I = [0,1]$, $I \times I$ retracts to $(I \times \left\{ 0 \right\}) \cup (\partial I \times I)$. At first this seemed obvious, but I'm having a hard time constructing an actual retraction. For example $f(s,t) = \begin{cases} (0,t), s\leq 1/2 \\ (1,t), s> 1/2 \end{cases}$ if $t>0$ wouldn't work because it isn't continuous. Nor would fixing a point in the interior of $I\times I$ and doing something similar to the retraction of the punctured space $\mathbb{R}^n$ to $S^{n-1}$, because we wouldn't know where to send that point. So what would be a retraction?
 A: The easiest way is to do it in two stages.
First stage: get to the one-point union of two triangles, one with vertices $(0,0),(0,1),(\frac12,0)$ and the other $(1,0),(1,1),(\frac12,0)$.  This is just "pulling down" along $y$-direction for the half we want to vacate.
Second stage: retract for each triangle to the relevant edges.  This is just pulling in, e.g., direction $(\pm m,-1)$ where $m>\frac12$.
A: I'm not sure whether there's a cleaner way to do it, but taking a detour via a semicircle provides one way to see that a retraction exists.
Let $\phi$ be a homeomorphism from the filled square to a filled semicircle, which maps the three boundary lines which we wish to retract onto to the curved edge of the semicircle, and the final edge to the diameter of the semicircle (hopefully it's clear that this exists, but I can expand a bit here if it's not obvious)
Then to retract from the semicircle to its boundary we can project every point in a direction perpendicular to the diameter until they hit the boundary of the semicircle
Explicitly, if our semicircle was $\{(x,y) ∈ \mathbb{R}^2 | x^2 + y^2 = 1, y \geq 0 \}$ then $(x,y)\mapsto (x, \sqrt{1-x^2})$ suffices as a retraction
If we call this semicircle retraction $r'$, then $\phi^{-1}\circ r'\circ\phi$ should be a valid retraction for the square case
