Lemma 49.16.1. Let $f : Y \to X$ be a quasi-finite morphism of Noetherian schemes. The following are equivalent

1. $f$ is Gorenstein,

2. $f$ is flat and the fibres of $f$ are Gorenstein,

3. $f$ is flat and $\omega _{Y/X}$ is invertible (Remark 49.2.11),

4. for every $y \in Y$ there are affine opens $y \in V = \mathop{\mathrm{Spec}}(B) \subset Y$, $U = \mathop{\mathrm{Spec}}(A) \subset X$ with $f(V) \subset U$ such that $A \to B$ is flat and $\omega _{B/A}$ is an invertible $B$-module.

Proof. Parts (1) and (2) are equivalent by definition. Parts (3) and (4) are equivalent by the construction of $\omega _{Y/X}$ in Remark 49.2.11. Thus we have to show that (1)-(2) is equivalent to (3)-(4).

First proof. Working affine locally we can assume $f$ is a separated morphism and apply Lemma 49.15.1 to see that $\omega _{Y/X}$ is the zeroth cohomology sheaf of $f^!\mathcal{O}_ X$. Under both assumptions $f$ is flat and quasi-finite, hence $f^!\mathcal{O}_ X$ is isomorphic to $\omega _{Y/X}[0]$, see Duality for Schemes, Lemma 48.21.6. Hence the equivalence follows from Duality for Schemes, Lemma 48.25.10.

Second proof. By Lemma 49.10.2, we see that it suffices to prove the equivalence of (2) and (3) when $X$ is the spectrum of a field $k$. Then $Y = \mathop{\mathrm{Spec}}(B)$ where $B$ is a finite $k$-algebra. In this case $\omega _{B/A} = \omega _{B/k} = \mathop{\mathrm{Hom}}\nolimits _ k(B, k)$ placed in degree $0$ is a dualizing complex for $B$, see Dualizing Complexes, Lemma 47.15.8. Thus the equivalence follows from Dualizing Complexes, Lemma 47.21.4. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).