A while ago (last summer, I guess) I came across the phrase Serre's diagonal trick in the article Hochschild (co)homology of schemes and with tilting object, by Ragnar Buchweitz and Lutz Hille. This terminology really intrigued me, as I couldn't understand back then what it actually meant just from the notation, nor did I have the background to know what it was.

In the article the trick is described as

[...] the identification of functors $\mathbf{L}\Delta^*(-\boxtimes-)\cong-\otimes_X^{\mathbf{L}}-$.

At the end of this post I hope this will make some more sense.

One of the many master pieces of Jean-Pierre Serre is his Algèbre locale. In this book from 1965, based on lectures he gave in 1957–1958, the algebraic aspects of intersection theory are treated in a really nice way. The first paragraph in section V.B) is titled La réduction à la diagonale, and in it we read

Soient $k$ un corps commutatif algébriquement clos, $U$ and $V$ deux ensembles algébriques de l'espace affine $\mathbb{A}_k^n\cong k^n$, et $\Delta$ la diagonale de l'espace produit $\mathbb{A}_k^n\times\mathbb{A}_k^n\cong\mathbb{A}_k^{2n}$. Alors $\Delta$ est évidemment isomorphe à $\mathbb{A}_k^n$ et l'isomorphisme identifie $(U\times V)\cap\Delta$ à $U\cap V$. Les "géomètres" se servent couramment de cette situation pour ramener l'étude de l'intersection de $U$ et $V$ à l'étude de l'intersection d'un ensemble algébrique avec une variété linéaire.

If anyone can tell me about an earlier reference to the diagonal trick, please do. The remainder of the paragraph explains the actual workings of the trick. Algebraically speaking the intersection is described by the fiber product (or tensor product) $A/\mathfrak{p}\otimes_A A/\mathfrak{q}$. But we can obtain the isomorphism

(1) $A/\mathfrak{p}\otimes_A A/\mathfrak{q}\cong \left( A/\mathfrak{p}\otimes_k A/\mathfrak{q} \right)\otimes_{A\otimes_kA}A$

So it seems like we have replaced our original tensor product by a more difficult tensor product, as the base ring over which we tensor seems more complicated. Remark that on the right we have identified $A$ with the diagonal inside $A\otimes_kA$ (which is the ring of regular functions on the product of our ambient variety with itself).

But to compute the intersection multiplicity Serre has previously shown that one needs to compute the derived functors of the tensor product. Using this isomorphism we have a good way of computing this: if we work in a sufficiently nice ambient variety (i.e. take $A=k[x_1,\dotsc,x_n]$ we have a truly obvious way of finding a free resolution of the factor $A$ in this tensor product, we take the Koszul complex! In some sense we take consecutive hyperplane sections, which is a rather easy thing to do.

So what is sometimes called Serre's diagonal trick is better known as reduction to the diagonal.

The interpretation of the identification of those two functors remains. The left-hand side of (1) corresponds to $-\otimes_X^{\mathbf{L}}-$: we have replaced the tensor product (of which we wish to compute the Tor's) by the derived tensor product (the object whose cohomologies are exactly those Tor's), which in the philosophy of derived categories is the correct thing to do. So remains to interpret $\mathbf{L}\Delta^*(-\boxtimes-)$. The funny product $\boxtimes$ is given by $p^*(-)\otimes_X^{\mathbf{L}} q^*(-)$, where $p$ and $q$ are the projections $p,q\colon X\times X\to X$. So this computes the product of the intersecting subvarieties inside $X\times X$. Then $\mathbf{L}\Delta^*$ is the base change to the diagonal, which is isomorphic to $X$. Hence we obtain something on $X$, which will represent the intersection we are trying to compute. So the identification of functors is just a fancy way of writing the isomorphism of algebras (1) in terms of derived categories.

This trick also pops up in the context of exceptional collections on $\mathbb{P}_k^n$, a subject I might write about later.