Example of a variety with $K_X$ $\mathbb Q$-Cartier but not Cartier 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?
 A: Here is a more algebraic perspective on your question. If $X=\text{Spec} (R)$ is affine and $R$ is a Cohen-Macaulay 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 Cohen-Macaulay 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 $d|n$ (Sandor's example is indeed the simplest one in this class, with $d=2, n=3$).   
A: 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 pull-back 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.
A: 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 Cohen-Macaulay, 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 Cohen-Macaulay, it is Cohen-Macaulay 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$.
