I am having trouble with the following homework problem, and was hoping someone could provide me with a hint: I am given a connected CW space $X$ which has a continuous associative operation $(x,\ y)\mapsto x\circ y$. It is also given that $x\circ x=x$ for any $x\in X$ and that there exists some $e\in X$ such that $x\circ e=e\circ x$ for all $x\in X$. I need to show that $X$ is contractible.
I have noted that by Whitehead's theorem, it is enough to show that all homotopy groups of $X$ vanish. So I was thinking of using the opertation $\circ$ to show that any map $f:(S^n,\sigma_0)\to (X,\ e)$ is homotopic to the constant map to $e$ (somehow this distinguished point $e$ seems suspicious).
I considered, for instance, $\phi :S^n\times I\to X$ by $(x,\ t)\mapsto f(x)\circ \gamma_x (t)$, where $\gamma_x $ is a path from $e$ to $f(x)$. At $t=0$ we get the map $x\mapsto f(x)\circ e$, and at t=1 we get the map $x \mapsto f(x)\circ f(x)=f(x)$. If somehow I knew how to choose $\phi$ to be continuous (i.e., if I knew how to choose the $\gamma_x$), and if I knew that $e\circ x=e$ for all $e$, then $\phi$ would be the desired homotopy.
But I have no idea how to make $\phi $ continuous, and see no reason why $e\circ x=e$ should hold. Furthermore, I have not yet used the associativity of $\circ$ or the fact that $e$ commutes will all points of $x$. In short, I highly doubt that I am on the right track.
Any hint would be highly appreciated!