Product formulas for quadratic forms