TITLE: Strange case of Serre's duality
QUESTION [7 upvotes]: $\newcommand{\O}{\mathcal{O}}$
Let $X$ be a smooth projective curve and $D$ and effective divisor on it. The normal bundle of $D$ is defined as
$$ \O_D(D)\; = \; \O_x(D)\;\otimes_{\O_X}\, \O_D$$
where $\O_D$ is just the restriction of the stricture sheaf of $X$ to the support of $D$. In the literature I found the claim that, as a special case of Serre's duality, the dual space to $H^0(X, \O_D(D))$ is
$$ H^0(X, \O_D(D))^* \cong H^0(X,K\otimes\O_D), $$
where $K$ is the canonical sheaf.
Now, I'm not an expert of Serre's duality, but I was expecting the dual of that space to be something like
$$ H^0(X,(K-D)\otimes\O_D). $$
Could you please explain the reason why the above is the right answer and mine is the wrong one?

REPLY [4 votes]: From Proposition 8.20 of Hartshorne (chapter II, page 182), we have a formula for the canonical sheaf $\omega_D$ of $D$:
$$ \omega_D = \omega_X \otimes \O_D(D). $$
So applying Serre's duality for $D$ we find
$$ H^0(\O_D(D))^* \cong H^0(\omega_D \otimes \O_D(D)^{-1}) \cong H^0(\omega_X \otimes\O_D(D)\otimes \O_D(D)^{-1}) \cong H^0(\omega_X \otimes \O_D). $$
UPDATE:
To make the notation easier let's use the following shorthands: 
$$H^0(D) \leadsto H^0(X,\mathcal{O}_X(D)) \quad\text{ and }\quad H^0(D_D) \leadsto H^0(X,\mathcal{O}_X(D)\otimes \mathcal{O}_D)$$
I'd like to point out that once one proves (like in the original book of Serre Algebraic Groups and Class Fields) that for every divisor $D$ we have
$$ H^1(D)^{\vee} \cong H^0(K-D), $$
then the above duality between $H^0(D_D)$ and $H^0(K_D)$ follows by abstract nonsense, without using the adjunction formula. Indeed from the short exact sequences of invertible sheaves
$\newcommand{\SES}[3]{ 0 \to #1 \to #2 \to #3 \to 0 }$
$$ \SES{\O_X}{\O_X(D)}{\O_X(D)\otimes \O_D} $$ 
and
$$ \SES{K(-D)}{K}{K\otimes \O_D} $$
we get the commutative diagram with exact rows
$$
\newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\la}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xleftarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{llllllllllll}
0 & \;\;\ra{} \;& k & \;\ra{} & H^0(D) & \;\;\ra{} & H^0(D_D) & \;\;\ra{} & H^1(\O_X) & \;\;\ra{} & H^1(D) & \;\;\ra{} & 0 \\
 & & \da{\;f_0} & & \da{\;f_1} & & \da{\;f_2} & & \da{\;f_3} & & \da{\;f_4} & & \\
0 & \;\;\ra{} \;& k & \;\ra{} & H^1(K-D)^{\vee} & \;\;\ra{} & H^0(K_D)^{\vee} & \;\;\ra{} & H^0(K)^{\vee} & \;\;\ra{} & H^0(K-D)^{\vee} & \;\;\ra{} & 0 \\\end{array}
$$
where $f_0$, $f_1$, $f_3$ and $f_4$ are the duality isomorphisms. Using the 5 lemma we can now deduce that $f_2$ is an isomorphism as well.
Remark: we are just using the hypothesis of Serre duality from Serre's book, so that $X$ is a smooth projective curve over an algebraically closed field.