About the proof of the existence of a decomposition of subset of $\mathbb{A}^n$ The following is the proposition 7.4.11 in
"Advanced Topics in Linear Algebra" by Kevin O'meara et.al.

Proposition 7.4.11
Every subset $X$ of $\mathbb{A}^n$ has a decomposition
  $X = X_1 \cup X_2 \cup \cdots \cup X_k$
  as a union of irreducible closed subsets $X_i$ of $X$ with $X_i \not\subset 
 X_j$ for $i \neq j$. This decomposition
  is unique up to the order of the terms.

I can't understand the proof of the existence of the decomposition.
In the first step, it is proven for the case that $X$ is closed.
This part is clear to me. 
Then, in the next step, it is proven in the original condition.

Now given an arbitrary subset $X$ of $\mathbb{A}^n$, its Zariski
  closure $Y$ has a decomposition into irreducible closed subsets $Y_1, Y_2, \cdots, Y_k$.
  Taking $X_i = X \cap Y_i$ then gives $X$ as a finite union of irreducible closed subsets $X_i$ of $X$.

Why can $X_i$ be said to be irreducible ?
Is it to say that the Zariski closure of $X_i$ is $Y_i$ ?
But, it doesn't seem true to me.
Any help would be appreciated.
 A: I'm not sure if the cited argument can be repaired. Nonetheless, the claim is true. First, note that $\mathbb{A}^n$ is a noetherian topological space, in the sense that every strictly descending chain of closed subspaces must be finite. This is a straightforward consequence of the fact that a polynomial ring over a field is noetherian as a ring.
Proposition. Let $X$ be a topological space. The following are equivalent:


*

*$X$ satisfies the descending chain condition for closed subsets.

*$X$ satisfies the ascending chain condition for open subsets.

*Every subspace of $X$ is quasicompact.
Proof. Clearly, (1) and (2) are two different ways of saying the same thing. Assume (2). Let $Y$ be any subset of $X$, let $\mathfrak{U}$ be a family of open subsets of $X$, and suppose $Y \subseteq \bigcup_{U \in \mathfrak{U}} U$. Choose a well-ordering of $\mathfrak{U}$ and consider the sequence of partial unions:
$$U_0 \subseteq U_0 \cup U_1 \subseteq \cdots $$
By the ascending chain condition, there is some $n$ such that $U_n = \bigcup_{U \in \mathfrak{U}} U$, thus we have the required finite subcover of $Y$.
Conversely, suppose every subset of $X$ is quasicompact. Consider an ascending chain of open subsets of $X$:
$$U_0 \subseteq U_1 \subseteq U_2 \subseteq \cdots$$
By hypothesis, $U = \bigcup_n U_n$ is quasicompact, and $\{ U_0, U_1, U_2, \cdots \}$ is an open cover of $U$; but then there must be a finite subcover, so the ascending chain condition for open subsets of $X$ is satisfied. 　◼
Condition (3) immediately implies:
Corollary. Any subspace of a noetherian topological space is again a noetherian topological space.
Proposition. Any noetherian topological space admits a decomposition into finitely many irreducible components.
Proof. Let $X$ be a noetherian topological space. Since $X$ satisfies the descending chain condition for closed subsets, the inclusion relation on the set of closed subsets of $X$ is well-founded, so we may apply well-founded induction. Clearly, the empty set is a union of finitely many irreducible closed subsets – after all, zero is a finite number. Suppose $Y$ is a closed subset such that every proper closed subset is a union of finitely many irreducible subsets. Then, either $Y$ is irreducible, or $Y = Z \cup W$ for two proper closed subsets $Z$ and $W$. By the induction hypothesis, $Z$ and $W$ is a union of finitely many irreducible subsets, so $Y$ is as well. By induction, every closed subset of $X$ is as a union of finitely many irreducible subsets – and $X$ is closed in $X$, so it too is a union of finitely many irreducible subsets. 
It remains to be shown that $X$ can be written as a union of finitely many irreducible components. Consider the set of all irreducible subsets of $X$, partially ordered by inclusion. This is a chain-complete poset: indeed, if
$$Y_0 \subseteq Y_1 \subseteq Y_2 \subseteq \cdots$$
is a chain of irreducible subsets of $X$, and $Y = \bigcup_n Y_n \subseteq Z \cup W$ for some closed subsets $Z$ and $W$ but $Y \nsubseteq W$, then for some $n$ we have $Y_n \nsubseteq W$; but by irreducibility $Y_m \subseteq Z$ for all $m \ge n$, so $Y \subseteq Z$, and therefore $Y$ is irreducible.
Moreover, any maximal irreducible subset is closed. Indeed, let $Y$ be any irreducible subset of $X$, and consider $\overline{Y}$. Let $U$ be an open set such that $U \cap \overline{Y}$ is non-empty; then $U \cap Y$ is also non-empty, since $Y$ is dense in $\overline{Y}$. Since $Y$ is irreducible, any closed set $Z$ such that $U \cap Y \subseteq Z \cap Y$ must satisfy $Z \cap Y = Y$. In particular, any closed set $Z$ such that $U \cap \overline{Y} \subseteq Z \cap \overline{Y}$ must have $Y \subseteq Z$, and so $\overline{Y} \subseteq Z$ too, as required. Thus, every irreducible subset of $X$ is contained in a maximal irreducible closed subset, a.k.a. an irreducible component. It follows that $X$ is a union of finitely many irreducible components.　◼
A: The set $X_i$ is indeed irreducible. 
Let us first show that $X_i$ is dense in $Y_i$. Let $Y_i^\circ=Y_i\setminus \cup_{j\ne i} Y_j$. This is a non-empty open subset of $Y$ contained in $Y_i$, hence dense in $Y_i$ because $Y_i$ is irreducible. This implies that for any non-empty open subset $U$ of $Y_i$, $U\cap Y_i^\circ$ is non-empty. As $X$ is dense in $Y$, and $U\cap Y_i^{\circ}$ is open in $Y_i^{\circ}$ hence open in $Y$, $(U\cap Y_i^{\circ})\cap X\ne\emptyset$. Hence 
$$U\cap X_i = (U\cap Y_i)\cap X\supseteq (U\cap Y_i^{\circ})\cap X$$
is non-empty and $X_i$ is dense in $Y_i$. 
As a general fact, any dense subset $T$ in an irreducible topological space $S$ is irreducible: if $T=F_1\cup F_2$ with two proper closed subsets, we have $F_i=Z_i\cap T$ for some closed subsets $Z_i$ of $S$. As $Z_1\cup Z_2$ is closed and dense in $S$, it is equal to $S$. So, say, $Z_1=S$. But then $F_1=T$. Contradiction. 
To see that $X_1,\dots, X_k$ are exactly the irreducible components of $X$, it remains to see that $X_i$ is not contained in $X_j$ if $i\ne j$. But otherwise  $Y_i$ is contained in $Y_j$ again by the density of $X_i$ in $Y_i$. 
Note that the only property of $Y$ we need is it has finitely many irreducible components. 
