Decomposition of quadratic functions into a product