  H$_2$CO ice on dust grains is an important precursor of complex organic
molecules (COMs). H$_2$CO gas can be readily observed in protoplanetary disks
and may be used to trace COM chemistry. However, its utility as a COM probe is
currently limited by a lack of constraints on the relative contributions of two
different formation pathways: on icy grain-surfaces and in the gas-phase. We
use archival ALMA observations of the resolved distribution of H$_2$CO emission
in the disk around the young low-mass star DM Tau to assess the relative
importance of these formation routes. The observed H$_2$CO emission has a
centrally peaked and radially broad brightness profile (extending out to 500
AU). We compare these observations with disk chemistry models with and without
grain-surface formation reactions, and find that both gas and grain-surface
chemistry are necessary to explain the spatial distribution of the emission.
Gas-phase H$_2$CO production is responsible for the observed central peak,
while grain-surface chemistry is required to reproduce the emission exterior to
the CO snowline (where H$_2$CO mainly forms through the hydrogenation of CO ice
before being non-thermally desorbed). These observations demonstrate that both
gas and grain-surface pathways contribute to the observed H$_2$CO in disks, and
that their relative contributions depend strongly on distance from the host
star.
