TITLE: Modules and Square Zero Extensions
QUESTION [19 upvotes]: Let $R$ be a commutative ring, $RMod$ its category of modules and $CRing$ the category of commutative rings.  
There's an embedding $RMod \rightarrow CRing/R$ that sends an $R$-module $M$ to the ring $$R \oplus M$$ (the direct sum taken as modules) with multiplication $(r_0,m_0)(r_1,m_1) = (r_0 r_1, r_0 m_1 + r_1 m_0)$.  This functor restricts to an equivalence of categories between $RMod$ and $Ab(CRing/R)$, the category of abelian group objects in the slice category.
The projection $R \oplus M \rightarrow R$ makes this ring into a square-zero extension of $R$.  My understanding is that in algebraic geometry, one thinks of a square zero extension of a ring as a kind of infinitesimal extension of $Spec (R)$.  So the category of $R$-modules can be viewed geometrically as parameterizing a certain class of infinitesimal objects related to $R$.
On the other hand, of course, the category $RMod$ is equivalent to the category of quasicoherent sheaves on $Spec(R)$, which seems, to me at least, totally unrelated to my previous description.
So my question is: are these two views of the same category somehow related?  When I think of the sheaf associated to a module $M$, does it somehow contain information about the corresponding infinitesimal extension?  What about when I look at cohomology with coefficients in that sheaf?

REPLY [16 votes]: If $X$ is a scheme and $\mathcal M$ is a quasi-coherent sheaf on $X$ then we can
form a sheaf of rings $\mathcal A := \mathcal O_X \oplus \mathcal M$, on which multiplication
of sections is given just by the same formula as for $R \oplus M$.
The pair $(X,\mathcal A)$ is then a scheme which is an infinitesimal thickening of
$X$, and this is precisely how you pass from a quasi-coherent sheaf to the corresponding
thickening; it is just a sheafified version of the construction in your posting.
(Regarding cohomology, in your question you seemed most interested in the case when 
$X =$ Spec $R$ is affine, in which case quasi-coherent sheaves have vanishing higher cohomology, so I'm not sure there is much to say about this.)
Added in response to comment below:  To see how these come up geometrically,
consider for example a $k$-scheme $X$ embedded diagonally into $X \times X$.
(Here $k$ is a field, and everything is happening over Spec $k$.)
Let $\mathcal I_X$ be the ideal sheaf on $X \times X$ cutting out the diagonal,
and consider the square-zero thickening
$\mathcal O_{X\times X}/\mathcal I_X^2$ of $X$.
This sits in the short exact sequence 
$$0 \to \Omega^1_X = \mathcal I_X/\mathcal I_X^2
\to \mathcal O_{X\times X}/\mathcal I_X^2 \to \mathcal O_{X\times X}/I_X = \mathcal O_X
\to 0.$$  The projection $p_1:X\times X \to X$ gives a spliting of this short exact
sequence, and so we find that $\mathcal O_{X\times X}/\mathcal I_X^2 = \mathcal O_X \oplus
\Omega^1_X$.
Recapitulating, we see that in the special case $\mathcal M = \Omega^1_X$, then
$(X, \mathcal O_X \oplus \Omega^1_X)$ is equal to the first order infinitesimal neighbourhood of $X$ in $X\times X$.
Suppose for example that $X$ is a smooth curve, so that $\Omega^1_X$ is a line-bundle.
Then $(X,\mathcal O_X \oplus \Omega^1_X)$ is locally like the dual numbers (as you observe
in your comment) but is globally twisted (unless $X$ is an elliptic curve, i.e. the genus is 1, which is the one case when $\Omega^1_X$ is actually trivial).
This should give you some sense of how these kinds of objects arise geometrically (and 
why one would consider other examples rather than just the dual numbers).