Non-contractible space, but all maps are homotopic

algebraic-topologygeneral-topologyhomotopy-theory

I am being asked to find a NON CONTRACTIBLE space $X$ such that, for any path-connected space $Y$ and any continuous maps $f,g : X \rightarrow Y$, $f$ and $g$ are homotopic.

I have thought that I definitely cannot pick $X$ to be path-connected, since otherwise picking $Y = X$, $f = Id_X$ and $g$ a constant map, I would obtain that $X$ is contractible. That said I am not too sure where to look for an actual example.

The classic example of a space that is not contractible but has trivial fundamental group, $S^2$, also cannot work here, since degree of maps is a homotopy invariant and clearly many different degree maps exist!

Any help appreciated!

Best Answer

You are overcomplicating things. The space you are looking for is... $\{1,2\}$ or any discrete space with at least two points. Note that a contractible space has to be connected.

As for why $\{1,2\}$ satisfies your condition I leave it as an exercise.