  Based on a theoretical model where the nuclear spins remain unchanged during
a collision, we provide an analytical and general expression for the nuclear
spin state-to-state distribution of an ultracold chemical reaction in a
magnetic field, for given rotational transitions of the molecules. It simply
requires knowledge of the field-dependent eigenfunctions of the molecular
reactants and products of the chemical reaction. The final state-to-state
distribution drastically changes with the magnetic field. When the distribution
is summed over all the final products, a simplified expression is found where
only the knowledge of the eigenfunctions of the molecular reactants is
required. The present theoretical formalism has been successfully used to
explain the magnetic field behavior of the product-state distribution in
chemical reactions of ultracold KRb molecules [Hu et al., Nat. Chem. 13, 435
(2021)].
