  Given two vector bundles E and F on a variety X and a morphism from Sym^2(E)
to F, we compute the cohomology class of the locus in X where the kernel of
this morphism contains a quadric of prescribed rank. Our formulas have many
applications to moduli theory: (i) we find a simple proof of Borcherds' result
that the Hodge class on the moduli space of polarized K3 surfaces of fixed
genus is of Noether-Lefschetz type, (ii) we construct an explicit canonical
divisor on the Hurwitz space parametrizing degree k covers of the projective
line from curves of genus 2k-1, (iii) we provide a closed formula for the Petri
divisor on the moduli space of curves consisting of canonical curves which lie
on a rank 3 quadric and (iv) construct myriads of effective divisors of small
slope on M_g.
