Let $X$ be a variety which might be singular, how to defined the canonical sheaf $K\_X$ on $X$? 


When $X$ is a proper, irreducible variety over $\mathbb{C}$, Ueno defined $K\_X$ as the pushforward of the canonical sheaf of its nonsigular model (see Chapter2 in his book " Classification Theory of Algebraic Varieties and Compact Complex Spaces"). However, I was wondering if there is a well-defined canonical sheaf on singular variety which is not proper (over $\mathbb{C}$ is OK for me). I will be very appreciated if someone can point out referenced of this kind.



How to define the canonical sheaf on singular varieties
For $X$ normal, saying that canonical divisor is the pushforward of the canonical divisor of a resolution of singularities is totally fine (it even works in characteristic $p > 0$ if you happen to have a resolution). In particular, if $\pi : Y \to X$ is a resolution of singularities, then $\pi\_\* K\_Y$ is $K\_X$ (here we define $\pi\_\* K\_Y$ by simply throwing away any components of $K\_Y$ that get contracted to non-divisorial varieties). 


**However:** The pushforward of the canonical *sheaf* $\omega\_Y$ is not the canonical sheaf $\omega\_X$ in general. Indeed, $\pi\_\* \omega\_Y = \omega\_X$ is very close to requiring that $X$ has *rational singularities.* (Actually one definition of rational singularities, typically attributed to Kempf, is that $X$ is Cohen-Macaulay and $\pi\_\* \omega\_Y = \omega\_X$.


A good exercise is to show that if $X = \text{Spec} k[x,y,z]/(x^3+y^3+z^3)$ and $\pi : Y \to X$ is the blowup of the cone point, then $\pi\_\* \omega\_Y = \mathfrak{m} \cdot \omega\_X$ where $\mathfrak{m}$ is the maximal ideal of the origin. (*Hint:* use the adjunction formula and the formula for the canonical divisor when blowing up a point on $\mathbb{A}^3$).


The canonical sheaf
-------------------


Ok, so what is the right definition of the sheaf $\omega\_X$ in general?


Well, for a projective variety of dimension $d$, $i : X \hookrightarrow \mathbb{P}^N$, define
$$i\_\* \omega\_X := \text{Ext}^{N-d}\big(i\_\* O\_X, O\_{\mathbb{P}^N}(-N-1)\big).$$ Since $i$ is a closed embedding, this uniquely determines $\omega\_X$.
For $X$ quasi-projective, you can define this by localizing. There are generalizations which apply to other schemes of finite type over $k$ defined using the $f^!$ functor for $f : X \to k$ the structural map, but I won't get into that here.


The canonical sheaf is S2
-------------------------


It turns out that for any variety, $\omega\_X$ is an S2 sheaf, this means it satisfies Hartog's phenomena (search math overflow). In particular, the sheaf is determined by its codimension-1 behavior. There's an easy way to see this, it turns out that if $h : X \to Z = \mathbb{P^d}$ is a generic projection to a hyperplane of the same dimension, then 
$$h\_\* \omega\_X = \text{Hom}(h\_\* O\_X, O\_Z(-d-1)).$$
Now, it easily follows that this sheaf is S2 since it is reflexive on $Z$ and reflexive sheaves on $Z$ are always S2 (see for example Hartshorne's *Generalized divisors on Gorenstein schemes*).


Why does this matter? Well it means that if $U$ is the regular locus of $X$, and furthermore $X \setminus U$ has codimension 2 on $X$ (which happens for example if $X$ is normal), then if $j : U \hookrightarrow X$ is the inclusion, then $j\_\* \omega\_U = \omega\_X$ since both sheaves are S2 and they agree outside a codimension-2 set.


Back to divisors
----------------


This also explains our first statement about divisors. Indeed, any divisor, like $\pi\_\* K\_Y$ is determined outside a codimension 2 set, it is determined on $U$ in fact. And so if $X$ is normal, $\pi : Y \to X$ is an isomorphism outside of a codimension-2 set of $X$, and so the canonical divisor on that set works fine as a canonical divisor everywhere. In particular, it can be computed on $Y$ as claimed.


For non-normal $Y$, something can be done, but the formula isn't quite so simple (you also have to describe by what exactly you mean by a divisor on a non-normal variety).


