Hartshorne exercise about sheaves on $\mathbb{P}^1$
Solution 1:
Fix $f\in K$ and $P\in\mathbb P^1$. You are looking for a $g\in K$ such that
$g\in\mathcal O_Q$ for all $Q\neq P$, and
$f-g\in\mathcal O_P$.
The first condition means that $g$ has poles only possibly at $P$. The second, that the difference $f-g$ does not have poles at $P$. In other words, $g$ is the singular part of $f$ at $P$. So to construct $f$ we may write the partial fraction decomposition of $f$ and drop all terms with a pole at a point different from $P$.
Solution 2:
Here's what my solution was when I took the course:
We know that $\Gamma(X,\mathcal{O})=\mathcal{O}(X) = k$ by Theorem I.3.4; we also have $\Gamma(X,K) = K(X) = k(x)$, also by Theorem I.3.4. Finally, again by Theorem I.3.4, with $k(x)/k[x^{-1}]_{(x^{-1})}$ corresponding to the point at infinity, we have $$\Gamma(X,K/\mathcal{O}) = k(x)/k[x^{-1}]_{(x^{-1})} \oplus \bigoplus_{\alpha\in k}k(x)/k[x]_{(x-\alpha)}.$$ The claim is that $$0\to k\to k(x) \to k(x)/k[x^{-1}]_{(x^{-1})}\oplus\left(\bigoplus_{\alpha\in k} k(x)/k[x]_{(x-\alpha)}\right)\to 0$$ is exact; and this just means showing the last map is surjective.
Note: The basic idea was okay, but it was poorly phrased here. Part of it seems to have been some previous exercises in that homework. I'm rephrasing.
Fix $P$ and let $f+\mathcal{O}_{P}\in K/\mathcal{O}_{P}$ be a nonzero entry. Using a partial fraction decomposition we can write $$f + \mathcal{O}_P = \sum_{i=1}^n f_i + \mathcal{O}_P$$ where each $f_i$ is such that $$\frac{1}{f_i} = \lambda_i\pi^{n_i}$$ with $\lambda_i\in K$, $\pi$ a uniformizer of $\mathcal{O}_P$, and $n_i\gt 0$. E.g., for $\mathcal{O}_0$, you can find scalars $a_0,\ldots,a_k$ such that $f+\mathcal{O}_p = \frac{a_0}{x} + \cdots + \mathcal{a_k}{n^k} + \mathcal{O}_p$. Now let $$ g = \sum_{i=1}^n \frac{1}{\lambda_i}\pi_i^{-n_i}\in K(X).$$ Then $g$ maps to $0$ in $K/\mathcal{O}_Q$ for any $Q\neq P$, and since $$\lambda_i\pi_i^{-n_i} = \frac{1}{f_i}$$ then $$g\equiv \sum_{i=1}^n f_i \equiv f\pmod{\mathcal{O}_p}$$ so $g\in K(x)$ maps to the element that has $f$ in the $P$-component, and zeroes elsewhere. Since these elements generate $$k(x)/k[x^{-1}]_{(x^{-1})}\oplus\left(\bigoplus_{\alpha\in k} k(x)/k[x]_{(x-\alpha)}\right)$$ this shows the last map is surjective.