Artificial intelligent assistant

$A\times Y$ is retract of $X\times Y$ iff $A$ is retract of $X$ 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!

Suppose $A\times Y$ is a retract of $X\times Y$. We want to show that $A$ is a retract, which means finding a continuous function $f:X\to A$ such that $f|_A=\operatorname{id}_A$. Since $A\times Y$ is a retract of $X\times Y$, we have a continuous function $r:X\times Y\to A\times Y$ such that $r|_{X\times Y}=\operatorname{id}_{A\times Y}$. Since $Y$ is nonempty, we can find $y_0\in Y$. Then define $f(x)=\pi_1(r(x,y_0))$ for every $x\in X$, where $\pi_1:X\times Y\to X$ denotes the projection. Verify that $f$ is continuous and that it is a retraction.

Conversely, suppose $A$ is a retract of $X$. Then there exists a retraction $r:X\to A$. Can you think of a way to define a retraction $f:X\times Y\to A\times Y$? Let me know if you get stuck and I'll add more.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6e7fb6ad19bb5bedcf087d3e907f7c7e