David Eisenbud, Sorin Popescu, and Charles Walter
We show that a subcanonical subscheme $Z\subset X$ of codimension $3$ satisfying a mild cohomological condition can be realized as the locus along which two Lagrangian subbundles of a twisted orthogonal bundle meet degenerately (and vice versa). The extra condition always holds when $X$ is a projective space (and considerably more generally; all we need is the vanishing of a certain class in a cohomology group of a line bundle). In the local case our structure theorems reduce to that of Buchsbaum-Eisenbud and say that $Z$ is Pfaffian. An important technical point is that pairs of Lagrangian subbundles can be transformed into locally alternating maps of vector bundles, allowing us to define natural scheme structures on Lagrangian degeneracy loci. In the last section of the paper we prove codimension one symmetric and skew-symmetric analogues of our structure theorems.