I'm beginning to learn algebraic topology from Hatcher, and I'm trying to get an intuitive grasp on homotopy equivalence. Hatcher says these two shapes are homotopy equivalent:
Let's call the left one A and the right one B. I can easily see visually how to "stretch" A to get B, but I'm having trouble understanding how to apply the actual, formal definition of homotopy equivalence.
Specifically, we need continuous functions $f : A\to B$ and $g : B\to A$ such that $fg$ is homotopic to $id_B$ and $gf$ is homotopic to $id_A$. But I can't really see how to do this. For $g$, we can map the whole vertical bar of $B$ (including the endpoints) to the point at the center of $A$, and the other parts of $B$ besides the vertical bar to the round parts of $A$ in the obvious way. This is continuous. But what can we do for a continuous $f$, such that the compositions $fg$ and $gf$ are homotopic to the identity maps?