Riemann zeta function functional equation proof explanation

In Riemann zeta function functional equation proof I arrived to a following equation $$\frac{\Gamma\left(\frac{s}2\right) \zeta(s)}{\pi^{\frac{s}2}}=\sum_{n=1}^\infty \int_0^\infty x^{\frac{s}2-1}e^{-n^{2}\pi x}dx,$$ where $s\in \mathbb{C}$ and Re$(s)>1$. Next step is to prove that $$\frac{\Gamma\left(\frac{s}2\right) \zeta(s)}{\pi^{\frac{s}2}}=\int_0^\infty x^{\frac{s}2-1}\sum_{n=1}^\infty e^{-n^{2}\pi x}dx.$$

Why exactly can we change the order of integration and summation? I'm having trouble with this equation, since $s\in \mathbb{C}$. What exactly should I use?

For inverting $\sum$ and $\int$ from scratch the method is always the same (see this discussion), adapted to your problem it gives :
• use that for $x >0$ $$\sum_{n=N}^\infty e^{- \pi n^2 x} < \sum_{n=N}^\infty e^{- \pi n x} = \frac{e^{-\pi N x}}{1-e^{-\pi x}}$$
so that for $Re(s) > 1$ : $$\lim_{N \to \infty} \left|\int_0^\infty x^{s/2-1} \sum_{n=N}^\infty e^{- \pi n^2 x} dx\right| < \lim_{N \to \infty} \int_0^\infty |x^{s/2-1}| \frac{e^{-\pi N x}}{1-e^{-\pi x}} dx = 0$$
• then using that $\int_0^\infty x^{s/2-1} e^{- \pi n^2 x} dx =n^{-s} \int_0^\infty y^{s/2-1} e^{- \pi y} dy$ we get that $$\lim_{N \to \infty} \sum_{n=N}^\infty \int_0^\infty x^{s/2-1} e^{- \pi n^2 x} dx = \lim_{N \to \infty} \sum_{n=N}^\infty n^{-s} \int_0^\infty y^{s/2-1} e^{-\pi y} dy = 0$$
• finally $$\int_0^\infty x^{s/2-1} \sum_{n=1}^\infty e^{- \pi n^2 x} dx = \int_0^\infty x^{s/2-1} \sum_{n=1}^N e^{- \pi n^2 x} dx + \int_0^\infty x^{s/2-1} \sum_{n=N+1}^\infty e^{- \pi n^2 x} dx$$ $$= \sum_{n=1}^N\int_0^\infty x^{s/2-1} e^{- \pi n^2 x} dx + \int_0^\infty x^{s/2-1} \sum_{n=N+1}^\infty e^{- \pi n^2 x} dx$$ $$=\sum_{n=1}^\infty\int_0^\infty x^{s/2-1} e^{- \pi n^2 x} dx - \sum_{n=N+1}^\infty\int_0^\infty x^{s/2-1} e^{- \pi n^2 x} dx + \int_0^\infty x^{s/2-1} \sum_{n=N+1}^\infty e^{- \pi n^2 x} dx$$ and let $N \to \infty$