Hartshorne Exercise II.6.1 Proving that $\operatorname{Cl}(X\times\mathbb{P}^n)\cong \operatorname{Cl}(X)\times \mathbb{Z}$. I have been stuck on this computation for some time (at least a year now since I started learning AG seriously).
The trick is to use Proposition II.6.5 and take the closed set $Z$ to be the hyperplane at $\infty$ to get a sequence
$$
\mathbb{Z}\rightarrow \operatorname{Cl}(X\times \mathbb{P}^n)\rightarrow \operatorname{Cl}(X\times\mathbb{A}^n)\cong \operatorname{Cl}(X)\rightarrow 0
$$
with an inductive application of Proposition II.6.6. Now we prove that there is a section of the map on the right $\operatorname{Cl}(X\times \mathbb{P}^n)\rightarrow \operatorname{Cl}(X\times\mathbb{A}^n)$. To complete the proof, it then suffices to show that the left hand side map is injective. Here, I am stuck since I cannot seem to find a description of the closed set $Z$ and the generic point of $X\times\mathbb{P}^n$.
I've looked explanation like this but it flew over my head and wasn't really enlightening. Any thoughts / suggestions?
 A: $\def\ClGrp{\operatorname{Cl}} \def\PP{\mathbb{P}} \def\ZZ{\mathbb{Z}} \def\AA{\mathbb{A}}$
To show $\ClGrp(X\times\PP^n)\cong (\ClGrp X)\times\ZZ$, we use the exact sequence of proposition II.6.5.
Let $i:X\times\PP^{n-1}\to X\times\PP^n$ be the closed immersion with image $X\times V(T_0)$, and $j:X\times\AA^n\to X\times\PP^n$ be the open immersion with image $X\times D(T_0)$.
By proposition II.6.5, we have an exact sequence $$ \ZZ\cdot (X\times\PP^{n-1}) \to \ClGrp(X\times\PP^n) \to \ClGrp(X\times\AA^n) \to 0$$ and the third item is exactly $\ClGrp(X)$ by repeated applications of proposition II.6.6.
It remains to show that the first map is injective and the exact sequence splits.
Let $Z$ denote the image of $i:X\times\PP^{n-1}\to X\times\PP^n$.
If $aZ$ is a principal divisor, then $aZ\cap \PP^n_{k(X)}$ must also be a principal divisor: the nonzero function in $k(X\times\PP^n)$ cutting out $aZ$ is also a nonzero function in $k(\PP^n_{k(X)})$ which cuts out the divisor $aZ\cap \PP^n_{k(X)}$.
So to show that $aZ$ cannot be principal for any $a\neq 0$, it suffices to show that $aZ\cap \PP^n_{k(X)}$ is not principal for any $a$.
Suppose that $aZ\cap \PP^n_{k(X)}$ is principal for some $a\neq 0$, and let $f\in k(X\times\PP^n)$ be a rational function with divisor $aZ\cap \PP^n_{k(X)}$.
Looking at $\AA^n_{k(X)} = D(T_0)\subset \PP^n_{k(X)}$, we see that since the valuation of $f$ is zero at every codimension one point by assumption, we must have that $f$ and $1/f$ are both in the localization of $k(X)[t_1,\cdots,t_n]$ at every height one prime.
Therefore by proposition II.6.3A, $f$ and $1/f$ belong to $k(X)[t_1,\cdots,t_n]$ and are units in that ring.
As the only units in a polynomial ring over a field are the nonzero elements of the field, we have that $f\in k(X)^\times$, so its valuation in the local ring of $V(T_0)$ is zero.
Thus $aZ$ is not a principal divisor for any $a\neq 0$ and the map $\ZZ\cdot (X\times\PP^{n-1}) \to \ClGrp(X\times\PP^n)$ is injective.
We can define a splitting of $\ClGrp(X\times\PP^n) \to \ClGrp(X\times\AA^n)$ by writing a map $\ClGrp(X)\to \ClGrp(X\times\PP^n)$ given on prime divisors by sending $D_i$ to $D_i\times\PP^n$ and composing with the isomorphism $\ClGrp(X\times\AA^n) \to \ClGrp(X)$ from proposition II.6.6.
This map sends a prime divisor $D_i\subset X$ to $D_i\times \PP^n$ and then $D_i\times\AA^n$ and finally back to $D_i$ by construction, so this is a splitting, and by a general lemma from homological algebra this splitting gives that $\ClGrp(X\times\PP^n)\cong \ClGrp(X)\times\ZZ$ and we're finished.
