For $X \subseteq \mathbb{P}^n$ a smooth hypersurface, the canonical divisor $K_X$ can be computed as $$ K_X = (K_{\mathbb{P}^n} + X)|_X. $$ Is there a similar formula where $X$ is of higher codimension?
If necessary we can assume $X$ to be a surface over the complex numbers, in particular it is a complex analytic manifold.
Thanks!
The adjunction formula is a very general, pleasant, result valid for any complex submanifold $X\subset Z$ of codimension $r$ of any complex manifold $Z$ (projectivity is irrelevant).
It computes the canonical bundle $K_X=\wedge ^{dim X}(TX)^*$ of the submanifold $X$ and reads $$ K_X=K_Z|X\otimes \wedge^r N $$ where $N=N_Z(X)$ is the normal bundle of $X$ in $Z$, defined by $N=\frac{TZ|X}{TX}$.
Ah, you will say, such a beautiful, extremely general theorem, must be quite difficult to prove, must it not?
Not at all! As is surprisingly often the case, the theorem boils down to (multi)linear algebra: any exact sequence of vector spaces $0\to F\to E\to Q\to$ gives rise to a canonical isomorphism between determinants $$det E=det F\otimes det Q$$ ( where $det E=\wedge ^{dim E}E$, etc.)
We can globalize this formula to vector bundles, apply it to the exact sequence $$0\to N^*\to T^*Z|X\to T^*X\to 0$$ (which is the dual of the sequence defining the normal bundle) and obtain $$ K_Z|X=\wedge^rN^*\otimes K_X $$ Tensoring both sides with $\wedge^r N$, the dual line bundle to $\wedge^rN^*$, then immediately gives the promised adjunction formula $K_X=K_Z|X\otimes \wedge^r N$.
Et voilà!