Degree of zero dimensional schemes in projective space Background: Let $k$ be a field (I'm mostly interested in $k$ an algebraically closed field of characteristic $0$) and let $X$ be a zero dimensional closed subscheme of $\mathbb{P}^n_k$.
Question: What is the explicit definition of degree of $X$?
Guess: I know that in case of variety(not in the sense of scheme) degree of a finite set of point is its cardinality.
Since zero dimensional closed subschemes of $\Bbb P^n_k$ are finite sets, is the degree same as its cardinality? It does not appear to be so
Can someone explain me how to think about their degree and compute explicitly? For instance, what happens if some points are double points?
Any help from anyone is welcome.
 A: Suppose $X\subset \Bbb P^n_{k}$ is a closed projective subscheme equidimensional of dimension $r$ with $k$ a field. Let $S(X)$ be the homogeneous coordinate ring of $X$, and $S(X)^{(d)}$ the $d^{th}$ graded piece. The Hilbert function $h_X$ is defined to send $d\mapsto \dim_{k} S(X)^{(d)}$ for nonnegative integers $d$. For $d$ large enough, $h_x$ is polynomial in $d$ of degree $r$ and this polynomial is called the Hilbert polynomial $p_X(d)$. The degree of $X$ is then defined to be $r!$ times the leading coefficient of the Hilbert polynomial.
One can prove that in the case of a finite set of distinct $k$-points, this gives exactly the same result as you are familiar with. But interesting things may happen with points over extension fields or thicker points.
Exercise: if a point is defined over an extension field $K\supset k$, then it's degree as a closed subscheme is exactly the degree of the field extension.
Exercise: if we define $tZ$, a $t$-thick point inside $\Bbb P^n_k$ supported at $Z$ to be of the form $I(Z)^t$ for $t>1$, then the degree of $tZ$ is $\binom{t+n-1}{n}$. (It's worth noting that there are fat/thick points not of this form, but this terminology is what's currently accepted in the field - people usually mean the $t^{th}$ infinitesimal neighborhood of the given point unless they say otherwise.)
Exercise: Degrees of finite sets of points add over disjoint unions. With this, you should have enough to come to the conclusions you're looking for.
