I am currently reading Hartshorne. I don't understand why is the set of points where f - g = 0 dense in the statement below (page 3 in the book). I can see this result intuitively, but I am not sure how I can justify it.
As in the quasi-affine case, a regular function is necessarily continuous. An important consequence of this is the fact that if f and g are regular functions on a variety X, and if f = g on some nonempty open subset $U \subset X$, then f = g everywhere. Indeed the set of points where f - g = 0 is closed and dense, hence equal to X.
"The set of points where $f = g$ is dense."
This is because the set of points where $f = g$ is a non-empty open set $U \subset X$, by assumption.
Moreover, Hartshorne defines an algebraic variety to be an irreducible algebraic set.
Finally, it's a standard fact in topology that any non-empty open subset $U$ of an irreducible topological space $X$ is dense.
[For if $U$ wasn't dense, then it would be possible to find another non-empty open subset $V \subset X$ that does not intersect $U$. But then, $X \setminus U$ and $X \setminus V$ would be a pair of closed sets that cover $X$, so by the irreducibility of $X$, at least one of $X \setminus U$ or $X \setminus V$ must be the whole of $X$, which contradicts the non-emptiness of $U$ and $V$. ]