Use irreducible fibers to show $X$ is irreducible

This is exercise 11.4.C of Ravi Vakil's notes. I'll give a sketch of the solution.

First note that since $\pi$ is proper $X$ is finite type over a variety so it has finitely many irreducible components $Z_i$. Furthermore, $\pi$ is closed so $\pi(Z_i)$ is closed in $Y$ for each $i$ and we can conclude that some $\pi(Z_i) = Y$ by the irreducibility of $Y$. Call this component $Z_0$.

Let $X_y$ denote $\pi^{-1}(y)$. $X_y$ is irreducible and $X_y = \bigcup X_y \cap Z_i$ is a union of closed subsets so $X_y = X_y \cap Z_i \subset Z_i$ for some $i$. It then follows that if $x \in Z_i$ but not in $Z_j$ for $j \neq i$, then $X_{\pi(x)} \subset Z_i$.

By applying proposition 11.4.1 in Vakil's notes on the restriction of $\pi$ to $Z_i \to Y$, we see that $\dim X_y \cap Z_i \geq \dim Z_i - \dim \pi(Z_i)$ with equality on some open subset of $\pi(Z_i)$. However, for each $y$ there exists a $k$ such that $X_y \cap Z_k = X_y$ so in that case $\dim X_y = \dim Z_k - \dim \pi(Z_k)$ on some open subset. Since the fibers are equidimensional of dimension $d$, we can then conclude that $\dim Z_k - \dim \pi(Z_k) = d$ for every $k$. In particular, if $X_y$ intersects $Z_k$, then $\dim X_y \cap Z_k \geq d$ by the first inequality but $\dim X_y = d$ by assumption and $X_y \cap Z_k = X_y$. Therefore each connected component $Z_k$ is the union of fibers $X_y$ that intersect it. In particular, $Z_0$ is the union of fibers that intersect it, but every fiber intersects $Z_0$ so $Z_0$ is the union of all the fibers thus $Z_0 = X$ and $X$ is irreducible.