Let $X \subseteq \mathbb{A}^n$ be algebraic, and let $x$, $y \in \mathbb{A}^n - X$. How do I see that there exists $f \in I(X)$ with $f(x) \neq 0$ and $f(y) \neq 0$.



Exists $f \in I(X)$ such that $f(x) \neq 0$, $f(y) \neq 0$
Given an affine scheme $S=\operatorname {Spec (R)} $ and a closed subscheme $T=V(J)\subset S$, the restriction mapping $$\mathcal O(S)=R\to \mathcal O(T)=R/J$$ is obviously surjective.  

Applying this to $S=\mathbb A^n, T=X\cup \{x,y\}$ and taking for $f\_0\in \mathcal O(T)$ the function equal to $0$ on $X$ and $1$ on $x$ and $y$, we see that we can extend $f\_0$ to a regular function $f\in \mathcal O(\mathbb A^n)$, which will thus satisfy the requested conditions. 


**Remark**  

The trivial but useful surjectivity result in the first sentence is the algebraic geometers' version of the [Tietze extension theorem](https://en.wikipedia.org/wiki/Tietze_extension_theorem), an analogy sadly not mentioned in algebraic geometry books.


