# Is the zero locus of a global section flat?

Let $f:X \to Y$ be a surjective, smooth projective morphism of noetherian schemes. Let $\mathcal{L}$ be an inverible sheaf on $X$ satisfying $f_*\mathcal{L}$ is locally free and $s \in H^0(\mathcal{L})$ be a global section of $\mathcal{L}$. Is the zero locus of $s$ (in $X$), flat over $Y$?

N.B. If necessary, one can assume the fibers of $f$ are irreducible and $Y$ is affine. Also can assume $\pi_*\mathcal{L}$ is free.

You already have trivial counterexamples for your statement, but perhaps you were thinking of a section whose zero locus is irreducible and dominates $Y$. It is false even with that additional assumption:
Let $Y$ be an arbitrary non-singular surface and $Z$ the blow-up up of a (closed) point on $Y$. Then by construction/definition $Z\subseteq X=Y\times \mathbb P^1$. Since $X$ is non-singular, $Z$ is a Cartier divisor and hence there is a line bundle $\mathscr L$ on $X$ such that $Z$ is the zero locus of a global section of $\mathscr L$. Clearly the projection $f:X\to Y$ is flat, so this is a counterexample with the additional property that the zero locus of the section is irreducible and surjects onto $Y$.
EDIT: Oops, I've just realized that there is one more assumption to check, namely that $f_*\mathscr L$ is locally free, but it is easy to check that that also holds.
No. Take $X=\mathbb{P}^1\times \mathbb{P}^1$, $Y=\mathbb{P}^1$, $f$ the first projection, $\mathcal{L}=\mathcal{O}_{\mathbb{P}^1}(1)\boxtimes \mathcal{O}_{\mathbb{P}^1}(1)$, $s=X\otimes X'$, where $(X,Y)$ are the coordinates of the first factor $\mathbb{P}^1$ and $(X',Y')$ the coordinates of the second factor. The zero locus of $s$ is $\mathbb{P}^1\times \{0\}\cup \{0\}\times \mathbb{P}^1$, obviously not $f$-flat.
• More trivially, you can take $X=Y=\mathbb{A}^1$, $\mathcal{L}=\mathcal{O}_X$, $s=$ the standard coordinate on $X$. – Laurent Moret-Bailly Jun 4 '16 at 6:05