Let $\pi:X\to \mathbb{P}^1_{\mathbb{Z}}$ be a proper flat morphism with $X$ an integral scheme. Is $\pi_*\mathcal{O}_X$ necessarily locally free?

3$\begingroup$ That is not true. Let $X$ be a nonreduced scheme whose underlying reduced scheme is $\mathbb{P}^1_{\mathbb{Z}}\times_{\text{Spec}\ \mathbb{Z}}\mathbb{P}^1_{\mathbb{Z}}$, with $\pi$ equal to projection onto the first factor. $\endgroup$– Jason StarrJun 13, 2020 at 17:04

4$\begingroup$ The OP added the hypothesis that $X$ is an integral scheme after I posted my comment. $\endgroup$– Jason StarrJun 13, 2020 at 18:38

$\begingroup$ I think I might have a solution when $X_{\mathbb{Q}}$ is geometrically connected, because in that case $\pi_*\mathcal{O}_X $ equals the structure sheaf of $\mathbb{P}^1_{\mathbb{Z}}$ by analyzing the Stein factorization of $\pi$. If you are interested in this more restrictive setting I can write it down. $\endgroup$– JefJun 15, 2020 at 15:06
1 Answer
Like your other question, the answer to this one is related to miracle flatness:
Theorem (Miracle flatness). Let $f \colon X \to Y$ be a finite dominant morphism of schemes with $Y$ regular. Then $f$ is flat if and only if $X$ is Cohen–Macaulay.
See for example Tags 00R4 and 00R5.
Now let $f \colon X \to Y$ be flat and proper, with $Y$ regular of dimension $2$. Let $X \to Y' \to Y$ be the Stein factorisation, so $Y'$ is the normalisation of $Y$ in $X$ (see Tag 03H0). Here is a positive result:
Claim. If $X$ is normal, then $f_* \mathcal O_X$ is locally free.
Indeed, if $X$ is normal, then so is $Y'$, hence it is $S_2$ by Serre's criterion (Tag 031S). Since it is finite (dominant) over $Y$, it has dimension $2$, so $S_2$ is equivalent to Cohen–Macaulay. Then miracle flatness says that $Y' \to X$ is flat. $\square$
Conversely, if we assume a priori that $f$ is finite, then $X = Y'$, which is $S_2$ if and only if it is Cohen–Macaulay if and only if it is flat over $Y$. So it suffices to construct a finite map $X \to \mathbf P^1_{\mathbf Z}$ with $X$ not $S_2$.
There are many ways to do this. One construction is to take a double cover $\mathbf P^1_{\mathbf Z} \to \mathbf P^1_{\mathbf Z}$ by $[x:y] \mapsto [x^2:y^2]$, and glueing together the points $[1:0]$ and $[1:0]$ in the fibre above $3 \in \operatorname{Spec} \mathbf Z$ of the source $\mathbf P^1_{\mathbf Z}$ (which map to the same point in the target). The resulting scheme is regular in codimension $1$ but not normal, so cannot be $S_2$. (See also this answer for glueing schemes along closed subschemes.)

$\begingroup$ but in your construction you are not taking two schemes $X$ and $Y$ and gluing them along a common closed subscheme $Z$; you are somehow glueing closed points on the same scheme. Does that exist in the category of schemes? $\endgroup$– user158636Jun 16, 2020 at 14:59

$\begingroup$ Reverse engineering this answer, if $S$ is an affine piece of $\mathbf P^1_{\mathbf Z}$, you can construct the quotient as the pullback of $S \to S/I \cong \mathbf F_3^2 \leftarrow \mathbf F_3$, i.e. the functions whose values at the two points agree. So geometrically you're glueing $\mathbf P^1_{\mathbf Z}$ and a point $*$ along $* \to * \amalg * \subseteq \mathbf P^1_{\mathbf Z}$, which is a slight generalisation of glueing two schemes along a closed subscheme. See also Tag 0E25. $\endgroup$ Jun 16, 2020 at 21:25