Ramification divisor and Hurwitz formula of higher dimensional varieties Assume $X,Y$ are smooth varieties, $f: X \to Y$ is a separated morphism. Then it is claimed that there is Hurwitz formula:
$$K_X \sim f^*K_Y + R$$
with $R$ an effective diviosr.
I try to prove this result following the curve case as in Hartshorne IV Proposition 2.3.
But it seems this cannot be carried through literally without any change. First of all, I do not know how to defined the ramification divisor.
 A: I assume that your morphism $f$ is of finite type and separable.
Have you truly done what Hartshorne does? Because it really works exactly the same way even when you're not on a curve. The divisor $R$ is defined as
$$R = \sum_{\substack{P\in X\\\text{of codim. }1}} \mathrm{length}\Bigl((\Omega_{X/Y})_P\Bigr)\cdot P.$$
By that, I mean that the sum is over all $P\in X$ that are the generic point of a codimension one subvariety of $X$. That is, in fact, the only thing you have to add to all the propositions: Clearly, it does not require mentioning when you are on a curve, because points are always of codimension one there.
Now check that Proposition 2.1 only relies on the fact that $f$ is separable and some general results about schemes. So, we can remove the assumption that $X$ and $Y$ are curves from it. The same is true for Proposition 2.2, except that we limit ourselves to $P\in X$ of codimension one. Notice that in this case, one can define the ramification index in just the same way.
Now the proof of Proposition 2.3, frankly, does not change at all.
You should also read Sándor Kovács answer, it really gave me a lot of perspective on the whole thing.
Edit I might have been a bit hasty. If $0\to\mathcal E\to \mathcal F\to \mathcal G\to 0$ is an exact sequence locally free sheaves of finite rank on a scheme $X$, then there is a canonical isomorphism $$\det(\mathcal E)\otimes_{\mathcal O_x} \det(\mathcal G) \cong \det(\mathcal F).$$ Here, $\det(\mathcal F):=\wedge^{\mathrm{rk}(\mathcal F)}\mathcal F$. Furthermore, $\det$ commutes with pullbacks. That's Corollary 4.2 in Qing Liu's book, unfortunately I don't know if or where you could find it in Hartshorne. So once you have the sequence
$$0\to f^\ast\Omega_Y \to \Omega_X \to \Omega_{X/Y}\to 0,$$
you get 
$f^\ast \omega_Y \otimes \det(\Omega_{X/Y}) \cong \omega_X$, which is what you want, the divisor $R$ being the one corresponding to $\det(\Omega_{X/Y})$. Now if $f$ is smooth, then that is just $\omega_{X/Y}$. Otherwise, you should find everything you need in 6.4 of Qing Liu's Book Algebraic Geometry and Arithmetic Curves.
