How to compute $\int_{[-1,1]\times \cdots \times [-1,1]} \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}(a^Tx-b)^2}dx$? The integrand is nothing but a Gaussian/Normal distribution of $b$, where $b \in \mathbb{R}$ and $a,x \in \mathbb{R}^p$. Is there a way to compute the integral without expanding the square, which has $(1+p)^2$ terms?
Also,how about $\int_{[-1,1]\times \cdots \times [-1,1]} x\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}(a^Tx-b)^2}dx$? The result of this integral should be a vector in $\mathbb{R}^p$.
I guess the solution is to first write the integrand as a multivariate Gaussian in $\mathbb{R}^p$. I tried but got stuck.
 A: The first integral diverges, because the integrand is constant in directions orthogonal to $a$. The second is even worse: it grows in magnitude in directions orthogonal to $a$.
EDIT: If you integrate over $[-1,1]^p$, you get a really complicated answer involving exponentials and the error function.  Here's the case $p=2$, according to Maple:
$$1/2\,{\frac {\sqrt {2}\sqrt {\pi } \left( -a_{{1}}-a_{{2}}+b \right) 
{{\rm erf}\left(-1/2\,\sqrt {2}a_{{1}}-1/2\,\sqrt {2}a_{{2}}+1/2\,\sqrt {2}b\right)}
}{a_{{2}}a_{{1}}}}-1/2\,{\frac {\sqrt {2}\sqrt {\pi } \left( -a_{{1}}+
a_{{2}}+b \right) 
{{\rm erf}\left(-1/2\,\sqrt {2}a_{{1}}+1/2\,\sqrt {2}a_{{2}}+1/2\,\sqrt {2}b\right)}
}{a_{{2}}a_{{1}}}}-1/2\,{\frac {\sqrt {2}\sqrt {\pi } \left( a_{{1}}-a
_{{2}}+b \right) 
{{\rm erf}\left(1/2\,\sqrt {2}a_{{1}}-1/2\,\sqrt {2}a_{{2}}+1/2\,\sqrt {2}b\right)}
}{a_{{2}}a_{{1}}}}+1/2\,{\frac {\sqrt {2}\sqrt {\pi } \left( a_{{1}}+a
_{{2}}+b \right) 
{{\rm erf}\left(1/2\,\sqrt {2}a_{{1}}+1/2\,\sqrt {2}a_{{2}}+1/2\,\sqrt {2}b\right)}
}{a_{{2}}a_{{1}}}}-{\frac { \left( -{{\rm e}^{-1/2\,{a_{{1}}}^{2}-1/2
\,{a_{{2}}}^{2}-1/2\,{b}^{2}}}-{{\rm e}^{-1/2\,{a_{{1}}}^{2}+2\,a_{{1}
}b-1/2\,{a_{{2}}}^{2}+2\,a_{{2}}b-1/2\,{b}^{2}}}+{{\rm e}^{-1/2\,{a_{{
1}}}^{2}+2\,a_{{2}}a_{{1}}+2\,a_{{1}}b-1/2\,{a_{{2}}}^{2}-1/2\,{b}^{2}
}}+{{\rm e}^{-1/2\,{a_{{1}}}^{2}+2\,a_{{2}}a_{{1}}-1/2\,{a_{{2}}}^{2}+
2\,a_{{2}}b-1/2\,{b}^{2}}} \right) {{\rm e}^{-a_{{2}}a_{{1}}-a_{{1}}b-
a_{{2}}b}}}{a_{{2}}a_{{1}}}}
$$
