Lemma 29.7.5. Let $j : U \to X$ be an open immersion of schemes. Then $U$ is scheme theoretically dense in $X$ if and only if $\mathcal{O}_ X \to j_*\mathcal{O}_ U$ is injective.

Proof. If $\mathcal{O}_ X \to j_*\mathcal{O}_ U$ is injective, then the same is true when restricted to any open $V$ of $X$. Hence the scheme theoretic closure of $U \cap V$ in $V$ is equal to $V$, see proof of Lemma 29.6.1. Conversely, suppose that the scheme theoretic closure of $U \cap V$ is equal to $V$ for all opens $V$. Suppose that $\mathcal{O}_ X \to j_*\mathcal{O}_ U$ is not injective. Then we can find an affine open, say $\mathop{\mathrm{Spec}}(A) = V \subset X$ and a nonzero element $f \in A$ such that $f$ maps to zero in $\Gamma (V \cap U, \mathcal{O}_ X)$. In this case the scheme theoretic closure of $V \cap U$ in $V$ is clearly contained in $\mathop{\mathrm{Spec}}(A/(f))$ a contradiction. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).