In the link https://en.wikipedia.org/wiki/Common_integrals_in_quantum_field_theory, it is written without proof that $$ \int \exp\left(-\frac{i}{2} x \cdot A \cdot x +iJ \cdot x \right) d^nx =\sqrt{\frac{(2\pi i)^n}{\det A}} \exp \left( -{i\over 2} J \cdot A^{-1} \cdot J \right), $$ where $A$ is a real symmetric matrix and the integration domain is over $\mathbb{R}^n$. This integral looks quite trivial, but it has a puzzling aspect that I am going to describe now.
First of all, let's consider the two dimensional case where $A_{11} = a$, $A_{12} = A_{21} = b$ and $A_{22} = c$ with $J=0$. In this case, the above integral can be simplified as $$ I= \int \exp\left( -\frac{i}{2} \left[ a x^2 + 2 b x y + c y^2 \right] \right)dx dy. $$
Now, I want to integrate this equation one by one with regard to $x$ and then $y$. If we perform the integrals, one arrives at $$ I = \sqrt{\frac{2\pi i}{a}} \int dy e^{\frac{i y^2 \left(a c-b^2\right)}{a}} = \sqrt{\frac{2\pi i}{a}} \sqrt{\frac{a \times 2\pi i}{\det A}} = \sqrt{ \frac{4\pi^2}{|\det A|}} \times e^{(\textrm{sgn}(a) + \textrm{sgn}(\det A /a)) \frac{\pi i}{4}}, $$ where the square root takes the principle value from the Fresnel integral calculation shown in https://en.wikipedia.org/wiki/Fresnel_integral. What puzzles me now is the sign dependence of $a$, thus the existence of $\textrm{sgn}(a)$. Even worse, if we choose the different integration order, thus with respect to $y$ first and then $x$, we have different result, which is given by $$ I = \sqrt{ \frac{4\pi^2}{|\det A|}} \times e^{(\textrm{sgn}(c) + \textrm{sgn}(\det A /c))\frac{\pi i}{4}}. $$ This is clearly not acceptable. There must be some gap above or the integral is defined in an unusual sense. Can you explain what is going on? Is $I$ well-defined? Also, or directly, can you point out the direct proof of the first equality?