Hartshorne III 9.3 why do we need irreducibility and equidimensionality? We are trying to prove:
Corollary 9.6: Let $f\colon X \to Y$ be a flat morphism of schemes of finite type over a field $k$, and assume that $Y$ is irreducible. Then the following are equivalent:
(i) every irreducible component of $X$ has dimension equal to $\dim Y + n$;
(ii) for any point $y \in Y$ (closed or not), every irreducible component of the fibre $X_y$ has dimension $n$.
(i) $\Rightarrow$ (ii)
Hartshorne argues that since $Y$ is irreducible and $X$ is equidimensional and both are of finite type over $k$, we have
$$\dim_x X = \dim X - \dim \operatorname{cl}(\{x\})$$
$$\dim_y X = \dim Y - \dim \operatorname{cl}(\{y\})$$
Hartshorne makes a reference to II Ex 3.20, where one should prove several equalities for an integral scheme of finite type over a field $k$. We have that $Y$ is irreducible, so we only need it to be reduced, and then its corresponding equality will be justified. But how do we get reducedness then? And what about $X$?

I was confused by this as well.  The desired equalities follow from the general statement

Let $X$ be a scheme of finite type over a field $k$ and let $x\in X$.  Then $$\dim \mathcal{O}_x+\dim \{x\}^-=\sup_{x\in V \text{ irreducible component}} \dim V$$
where the sup on the right is taken over all irreducible components of $X$ containing $x$.

I posted a proof of this as an answer to my own question here: Dimension of local rings on scheme of finite type over a field.
The proof uses the special case from exercise II 3.20 in Hartshorne.
