I have the following problem that I am stuck on.
Let $A$ be a subspace of $X$ and let $Y$ be a non-empty topological space. Show that $A\times Y$ is a retract of $X\times Y$ if and only if $A$ is a retract of $X$.
My work so far:
$(\Rightarrow)$ Assume that $A\times Y$ is a retract of $X\times Y$. Then there exists a continuous map $r:X\times Y\to A\times Y$ such that $r|_{A\times Y}=\mathrm{id}_{A\times Y}$. In other words, $r(a,y)=(a,y)$ for all $(a,y)\in A\times Y$. Then $r=\mathrm{id}_{A}\times\mathrm{id}_{Y}$, so $A$ is a retract of $X$ through the map $\mathrm{id}_{A}$.
I don't think any of this is right, and I am super confused in how to show the result. Thanks in advance for any help!