A query about Poisson summation and matrices I am trying to reproduce a proof I saw a while ago and it requires an equality similar to the following. Here $M$ is a real-valued positive semi-definite matrix.
$$\sum_{x \in \mathbb{Z}^n}e^{-x^TMx} = \sqrt{\frac{\pi^n}{\det(M)}}\sum_{x\in \mathbb{Z}^n}e^{-\pi x^TM^{-1}x}$$
Is this the correct and how would one prove it?
 A: I will show the result under the assumption that $M$ is a symmetric and positive definite matrix.

To derive the formula we compute the Fourier transform of the function $$f({\bf x}) = e^{-{\bf x}^TM{\bf x}}$$ and apply Poissons summation formula. 
Because of the properities we assumed about $M$ we can decompose it as $M = P^TDP$ where $P$ is orthogonal and $D$ is diagonal. Take ${\bf y}=P{\bf x}$ then ${\bf x}^TM{\bf x} = {\bf y}^TD{\bf y}$ and since orthogonal matrices preserve the innerproduct we have ${\bf k}\cdot {\bf x} = {\bf k}\cdot (P^T{\bf y}) = (P{\bf k})\cdot {\bf y}$. The Fourier transform of $f$ is given by
$$\mathcal{F}({\bf k}) = \int e^{-2\pi i {\bf k}\cdot {\bf x}} e^{-{\bf x}^TM{\bf x}}{\rm d}^nx = \frac{1}{\det P}\int e^{-2\pi i {\bf y}\cdot (P{\bf k})}e^{-{\bf y}^TD{\bf y}}{\rm d}^ny$$
where we have performed a change of variables ${\bf y} = P{\bf x} \implies \left|\frac{\partial x}{\partial y}\right| = (\det P)^{-1}$ to reach the last equality. The integral above factors into a product of $n$ Gaussian integrals
$$\mathcal{F}({\bf k}) = \frac{1}{\det P}\prod_{j=1}^n\int e^{-2\pi i y_j\cdot (P{\bf k})_j}e^{-D_jy_j^2}{\rm d}y_j = \frac{1}{\det P} \prod_{j=1}^n \frac{1}{\sqrt{D_j}}e^{-\frac{\pi^2 (P{\bf k})_j^2}{D_j}}\int e^{-\left(y_j\sqrt{D_j}+\frac{\pi i(P{\bf k})_j}{\sqrt{D_j}}\right)^2} {\rm d}(y_j\sqrt{D_j})\\=\sqrt{\frac{\pi^n}{\det M}} e^{-\pi^2 {\bf k}^T M^{-1}{\bf k}}$$
where we completed the square in the exponentials and evaluated the integrals using the well-known result $\int e^{-(z+a)^2}{\rm d}z = \sqrt{\pi}$ valid for all $a\in\mathbb{C}$. We have also used $\det M = \det D = D_1D_2\cdots D_n$ (since $D$ is diagonal), $\det P = 1$ since $P$ is orthogonal and lastly
$$\sum_{j=1}^n \frac{(P{\bf k})_j^2}{D_j} = (P{\bf k})^T(D^{-1}P{\bf k}) = {\bf k}^T (P^TD^{-1}P){\bf k} = {\bf k}^TM^{-1}{\bf k}$$
Finally applying Poissons summation formula we arrive at the desired result
$$\sum_{{\bf x} \in \mathbb{Z}^n}e^{-{\bf x}^TM{\bf x}} =  \sqrt{\frac{\pi^n}{\det M}} \sum_{{\bf k} \in \mathbb{Z}^n} e^{-\pi^2 {\bf k}^T M^{-1}{\bf k}}$$

About the assumptions on $M$: the question does not say that $M$ has to be symmetric, however one can find counter-examples where $M$ is positive definite but not symmetric for which the result fails, see the Mathematica code below for an example.
(* Define matrix *)
M = {{0.7, 0.2}, {0.2, 0.3}}; (* Symmetric positive definite matrix *)
(* Non-symmetric positive definite counter-example: M = {{0.7,0.25}, {0.2,0.3}} *)
Minv = Inverse[M];
xvec = {x, y};

(* Check that A is symmetric, the eigenvalues are positive and det A < 1*)
eig = Eigenvalues[M];

(* Check conditions on M *)
If[eig[[1]] < 0 || eig[[2]] < 0 || Det[M] >= 1 || M[[1, 2]] != M[[2, 1]], 
  Print["Matrix does not satisfy all conditions"];
];

(* Compute LHS - RHS *)
nmax = 200;
diff = Sum[Exp[-xvec.M.xvec], {x, -nmax, nmax}, {y, -nmax, nmax}] - Sqrt[\[Pi]^2/Det[M]] Sum[ Exp[-\[Pi]^2 xvec.Minv.xvec], {x, -nmax, nmax}, {y, -nmax, nmax}];
Print["LHS - RHS = ", diff];

