Relationship between the ideal of an effective Cartier divisor and its invertible sheaf Let $X$ be a scheme. We'll assume it's noetherian to avoid any pathologies. Let $D$ be an effective Cartier divisor on $X$. I am having trouble understanding how to go between the language of invertible sheaves, ideal sheaves, and effective Cartier divisors. I want to be able to go between the following two ideas:

*

*An effective Cartier divisor as a pair $(\mathcal{L}, s)$ where $\mathcal{L}$ is an invertible sheaf and $s$ is a regular section (i.e a section $s \in \Gamma(X, \mathcal{L})$ whose corresponding morphism $\mathcal{O}_{X} \longrightarrow \mathcal{L}$ is injective).


*An effective divisor as a sheaf of ideals ${I}_{D} \subseteq \mathcal{O}_{X}$ which is locally generated by a single non-zerodivisor.
I know these two sheaves should be inverses of eachother. In particular, beginning with an ideal sheaf $\mathscr{I}_{D}$ as in (2), considering the dual $\mathscr{Hom}_{\mathcal{O}_{X}}(\mathscr{I}_{D}, \mathcal{O}_{X})$, we have an obvious choice for a regular section which is just given by the inclusion $\mathscr{I}_{D} \hookrightarrow \mathcal{O}_{X}$.
However, I am not as comfortable going from (1) to (2). Given an invertible sheaf and regular section $(\mathcal{L}, s)$, I want to define a sheaf of ideals $\mathscr{Hom}_{\mathcal{O}_{X}}(\mathcal{L}, \mathcal{O}_{X})$. The problem is I don't see any obvious way to realise this as a subsheaf of $\mathcal{O}_{X}$.
The obvious choice is to define a morphism $\mathscr{Hom}_{\mathcal{O}_{X}}(\mathcal{L}, \mathcal{O}_{X}) \rightarrow \mathcal{O}_{X}$ by evaluation at the section $s$ of $\mathcal{L}$ but I see no reason that morphism should be injective.
Is there any way to see this easily so I can translate between the two ideas?
 A: Suppose $U\subseteq X$ is an open subset on which $\mathcal{L}$ is trivial. It is enough to show that the map
\begin{align*}
e(U) : \mathscr{H}om(\mathcal{L},\mathcal{O})(U)&\to\mathcal{O}(U)\\
\phi &\mapsto \phi\circ s(1)
\end{align*}
is injective for any such $U.$ (By the way, make sure you convince yourself that this is indeed enough -- a morphism of sheaves $\mathcal{F}\to\mathcal{G}$ on a space $X$ such that $\mathcal{F}(U)\to\mathcal{G}(U)$ is injective for all $U$ in some open cover of $X$ need not be an injective morphism of sheaves!)
On $U,$ we have $$\mathscr{H}om(\mathcal{L},\mathcal{O})(U) =\operatorname{Hom}(\left.\mathcal{L}\right|_U,\mathcal{O}_U) \cong\operatorname{Hom}(\mathcal{O}_{U},\mathcal{O}_{U})\cong\mathcal{O}(U).$$ The final isomorphism here is given by $\phi\mapsto\phi(1).$
So, now we're looking at a map
$$
\mathcal{O}(U)\to\mathcal{O}(U),
$$
and to describe such an $\mathcal{O}(U)$-module map, it suffices to specify where $1$ goes. Under the isomorphism $\operatorname{Hom}(\mathcal{O}_{U},\mathcal{O}_{U})\cong\mathcal{O}(U),$ $1$ corresponds to the identity morphism. So, we must compute $e(U)(\operatorname{id}),$ which is the image of $1\in\mathcal{O}(U)$ under the composition
$$
\mathcal{O}(U)\xrightarrow{s}\mathcal{L}(U)\cong\mathcal{O}(U)\xrightarrow{\operatorname{id}}\mathcal{O}(U).
$$
Let $f$ be the image of $s(1)\in\mathcal{L}(U)$ in $\mathcal{O}(U)$ under the isomorphism $\mathcal{L}(U)\cong\mathcal{O}(U).$ Then we have $e(U)(\operatorname{id}) = f.$ Tracing everything out, this means that the map $e(U) : \mathcal{O}(U)\to\mathcal{O}(U)$ is nothing more than multiplication by $f.$ Now here's the key -- $s$ being injective means that $s(1) = f\in\mathcal{O}(U)$ is a nonzero divisor, so the map $e(U)$ is injective, as desired!

As Samiron suggests in the comment above, this may all be more simply put as follows. Recall that $\mathscr{H}om(\mathcal{L},\mathcal{O}) = \mathcal{L}^{-1},$ and that $\mathcal{L}^{-1}\otimes\mathcal{L}\cong\mathcal{O}.$ Then the map you define $$\mathscr{H}om(\mathcal{L},\mathcal{O})\to\mathcal{O}$$ is nothing more than the map you obtain by tensoring the given regular section $s : \mathcal{O}\to\mathcal{L}$ by $\mathcal{L}^{-1}.$ This produces a map $\mathcal{L}^{-1}\to\mathcal{O},$ which is still injective because $\mathcal{L}^{-1}$ is locally free (hence flat).
