This is the gap in Harthsorne's Corollary II.6.17. I'm following the advice of this answer from before on the same question. I'm going to call $X = \mathbb{P}_k^n = \operatorname{Proj} k[x_0, \dots, x_n]$ for a field $k$. Following the proof of II.6.11, to find the resulting cartier divisor it suffices to show that the divisor $V(x_0)$ is a locally principal. I'm not sure how to find the cartier divisor of $\mathcal{O}(1)$ so showing it is equivalent to the one formed by $V(x_0)$ is confusing.
What is the Cartier divisor associated to $\mathcal{O}(1)$ and why is it linearly equivalent to the carrier divisor associated to the hyperplane $V(x_0)$.
My Attempt:
Each $D_+(x_i) \cong \operatorname{Spec} k[x_0/x_i, \dots, x_n/x_i]$ is the spectrum of a UFD so it $V(x_0) \cap D_+(x_i)$ principal with its corresponding ideal in $k[x_0/x_i, \dots, x_n/x_i]$ being $(x_0/x_i)$ for $i \neq 0$ and $(1)$ for $i = 0$. (I'm not too sure about this step but I'm pretty sure it works.)
Hence, its cartier divisor is $$D = \{(D_+(x_i), x_0/x_i)\}$$ with the corresponding open cover $D_+(x_i)$. Next, we want to find the Cartier divisor $D'$ associated to $\mathcal{O}(1)$. On each $D_+(x_i)$, its global sections are the degree 1 part of the localization $k[x_0, \dots, x_n]_{x_i}$. I'm not sure what the generator here would be and I'm not sure how to use the fact that $\mathcal{O}(1)$ is generated by global sections. I think it would be $x_i$ since the canonical isomorphism $S_{(f)} \to S(n)_{(f)}$ is given by $s \mapsto f^n s$. [see II.5.12(a)]
If $D' = \{(D_+(x_i), 1/x_i)\}$ is indeed the associated carrier divisor, then $D - D' = \{(D_+(x_i), x_0)\}$, and I'm not so sure why this is principal. Namely, $x_0$ is not in the function field which is made of fractions of the same degree.
How would you resolve this and find the correct cartier divisor associated to $\mathcal{O}(1)?$
Thanks!
EDIT: This answer alleges to answer my question as well but I don't understand how the last paragraph leads to the conclusion.
I will also add that my expression of $D'$ does not really define a Cartier divisor... after all, $1/x_i$ is of degree $-1$ and hence not an element of the function field of $\mathbb{P}^n_k$, since the function field is made up of rational functions of degree $0$.