# Flatness of a counit for the inverse/direct image adjunction for a finite map of (locally Noetherian?) schemes

Let $f:X\to Y$ be a finite map of locally Noetherian schemes. In fact it's not clear to me whether the hypotheses of finiteness or local Noetherianity are ultimately relevant for my question (I would guess the Noetherianity is not). But we'll see.

To wit, in generalizing Serre duality to the ultra general duality of Grothendieck-Serre, following say Brian Conrad's Grothendieck Duality and Base Change (or Hartshorne's Residues and Duality), one constructs (relative to the map $f$) a certain functor from $\mathscr{O}_Y$-modules to $\mathscr{O}_X$-modules, and at one point in the construction, it is mentioned without proof in either reference that the "canonical" map of ringed spaces $\overline{f}:(X,\mathscr{O}_X)\to(Y,f_*\mathscr{O}_X)$, which I assume (correctly?) is given by $f$ on the underlying topological spaces and on sheaves of rings is just the map $f_*\mathscr{O}_X\to f_*\mathscr{O}_X$, is flat.

Question: Assuming I have inferred the correct definition of the map $\overline{f}:(X,\mathscr{O}_X)\to(Y,f_*\mathscr{O}_X)$, why is this map flat?

It seems warranted to spell out what flatness here means as my (misguided) initial reaction to this somewhat passively made claim was that it was indeed obvious, because certainly $\mathrm{id}_{f_*\mathscr{O}_X}$ is flat, but that is not the map of sheaves of rings one looks at in the definition of flatness of a map of ringed spaces. Flatness means that the adjunct (non-standard terminology presumably but I can think of no better term) of $\mathrm{id}_{f_*\mathscr{O}_X}:f_*\mathscr{O}_X\to f_*\mathscr{O}_X$ under the adjunction $f^{-1}\dashv f_*$ (on sheaves of rings), which is exactly the counit $\epsilon_{\mathscr{O}_X}:f^{-1}f_*\mathscr{O}_X\to\mathscr{O}_X$, is a flat map of sheaves of rings on $X$. So, again, assuming I've not made a mistake here, my question can be rephrased more precisely:

Refined Question: Why is the counit $\epsilon_{\mathscr{O}_X}:f^{-1}f_*\mathscr{O}_X\to\mathscr{O}_X$ a flat map of sheaves of rings on $X$ when the map of spaces $f$ arises from a finite map of (locally Noetherian) schemes $X\to Y$?

If $f$ were a closed immersion, instead of just finite, then the counit in question would be an isomorphism, as can be checked on stalks. In general, if one passes to stalks at a point $x\in X$, one is asking that the ring map $(f_*\mathscr{O}_X)_{f(x)}\to\mathscr{O}_{X,x}$ be flat. But since $f$ is not a closed topological embedding on underlying topological spaces, it's not clear to me how to get a handle on $(f_*\mathscr{O}_X)_{f(x)}$.

As is my wont, I feel compelled to add the disclaimer that I may have messed something up in my formulation of this question and/or be missing something painfully and embarrassingly obvious. I sincerely appreciate any and all comments, even if they are pointing out my obliviousness to the apparent or the overtly formal.