I would like to present the following result in my algebraic geometry class, but it is seeming much harder than I would expect. Since my class is working with closed points over an algebraically closed field $k$, I'll present it that way.

Let $X$ and $Y$ be affine varieties, with $X$ normal, and $\pi: Y \to > X$ a dominant finite map. Then the function $x \mapsto \# \pi^{-1}(x)$ is lower semicontinuous, where I am NOT counting $\# \pi^{-1}(x)$ with multiplicity. (Yes, I see how to weaken various hypotheses in boring ways, but that isn't what the question is about.)

Here is the best argument I can find. Let $A$ and $B$ be the coordinate rings of $X$ and $Y$. So our hypotheses are that $A \subseteq B$, with $A$ a normal domain and $B$ a domain which is finitely generated as an $A$-module. Let $K= \mathrm{Frac}(A)$ and $L = \mathrm{Frac}(B)$, so $L/K$ is finite. Let $x \in X$ and let $n = \# \pi^{-1}(x)$. We need to show that there is an open neighborhood $\Omega$ of $x$ so that $\# \pi^{-1}(x') \geq n$ for $x' \in \Omega$.

We will be making frequent use of

Gauss's Lemma:Let $f(t)$ be a monic polynomial with coefficients in $A$. Suppose that $f$ factors as $g(t) h(t)$ with $g$ and $h$ monic polyomials with coefficients in $K$. Then $g(t)$ and $h(t) \in A[t]$.

For any $u \in B$, let $g(t)$ be the monic minimal polynomial of $u$ over $K$. Since $B$ is integral over $A$, $u$ obeys some monic polynomial $f$ with coefficients in $A$, so $g(t)|f(t)$ so, by Gauss's Lemma, $g(t) \in A[t]$.

**Lemma 1:** Map $A[t]$ to $B$ by $t \mapsto u$. The kernel is $(g(t))$.

**Proof:** Since $B$ is a torsion free $A$-module, $g(u)$ is zero in $B$ as well as in $L$, so $g(t) \mapsto 0$. If $f(t) \mapsto 0$, then $g(t) | f(t)$ in $K[t]$ so, by Gauss's lemma, $g(t)|f(t)$ in $A[t]$. $\square$.

Define $\psi: B \to A \times \mathbb{A}^1$ by $y \mapsto (\pi(y), u(y))$.

**Lemma 2:** $\psi(Y)$ is the hypersurface cut out of $X \times \mathbb{A}^1$ by $g$.

**Proof:** Call this hypersurface $Z$. By Lemma 1, $\psi: Y \to Z$ is dominant. But $\psi$ is a finite map (if $B$ is finitely generated as an $A$-module, it certainly is as an $A[t]$ module) so $\psi$ is closed and $\psi(Y) = Z$. $\square$

We conclude that the number of distinct values of $u$ on $\pi^{-1}(x')$ is the number of distinct roots of $g$ at $x'$.

Now, assume that $u$ takes $n$ distinct values at the $n$ points of $\pi^{-1}(x)$, so $g$ has $n$ distinct roots at $x$. We want to show that $g$ has $\geq n$ distinct roots on an open neighborhood of $x$. This comes down to the following:

**Fact:** The number of distinct roots of $x^d+g_{d-1} x^{d-1} + \cdots + g_0$ is a lower semicontinuous function of $(g_{d-1}, \ldots, g_1, g_0)$, considered as a point in $\mathbb{A}^d$.

Conveniently, this Fact is very close to some applications of "finite maps are closed" that I have already done! But is it really this hard?

I'm not sure if this is "MO level" but, as proof that it is "confuse a good mathematician level", see this conversation between Ravi Vakil and Allen Knutson.