Some questions on Hartshorne III Ex 6.8 I have been looking at Hartshorne III exercise 6.8 for nearly a week now and I don't seem to have a clue as to how to do it. In particular, I am stuck on part (a) which boils down to showing the following.


Let $X$ be integral, separated and locally factorial. Let $U$ be any open neighbourhood of a closed point $x$. Suppose that $Z := X- U$ is irreducible with generic point $\zeta$. Then there is a line bundle $\mathcal{L}$ and $s \in H^0(X,\mathcal{L})$ with $x \in X_s \subseteq U$. 


Now I have convinced myself using separatedness of $X$ that we may choose a rational function $f$ with the property that $f \in \mathcal{O}_{X,x}$ and $f \notin \mathcal{O}_{X,\zeta}$. With this, we immediately deduce that for any $z \in Z$, $f \notin \mathcal{O}_{X,z}$ because we have an injection
$$ \mathcal{O}_{X,z} \hookrightarrow \mathcal{O}_{X,\zeta}.$$
Edit:
Ok here is an argument which I think works. It is not hard to see that $$H^0(X,\mathcal{L}(D)) = \{ f \in K(X)^\ast : div(f) + D \geq 0\} \cup \{0\},$$ i.e. all rational functions whose poles are no worse than $D$. Sitting inside of this is the canonical rational section $s$ corresponding to $1 \in K(X)^\ast$. Now I want to say that this $s$ has zeros wherever $f$ has a pole. When I look at a concrete example I can see this is true. If I look at $\Bbb{A}^1$ and $D= (f)_{\infty}$ for $f = 1/(x-1)(x-2)$, then 
$$\mathcal{L}(D) = \frac{1}{(x-1)(x-2)} \mathcal{O}_X$$
and the canonical section $1$ corresponds to $\frac{1}{(x-1)(x-2)} \times (x-1)(x-2).$ This "shows" wherever $f$ has a pole, $s$ has a zero. This is enough to conclude that $Z \subseteq V(s)$ because $f \notin \mathcal{O}_{X,z}$ for all $z \in Z$.
But now we are on an arbitrary scheme satisfying the conditions in the beginning, so:


My question is:  How can we make rigorous the idea that wherever $f$ has a pole $s$ has a zero? Also, where do we use the locally factorial hypothesis? Is it just to make that $\mathcal{L}(D)$ be invertible?
Added: Can someone elaborate on what exactly this "canonical section" $1 \in H^0(X,\mathcal{L}(D))$ is?


 A: Regarding the section $1$ of of $\mathcal L(D)$, I have discussed this here, but it won't hurt to recall some
of the ideas again.
To understand this, 
I think it helps to first consider how to convert an arbitrary line bundle (with a section) into one of the form $\mathcal L(D)$.
So, start with a line bundle $\mathcal L$ and a (regular --- but this is equivalent to non-zero when the base is integral) section $s$,
cutting out an effective Cartier divisor $D$ as its zero locus.
Now suppose that $s'$ is any other section of $\mathcal L$.  The ratio
$s'/s$ is then a rational function on the base $X$, and furthermore it has poles
contained in $D$ (because away from $D$ the section $s$ doesn't vanish,
and so the ratio $s'/s$ is actually a regular function, not just a rational one).
Conversely, if $f$ is a rational function whose poles are contained in $D$,
then $f s$ is a well-defined section of $\mathcal L$ (the possible poles of $f$ are cancelled out by the fact that $s$ vanishes along $D$).
Thus we get an isomorphism between the space of sections of $\mathcal L$,
and the space of rational functions whose poles are contained in $D$.
Furthermore, the original section $s$ maps to the rational function $1$.
Conversely, if we start with an effective Cartier divisor $D$, we can
make it the zero section of a line bundle by reversing the above construction:
we are going to declare that the sections of the line bundle are the rational functions that have poles contained in $D$ (this actually makes sense,
because we can first of all restrict our attention to some open subset $U \subset X$ just by intersecting $D$ with $U$ and talking about rational functions
on $U$ with poles contained in $U \cap D$, so we really are describing a
sheaf).
That we get an invertible sheaf follows from the fact that $D$ is a Cartier
divisor.  And now a little thought shows that the rational function $1$,
when we think of it as a section of the bundle $\mathcal L(D)$ we have
just constructed, does vanish precisely along $D$.
Incidentally, I think this is one of the really amazing constructions in algebraic geometry: that beginning just with a divisor, which is a very specific, localized object, you can produce the much more amorphous line bundle $\mathcal L(D)$ out of it, which together with the associated section $s$
gives back $D$, and whose other sections describe all the ways of deforming $D$ (in its linear equivalence class).  And conversely, given something amorphous like a line bundle, by choosing a section you can convert it into something much more specific and hands-on: a particular divisor $D$.
