Suppose $f: X \rightarrow Y$ is a flat projective morphism of finite type schemes over an algebraically closed field so that the fibers over the closed points of Y are (geometrically) reduced. Why is it true (or do I need some additional assumptions?) that the number of irreducible components of the geometric fibers is upper semicontinuous on Y?


I have asked Joe Harris and Allen Knutson about this statement, and they both believed it was true, but I have not been able to find a reference or a proof.



Why is the number of irreducible components upper semicontinuous in nice situations?
Here is an alternative to Count Dracula's (correct) argument that emphasizes instead the constancy of the Hilbert polynomial for a flat family of projective schemes. 


As above, assume that $Y$ is a DVR. For one fixed irreducible component $Z\_{\eta}$ of $X\_\eta$ of minimal dimension $d$, denote by $Z$ the Zariski closure of $Z\_{\eta}$ in $X$ together with its closed immersion $u:Z\to X$. Denote by $W\_{\eta}$ the union of all other irreducible components of $X\_{\eta}$, and denote by $v:W\to X$ the closure of $W\_\eta$ in $X$. By construction, both $Z$ and $W$ are flat over $Y$, since every associated point is a generic point of $Z\_\eta$, resp. $W\_\eta$. 


The closed immersion $u$ and $v$ determine an associated morphism of $\mathcal{O}\_X$-modules, $$(u^\#, v^\#):\mathcal{O}\_X \to u\_\*\mathcal{O}\_Z \oplus v\_\*\mathcal{O}\_W.$$ The restriction of $(u^\#,v^\#)$ on $X\_\eta$ is injective. Thus the kernel of $(u^\#,v^\#)$ is a subsheaf of $\mathcal{O}\_X$ that is torsion for $\mathcal{O}\_Y$. Since $\mathcal{O}\_X$ is flat over $\mathcal{O}\_Y$, the kernel of $(u^\#,v^\#)$ is the zero sheaf.


Denote the quotient of $(u^\#,v^\#)$ by $\mathcal{Q}$. The restriction of $\mathcal{Q}$ on $X\_\eta$ has support whose dimension is strictly smaller than the dimension of any irreducible component of $X\_\eta$. In particular, the Hilbert polynomial of $\mathcal{O}\_{X\_\eta}$ agrees with the Hilbert polynomial of $\mathcal{O}\_{Z\_\eta}\oplus \mathcal{O}\_{W\_\eta}$ modulo the subspace of numerical polynomials of degree strictly less than $d = \text{dim}(Z\_\eta)$.


Now consider the restriction $(u\_0^\#,v\_0^\#)$ of $(u^\#,v^\#)$ to the closed fiber $X\_0$. By the flatness hypothesis, the Hilbert polynomials of the domain and target of this homomorphism equal the Hilbert polynomials on the generic fiber. Thus the difference of these Hilbert polynomials on $X\_0$ equals the difference of these polynomials on $X\_\eta$, and we know that this difference is a polynomial of degree strictly less than $d$. The cokernel of $(u\_0^\#,v\_0^\#)$ equals the restriction $\mathcal{Q}\_0$. If the induced morphism $\mathcal{O}\_{Z\_0}\to \mathcal{Q}\_0$ is nonzero at some generic point of $Z\_0$, then the support of $\mathcal{Q}\_0$ has an irreducible component of dimension $\geq d$. Thus the Hilbert polynomial of $\mathcal{Q}\_0$ has degree $\geq d$. Since the difference polynomial has degree strictly less than $d$, the kernel of $(u\_0^\#,v\_0^\#)$ has Hilbert polynomial of degree $\geq d$ counterbalancing the Hilbert polynomial of $\mathcal{Q}\_0$. In particular, the kernel of $(u\_0^\#,v\_0^\#)$ is not zero. 


By the flatness hypothesis, every associated point of $X$ is contained in $X\_\eta$. Thus, every generic point $\xi$ of $X\_0$ is the specialization of a generic point that is either in $Z$ or in $W$. Thus the localization $\mathcal{O}\_{X\_0,\xi}$ either factors through $\mathcal{O}\_{Z\_0,\xi}$ or factors through $\mathcal{O}\_{W,\xi}$. Therefore the kernel of $(u\_0^\#,v\_0^\#)$ is in the kernel of the localization at every generic point of $X\_0$. Since the kernel is nonzero, $X\_0$ has embedded associated points, contradicting the hypothesis that $X\_0$ is geometrically reduced. Therefore, by way of contradiction, the support of $\mathcal{Q}\_0$ does not contain $Z\_0$. So $Z\_0$ is not contained in $W\_0$.


Now we continue by induction on the number of irreducible components, replacing $X$ by $W$. 


