TITLE: Show that a retract of a Hausdorff space is closed.
QUESTION [20 upvotes]: A subspace $A \subset X$ is called a retract of $X$ if there is a map $r: X \rightarrow A$ such that $r(a) = a$ for all $a \in A$. (Such a map is called a retraction.)
Proof. Let $x \notin A$ and $a =r(x) \in A$. Since $X$ is Hausdorff, $x$ and $a$ have disjoint neighborhoods $U$ and $V$, respectively. Then $r^{−1}(V \cap A) \cap U$ is a neighborhood of $x$ disjoint from $A$. (*) Hence, $A$ is closed.
I do not understand how  "$r^{−1}(V \cap A) \cap U$ is a neighborhood of $x$ disjoint from $A$" implies that $A$ is closed. I would be grateful if someone could point me in te right direction.

REPLY [2 votes]: Why $r^{-1}(V\cap A)\cap U$ is disjoint from $A$?
$$
\begin{array}{rcl}
y\in r^{-1}(V\cap A)\cap U & \Leftrightarrow & y\in\{ z\in X: r(z)\in V\cap A \}\cap U \\
& \Leftrightarrow & y\in\{ z\in U: r(z)\in V\cap A \}.
\end{array}
$$
So $y\notin A$. If the opposite was true $\;$($y\in A$)$\;$ it should be $y\in U \Rightarrow r(y)\in U$, $\;$but $r(y)\in V\cap A\subset V$ and $U\cap V=\varnothing$.