Let $f:X \to Y$ be a morphism of schemes and let $F$ be an $\mathcal{O}_X$-module flat over $Y$. Is $f_*F$ flat over $Y$?

What's wrong with this argument? [EDIT: as Parsa points out, the (underived) projection formula does not hold for arbitrary modules on Y]

Let $N' \to N$ be an injection of modules over $Y$, we need to show that $f_*F \otimes N' \to f_*F \otimes N$ is an injection. By the projection formula $f_* F \otimes M = f_*(F \otimes f^*M)$. Using this we see $f_* F \otimes N' \to f_*F \otimes N = f_*(F \otimes f^*N' \to F \otimes f^*N)$ (the pushforward of the morphism, right?). Flatness of $F$ implies (right?) $F \otimes f^*N' \to F \otimes f^*N$ is injective. By left-exactness of $f_*$ we are done.

[EDIT: what is a counterexample then?]

[EDITT: this is clearly false, otherwise theorems about the semicontinuity of the cohomology of the fibres wouldn't be meaningful. It would be nice to have a simple counterexample though, anyone?]


Consider an integral surface $Y=\mathrm{Spec} A$ with a single non-normal point $y_0$. Let $\pi : Y'=\mathrm{Spec} B\to Y$ be the normalization map and let $X=Y'\setminus \pi^{-1}(y_0)$. Then $f: X\to Y$ is an open immerison, so $O_X$ is flat over $Y$. But $f_*O_X=O_X(X)=B$ because $B$ is normal and $Y'\setminus X$ has codimension $2$ in $Y'$. As $A\to B$ is birational (and even finite), if it were flat it would be an isomorphism. Thus $f_*O_X$ is not flat over $Y$.

Below is a concrete example. Let $B=\mathbb C[x,y]$ and let $A=\mathbb C+ (x,y)^2\mathbb C[x,y]$. Then $\mathrm{Spec}(B)\to \mathrm{Spec}(A)$ is finite birational, and $(0,0)$ is the only point where the morphism is not an isomorphism. In this example, a direct computation already shows that $B=O_X(X)$.