Let $Y$ be an open subset of the irreducible topological affine $n$-space $\mathbb{A}^n$. Why is it that we have the claim $$Z(I(Y))=\overline{Y},$$ with $\overline{Y}$ the closure of $Y$, and $I(...)$ mapping from the subsets of $\mathbb{A}^n$ to the polynomial ring $A$ over an algebraically closed field $k$ and $Z(...)$ mapping to the common zeros in $\mathbb{A}^n$ of a subset polynomials in $A$? As the open subset $Y$ is dense in $\mathbb{A}^n$, the closure is in fact $\mathbb{A}^n$. What is the argument which leads to $Z(I(Y))=\mathbb{A}^n$? It seems slightly confusing that the common zeros of $\forall f\in I(Y^c)$ where $Y^c$ denoting the closed complement of $Y$ are also common zeros of $I(Y)$. What is the deeper reason for that claim?
In the definition by Hartshorne in his book on algebraic geometry, p. 3, $I(Y)$ is defined as the ideal of $Y$ in $A$, but I am not sure whether this presupposes a closed set as an input of the map $I(...)$. What happens if you apply $I(...)$ to an open subset in $\mathbb{A}^n$?
The elements of $I(Y)$ are polynomials that are zero on all of $Y$. But $Y$ is dense in $\mathbb{A}^n$, so by continuity, such a polynomial is identically zero, that is, $I(Y) = \{0\}$. In general, we can talk about $I(S)$ where $S$ is any subset of $\mathbb{A}^n$, and the same continuity argument shows $I(S) = I(\overline{S})$.