$\mathcal{O}_X(D) \cong \mathcal{O}_X$: Map doesn't agree on intersection Let $D$ be the Weil divisor $D = -2[(x)] + [(x-1)] + [(x-2)]$ on $\Bbb{A}^1_k = \operatorname{Spec} k[x]$. I want to show that $\mathcal{O}_X(D) \cong \mathcal{O}_X$. To do this, it is enough to specify isomorphisms $$\mathcal{O}_X(D)(D(f_i)) \to k[x]_{f_i}$$ that agree on $D(f_i) \cap D(f_j) = D(f_if_j)$. Now to do this I calculate the following:
\begin{eqnarray*} \mathcal{O}_X(D)(D(x^2)) &=& k[x]\cdot \frac{1}{(x-1)(x-2)} \\
\mathcal{O}_X(D)(D(x-2)) &=& k[x] \cdot \frac{x^2}{(x-1)} \\
\mathcal{O}_X(D)(D(x-1)) &=& k[x]\cdot \frac{x^2}{(x-2)} \\
\mathcal{O}_X(D)(D(f(x))) &=& k[x]\cdot \frac{x^2}{(x-1)(x-2)f(x)}\end{eqnarray*}
where $f$ is not one of the earlier three polynomials. Now I want to say that the map out of $\mathcal{O}_X(D)D(x^2)$ is multiplication by $(x-1)(x-2)/x^2$ and the map out of $\mathcal{O}_X(D)D(x-2)$ is mutiplication by $(x-1)/(x^2(x-2))$. However on the intersection which is $D((x-2)x^2)$, the maps don't seem to agree. What's the problem here?
 A: If $\phi$ is the rational function $\phi=\frac {(x-1)(x-2)}{x^2}$, the sheaf $\mathcal O_X(D)$ is exactly equal to $\frac {1}{\phi}\mathcal O_X= \frac {x^2}{(x-1)(x-2)}\mathcal O_X$  .
Notice that we have an equality , not  just an isomorphism.
This means more precisely that on open subsets $U\subset \mathbb A^1_k$   we have the equality 
$$\Gamma(U,\mathcal O_X(D) )=  (\frac {1}{\phi|U})\cdot\Gamma(U,\mathcal O_X)      $$
So the natural isomorphism $\mathcal O_X(D)  \stackrel {\cong}{\to} \mathcal O_X$ is the isomorphism of sheaves $$\phi \cdot :  \mathcal O_X(D)  \stackrel {\cong}{\to} \mathcal O_X        $$ given on  open subsets $U\subset \mathbb A^1_k$ by $$\Gamma(U,\mathcal O_X(D) )\to   \Gamma(U,\mathcal O_X): s\mapsto \phi|U \cdot s = \frac {(x-1)(x-2)}{x^2} \cdot s$$  
Your equalities however  seem not to be correct: for example $\mathcal{O}_X(D)(D(f)) = k[x]\cdot \frac{1}{f}$ is not true and must be replaced by $\mathcal{O}_X(D)(D(f)) = \frac {x^2}{(x-1)(x-2)}\cdot k[x,\frac {1}{f(x)}]  $   
Conclusion
This is the kind of  questions where it is  essential to carefully distinguish between equality and isomorphism.
