Artificial intelligent assistant

If $X$ and $Y$ are subspaces of $Z$, $X \cong Y$ and $X$ is a retract of $Z$, is $Y$ also a retract of $Z$? If $X$ and $Y$ are subspaces of $Z$, $X \cong Y$ and $X$ is a retract of $Z$, is $Y$ also a retract of $Z$? I think the answer is no, but I can't find a counterexample. Can anyone help me with this?

You sure need some more conditions, otherwise there are trivial examples. Say you allow $Z$ be not connected (as you have). Then pick any spaces $Y\subseteq Z_0$ such that $Y$ is NOT a retract of $Z_0$. Pick such a space so that points are closed sets, that should not be a problem. Then take an isomorphic copy of $Y$ and call it $X$, and add it to the space $Z_0$ as a new component to obtain $Z$.

Then $Y$ is not a retract of $Z$: assume otherwise, and let $f$ be a a retraction of $Z$ onto $Y$. The restriction of $f$ to $Z_0$ would be a retraction of $Z_0$ onto $Y$.

But $X$ is a retract of $Z$: define the retraction as the identity on $X$ (obviously). Furthermore, pick any $x\in X$, and define the retraction on $Z_0$ as the constant $x$ function. This is continuous, as the pre-image of any closed set is closed.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c56e32f44ca6fc5ef2c62610d2ccea1d