I know the definition of $K_X$ on a normal, singular variety, but I don't have a good set of examples in my mind. What's an example of a variety where $K_X$ is $\mathbb Q$Cartier but not Cartier? Are there any conditions under which an adjunction formula lets me compute the canonical class of a singular divisor?
Note: I added an addendum below in response to quinque's comment and the subsequent discussion of the issue (s)he raised on math.stackexchange (see the link in quinque's comment).
An easy way to produce a $\mathbb Q$Cartier but not Cartier canonical divisor is by a quotient. For instance for the quotient $$X=\mathbb A^3/(x,y,z)\sim (x,y,z)$$ $2K_X$ is Cartier, but $K_X$ is not.
I leave it for you to prove that $2K_X$ is Cartier. Here is how to see that $K_X$ is not: Clearly $X={\rm Spec}k[x^2,y^2,z^2,xy,yz,xz]$ in other words, $X$ is the affine cone over the Veronese surface $\mathbb P^2\simeq V\subset \mathbb P^5$. Blowing up the cone point gives a resolution of singularities $\pi: Y\to X$ with exceptional divisor $E\simeq V$. In fact $E^2\sim 2L$ where $L$ is the class of a line. This follows by considering the blow up as a blow up of the ambient $\mathbb A^6$ (the cone over $\mathbb P^5$) and noticing that the square of the exceptional divisor of the blow up of $\mathbb A^6$ is $1$times the hyperplane in $\mathbb P^5$ which restricts to a conic on $Y$. Now write $$K_Y\sim_{\mathbb Q} \pi^*K_X + aE \tag{$\star$}$$ and use the adjunction formula ($Y$ is smooth!) to get $$ (a+1)E^2\sim K_E=K_{\mathbb P^2} \sim 3L. $$ Solving for $a$ shows that $a=\dfrac 12$ which shows that $K_X$ cannot be Cartier.
Addendum (a.k.a. Intermezzo): quinque raised the interesting point that $\dfrac 12 E$ is actually $\mathbb Q$linearly equivalent to a Cartier divisor, so (s)he was worried that then the above does not prove that $K_X$ is not Cartier. It actually does, but this points to an interesting consequence, namely that this means that $\pi^*K_X$ is actually numerically equivalent to a Cartier divisor, so using only intersection numbers one will not be able to prove that it is not Cartier.
Anyway, here is why the above implies that $K_X$ is not Cartier: Suppose it is. That means that $\omega_X$ is the trivial line bundle in a neighborhood of the singular point. Consider the pullback of a local generator. On $Y\setminus E$ this will generate $\omega_Y$ and hence the corresponding (integral!) divisor $\pi^*K_X$ is equal (not just linearly equivalent!!) to $K_Y+bE$ for some $b\in \mathbb Z$. Then the same calculation as above implies that $b=a=\dfrac 12$ which is a contradiction.
The point is that if $K_X$ is Cartier, then ($\star$) holds with linear equivalence, and in fact with equality, instead of $\mathbb Q$linear equivalence and hence $a$ has to be an integer in that case.
Also interesting to note that the same construction does not give a desired example in dimension $2$: The quotient $\mathbb A^2/(x,y)\sim(x,y)$ is a cone over a conic which is a surface in $\mathbb P^3$. In particular it is Gorenstein and hence $K_X$ is Cartier.
On the other hand, one gets a $2$dimensional example by $\mathbb A^2/\mu_3$ where $\mu_3$ acts by multiplication by a primitive third root of unity. The proof is essentially the same as above. It is relatively easy to see (just as above) that this is the same as the cone over a twisted cubic.
As for the adjunction formula, it definitely works as long as $K_X+D$ is Cartier and it works up to torsion if it is $\mathbb Q$Cartier. If it is not $\mathbb Q$Cartier, it is not clear what the adjunction formula should mean, but even then one can have a sort of adjunction formula involving $\mathscr Ext$'s but this is almost Grothendieck Duality then.

$\begingroup$ Sandor, I'm confused, you still have some sort of adjunction formula (in my answer below). What you might have trouble with is saying things like $n(K_Y + K_X)_X = n K_X$ (one doesn't have equality in general), but that's a slightly different issue in my mind. $\endgroup$ – Karl Schwede Feb 15 '11 at 16:36

$\begingroup$ Karl, I think we agree in the essence, it's a matter of terminology. My main point was that if it is not $\mathbb Q$Cartier, then one has to be careful what the restriction means. $\endgroup$ – Sándor Kovács Feb 15 '11 at 16:42

$\begingroup$ Ah, or perhaps you intended, $K_X + D$. It's not quite clear what the original questioner meant. $\endgroup$ – Karl Schwede Feb 15 '11 at 16:55

$\begingroup$ Yes and yes. I need a personal errorcatcher... $\endgroup$ – Sándor Kovács Feb 15 '11 at 16:57

