Rank of a module I have seen the definition of a module,not neccessary free, the alternatin sum of free modules in a free resolution of that module. it's clear that when the module is free our definition Coincide the rank of free module. but why this definition is Well-defined?
 A: We have a ring $R$, a module $M$ over $R$, and a (finite length) free-resolution of $M$:
$$
\cdots\to R^{\oplus n_3}\to R^{\oplus n_2}\to R^{\oplus n_1}\to R^{\oplus n_0}\to M\to 0
$$
At any prime ideal $\mathfrak p$ of $R$, you can talk about the rank of $M$ over $\mathfrak p$.  Concretely, this is just the dimension of $\operatorname{Frac}(R/\mathfrak p)\otimes_RM$ as a vector space over $\operatorname{Frac}(R/\mathfrak p)$ (where $\operatorname{Frac}$ denotes fraction field).
If we tensor the free resolution with $\operatorname{Frac}(R/\mathfrak p)$, then we get a complex:
$$
\cdots\to\operatorname{Frac}(R/\mathfrak p)^{\oplus n_2}\to\operatorname{Frac}(R/\mathfrak p)^{\oplus n_1}\to \operatorname{Frac}(R/\mathfrak p)^{\oplus n_0}\to\operatorname{Frac}(R/\mathfrak p)\otimes_RM\to 0
$$
This might not be exact, since $R/\mathfrak p$ may not be flat over $R$.  Thus we cannot necessarily say that $\dim_{\operatorname{Frac}(R/\mathfrak p)}\operatorname{Frac}(R/\mathfrak p)\otimes_RM=\sum_{i=0}^\infty(-1)^in_i$.
There is however a case when $R/\mathfrak p$ is flat over $R$, namely when $\mathfrak p=(0)$ (supposing $R$ is a domain).  Then we do have equality:
$$
\dim_{\operatorname{Frac}(R)}\operatorname{Frac}(R)\otimes_RM=\sum_{i=0}^\infty(-1)^in_i
$$
Thus if $R$ is a domain, then your notion of rank is well-defined and does have a nice interpretation: it's just the dimension over the fraction field of $R$ of $M$ tensored with the fraction field.  In the scheme-theoretic sense, this is the "generic" rank of $M$.
