I have a surjective morphism $\pi: Y \to X$ between smooth projective varieties of the same dimension over some algebraically closed field $k$. Debarre claims in his book "Higher-Dimensional Algebraic Geometry" (1.41) that there is an effective divisor $R$ such that
$$ K\_Y \equiv \pi^\* K\_X + R$$
if $K(X) \subset K(X)$ is a separable field extension. In particular, this is always true if $\pi$ is birational. Debarre also claims that in this case the support of $R$ is the exceptional locus.


I search for a reference for this fact because Debarre does not provide one. I'm in particular interested in the case of positive characteristic. In characteristic $0$ this is a well known fact and I would like to confirm that it is still fine in positive characteristic.



Pullback of the canonical divisor between smooth varieties
**EDIT** Originally I claimed a more general statement and along the incremental generalizations I reached a statement that was not true. Thanks to Carlos for pointing out this error! So, I thought it would be fair to point out where the error lied.
The main issue is that the original proof works for a finite morphism, but not if there are exceptional divisors, because then on the target the localization would not happen at a height $1$ prime. In order to preserve the original proof, here is a fix that divides the statement into two parts.


0
-



> 
> By Stein factorization it is enough to prove the statement for finite or birational morphisms.
> 
> 
> 


1
-



> 
> **Thm** Let $\pi:Y\to X$ be a separable projective finite morphism between normal varieties of the same dimension. Assume that $K\_X$ is a $\mathbb Q$-Cartier divisor (i.e., there exists an $m\in \mathbb N\_+$ such that $mK\_X$ is a Cartier divisor). Then there exists an effective divisor $R\subset Y$ whose support is contained in the ramification locus of $\pi$ (that is, the complement of the largest open subset of $Y$ on which $\pi$ is smooth) such that 
>  $$K\_Y\sim \pi^\*K\_X + R.$$
> 
> 
> 


**Proof:**  

We need to prove that the divisor $\pi^\*K\_X-K\_Y$ is linearly equivalent to an effective divisor supported on the exceptional locus . This can be done by localizing at height $1$ primes, so the question reduces to a question about regular schemes of dimension $1$. One may apply the usual proof of the Hurwitz formula:


Consider the short exact sequence $$0\to \pi^\*\Omega\_X\to \Omega\_Y\to \Omega\_{Y/X}\to 0$$
and observe that $\Omega\_{Y/X}$ is a torsion sheaf whose support is the ramification locus (this is where you need that the map is separable), which in this case is the same as the exceptional divisor (the smaller parts of the exceptional locus disappear at the localization). This is a finite set, so $\Omega\_{X/Y}$ maybe considered as the structure sheaf of a finite subscheme of $Y$. Let $R\subseteq Y$ be this subscheme. Tensoring the above short exact sequence by $\Omega\_Y^{-1}$ gives:
$$ 0\to \pi^\*\Omega\_X\otimes \Omega\_Y^{-1}\to \mathscr O\_Y \to \mathscr O\_R \to 0,$$
which shows that $\pi^\*\Omega\_X\otimes \Omega\_Y^{-1}\simeq \mathscr O\_Y(-R)$. This implies the needed linear equivalence.


To find the original $R$ all you need to do is to take the divisor that localizes to the $R$ we found in the $1$-dimensional case. Since we're talking about divisors the codimension $2$ ambiguity makes no difference. 


2
-



> 
> **Thm** Let $\pi:Y\to X$ be a projective birational morphism between smooth varieties. Then there exists an effective divisor $R\subset Y$ whose support is the exceptional locus $E\subseteq Y$ of $\pi$ such that 
>  $$K\_Y\sim \pi^\*K\_X + R.$$
> 
> 
> 


**Proof:** 
Consider (again) the short exact sequence $$0\to \pi^\*\Omega\_X\to \Omega\_Y\to \Omega\_{Y/X}\to 0$$
and notice that $\pi$ is an isomorphism on $Y\setminus E$, so similarly $\pi^\*\Omega\_X\to \Omega\_Y$ is an isomorphism there. Now take the determinant of these locally free sheaves and conclude that $\pi^\*\omega\_X\subseteq\omega\_Y$ and $\omega\_Y/f^\*\omega\_X$ is supported on $E$. This implies that the divisor $K\_Y-f^\*K\_X$ is an effective divisor supported on $E$.


We need to prove that the support of $R$ is the entire $E$. For this, first notice that in order to prove the desired statement, using what we have proved already, we may pass to another birational model that dominates $Y$. (The point is that a $\pi$-exceptional divisor will be exceptional for the combined map to $X$ but not for the map to $Y$.) Second, a theorem of Zariski says that every exceptional divisor can be reached by a sequence of blow-ups (see [Kollár-Mori98, 2.45](http://books.google.com/books?id=YrysxvPbBLwC&lpg=PA61&dq=kollar%2520mori%2520%2522sequence%2520of%2520blow-ups%2522&pg=PA61#v=onepage&q&f=false)). We know how to compute the canonical divisor of a blow-up and we know that the entire exceptional locus is contained in the discrepancy divisor, so the desired statement follows.


3
-


**Comment** The reason the second part requires smoothness is that one needs $\Omega\_X$ to be locally free so when pulled back it would give the right thing. Otherwise it might pick up torsion or co-torsion. The statement is true in a little bit more general situation, if $X$ has at worst canonical singularities, but that is essentially the definition of those singularities and this statement says that smooth points are canonical, so it is a reasonable condition to use to define singularities.