$\begingroup$ Great, thank you for the answer! I think the 2 in the displayed adjunction should read 3, but indeed a=1/2. $\endgroup$ – Anonymous Feb 15 '11 at 17:21
Probably the easiest example is $X = \operatorname{Spec} k[x^3, x^2y, xy^2, y^3]$. In this case, $K_X$ is not Cartier, but $3K_X$ is Cartier.
In what way do you have in mind computing the canonical class of a singular divisor? The adjunction formula basically always works assuming things are sufficiently normal.
In particular, one always has the following sequence if you assume that $X$ is a divisor in a normal ambient variety $Y$. $$0 \to \omega_Y \to \omega_Y(X) \to \omega_X \to h^1(\omega_Y^{\bullet}) \to \cdots .$$
If $Y$ is CohenMacaulay, then the $h^1$ vanishes, if $X$ is normal, then $\omega_X$ can be viewed as a divisor class, and we've obtained some sort of adjunction formula. However, we don't really need those hypotheses.
More generally if $Y$ is normal but not necessarily CohenMacaulay, it is CohenMacaulay outside a set of codimension at least 3 (because $Y$ is S2). Thus $h^1(\omega_Y^{\bullet})$ (the first cohomology of the dualizing complex of $Y$) is supported at a codimension 3 (or more) subset. In particular, the map $\omega_Y(X) \to \omega_X$ is surjective in codimension 2 on $Y$ and so surjective in codimension 1 on $X$.
This is enough to compute the canonical class of $X$ because $\omega_X$ is always S2 (if $X$ is S1, which a reduced scheme is). Thus $\omega_X$ is determined by its codimension 1 behavior, which we can completely determine by the above short exact sequence.
EDIT1: This sort of restriction stuff is certainly contained in chapter 16 of Kollár et al's "Flips and abundance for algebraic threefolds" book.
EDIT2: One should be slightly careful about saying $(K_Y + X)_X = K_X$. It can be a little hard to make sense of the restriction of $K_Y + X$ when $K_Y + X$ isn't Cartier or $\mathbb{Q}$Cartier (at least at the codimension 1 points of $X \subseteq Y$). This is what Sándor is talking about. However, you always have the exact sequence above and so one can always in some sense still compute $\omega_X$.

$\begingroup$ The dot on your dualizing complex is barely visible, but I am not sure what one can do about it. :( I have a macro named \kdot to produce a better looking dot, but it might be too elaborate for the online LaTeX engine. (\kdot="Karl's dot" :) $\endgroup$ – Sándor Kovács Feb 15 '11 at 16:47

$\begingroup$ Sandor, thanks. I made it a \bullet, I suspect the rendering here would probably die on the circle command I/we usually use for those dots. $\endgroup$ – Karl Schwede Feb 15 '11 at 16:52

$\begingroup$ Ah, thanks for the help! That clears up my adjunction confusion. $\endgroup$ – Anonymous Feb 15 '11 at 17:22
Here is a more algebraic perspective on your question. If $X=\text{Spec} (R)$ is affine and $R$ is a CohenMacaulay algebra over some field (the following is true in more general setting), then $K_X$ is Cartier is equivalent to $R$ is Gorenstein. On the other hand, $K_X$ is $\mathbb Q$Cartier is the same as the class of $K_X$ is torsion in the divisor class group (assuming $R$ is normal).
So to find a class of examples, you need normal CohenMacaulay rings with torsion class group but not Gorenstein. If $R$ is a Veronese $S^{(d)}$ of $S=\mathbb C[x_1,\cdots, x_n]$ then $Cl(R)$ is always torsion, but $R$ is Gorenstein if and only if $dn$ (Sandor's example is indeed the simplest one in this class, with $d=2, n=3$).

$\begingroup$ Karl, you are right, I am just about to add CohenMacaulay $\endgroup$ – Hailong Dao Feb 15 '11 at 16:53

1$\begingroup$ Long, by the way this is just a question of terminology (and I know different people ahve differing opinions on this), when you say $\mathbb{Q}$Gorenstein, do you always assume CohenMacaulay? $\endgroup$ – Karl Schwede Feb 15 '11 at 17:04

6$\begingroup$ Karl, I think generally $\mathbb Q$Gorenstein does not mean CohenMacaulay, but this is confusing for many. I know that when I first saw it as a graduate student, I did not understand the difference between $1$Gorenstein and Gorenstein. The main problem is that many people do not realize that this is even an issue. I was once asked after a talk why I kept saying that $K_X$ was Cartier instead "simply" saying that $X$ was Gorenstein... As far as "quasiGorenstein" is concerned I always thought it was only known by commutative algebraists, but apparently it is not even widely known among them. $\endgroup$ – Sándor Kovács Feb 15 '11 at 20:07

1$\begingroup$ One more thing about this: Kollár very much dislikes the accepted usage of $\mathbb Q$Gorenstein. He thinks it should mean $K_X$ is $\mathbb Q$Cartier and $X$ is CohenMacaulay. I agree with that, but I think it is too late for that. $\endgroup$ – Sándor Kovács Feb 15 '11 at 20:08

2$\begingroup$ @Sandor: +1 for "most people do not realize that this is even an issue". As for quasiGorenstein, I think it is a bit unfair to deduce from my ignorance that it is not wellknown among commutative algebraists (: May be they all know it, just didn't tel me! $\endgroup$ – Hailong Dao Feb 15 '11 at 20:14