A problem about the convergence of an improper integral Let $f:\mathbb R\longrightarrow\mathbb R$ be a function with 
$$f(x)=\frac{1}{3}\int_x^{x+3} e^{-t^2}dt$$
and consider  $g(x)=x^nf(x)$ where $n\in\mathbb Z$. 

I have to discuss the convergence of the integral 
  $$\int_{-\infty}^{+\infty}g(x)dx$$ at the varying of $n\in\mathbb Z$.

Any idea? We have an integral of an "integral function", and I'm a bit confused!
Thanks in advance.

I think I can give you expression for $\int_{-\infty}^{\infty}g(x)\ dx$. Then, we can think about how it should converge.
We start by noting that $$\large f(x)=\frac{\sqrt{\pi}}{3}\left(Q\left(\sqrt{2}x\right)-Q\left(\sqrt{2}(x+3)\right)\right)$$ and $$\large f(-x)=\frac{\sqrt{\pi}}{3}\left(-Q\left(\sqrt{2}x\right)+Q\left(\sqrt{2}(x-3)\right)\right)$$
Also we keep in mind that  $$\large I=\int_{-\infty}^{\infty}g(x)\ dx=\int_{-\infty}^{\infty}x^nf(x)\ dx\\ \large =\int_{0}^{\infty}\left(x^nf(x)+(-x)^nf(-x)\right)\ dx $$
Case $1$: $n$ even 
In this case, 
\begin{equation}
\large
\begin{split}
I=&\int_{0}^{\infty}x^n\left(f(x)+f(-x)\right)\ dx\\
\ =& \frac{\sqrt{\pi}}{3}\int_{0}^{\infty}x^n\left(Q\left(\sqrt{2}(x-3)\right)-Q\left(\sqrt{2}(x+3)\right)\right)\ dx\\
\ =& \frac{\sqrt{\pi}}{3}\int_{0}^{\infty}\frac{x^n}{\sqrt{2\pi}}\int_{\sqrt{2}(x-3)}^{\sqrt{2}(x+3)}\exp\left({-\frac{u^2}{2}}\right)\ du \ dx\\
\ =&\frac{1}{3}\int_{0}^{\infty}x^n\int_{x-3}^{x+3}\exp\left({-\frac{u^2}{2}}\right)\ du \ dx\\
\end{split}
\end{equation}
Now, if the order of integration is changed then, as one can verify without much difficulty, we get the following two integrals $$\large I=I_1+I_2$$ where $$\large I_1=\frac{1}{3}\int_{-3}^{3}e^{-u^2}\int_{0}^{u+3}x^n\ dx\ du\\
\large =\frac{1}{3(n+1)}\int_{-3}^{3}e^{-u^2}(u+3)^{n+1}\ du\\ \large =\frac{1}{3(n+1)}\int_{0}^{3}e^{-u^2}\left\{(u+3)^{n+1}-(u-3)^{n+1}\right\} \ du\\ \large (\mbox{Since}\  n \ \mbox{is even})\\
\large I_2=\frac{1}{3}\int_{3}^{\infty}e^{-u^2}\int_{u-3}^{u+3}x^n\ dx\ du\\
\large =\frac{1}{3(n+1)}\int_{3}^{\infty}e^{-u^2}\left\{(u+3)^{n+1}-(u-3)^{n+1}\right\} \ du$$
Then,
\begin{equation}
\large
\begin{split}
I=& I_1+I_2\\
\ =& \frac{1}{3(n+1)}\int_{0}^{\infty}e^{-u^2}\left\{(u+3)^{n+1}-(u-3)^{n+1}\right\} \ du\\
\ =& \frac{1}{3(n+1)}\int_{-\infty}^{\infty}e^{-u^2}(u+3)^{n+1} \ du\ (\mbox{Since}\ n \ \mbox{is even})\\
\ =& \frac{1}{3(n+1)}\int_{-\infty}^{\infty}e^{-(u-3)^2}u^{n+1} \ du\\
\ =& \frac{\sqrt{\pi}}{3(n+1)}\mathbb{E}(X^{n+1})
\end{split}
\end{equation} where $\displaystyle X\sim \mathcal{N}\left(3,\frac{1}{2}\right)$. 
Case $2$: $n$ odd
In this case, 
\begin{equation}
\large
\begin{split}
I=& \int_{0}^{\infty}x^n(f(x)-f(-x))\ dx\\
\ =& \frac{\sqrt{\pi}}{3}\int_{0}^{\infty}x^n
\left[2Q\left(\sqrt{2}x\right)-Q\left(\sqrt{2}(x+3)\right)-Q\left(\sqrt{2}(x-3)\right)\right]\ dx\\
\ =& \frac{2I_2-(I_1+I_3)}{3}\\
\end{split}
\end{equation}
Now, \begin{equation}
\large
\begin{split}
I_1=&\sqrt{\pi}\int_{0}^{\infty}x^nQ\left(\sqrt{2}(x+3)\right)\ dx\\
\ =&\int_{0}^{\infty}x^n \int_{x+3}^{\infty}\exp\left(-u^2\right)\ du \ dx\\
\ =&\int_{3}^{\infty}\exp\left(-u^2\right) \int_{0}^{u-3}x^n\ dx \ du\ (\small \mbox{Interchanging order of integration})\\
\ =&\frac{1}{n+1}\int_{3}^{\infty}\exp\left(-u^2\right)(u-3)^{n+1} \ du\\
\ =&\frac{1}{n+1}\int_{3}^{\infty}\exp\left(-(u+3)^2\right)u^{n+1} \ du\\
\ =&\frac{1}{n+1}\int_{-\infty}^{0}\exp\left(-(u-3)^2\right)u^{n+1} \ du\ (\because\ n\ \mbox{is odd})\\
\end{split}
\end{equation}
Similarly, we will get $$\large I_3=\frac{1}{n+1}\int_{0}^{\infty}\exp\left(-(u-3)^2\right)u^{n+1} \ du$$
and \begin{equation}
\begin{split}
I_2=&\int_{0}^{\infty}\exp\left(-u^2\right) \int_{0}^{u}x^n\ dx \ du\\
\ =&\frac{1}{n+1}\int_{0}^{\infty}\exp\left(-u^2\right) u^{n+1} \ du\\
\ =&\frac{1}{2(n+1)}\Gamma\left(1+\frac{n}{2}\right)
\end{split}
\end{equation}
So, $$\large I=\frac{\Gamma\left(1+\frac{n}{2}\right)-\int_{-\infty}^{\infty}\exp\left(-(u-3)^2\right)u^{n+1} \ du}{3(n+1)}\\
\large =\frac{\sqrt{\pi}}{3(n+1)}\left(\frac{(2n-1)!!}{2^n}-\mathbb{E}\left(X^{n+1}\right)\right)\\
\large =\frac{\sqrt{\pi}}{3(n+1)}\left(\mathbb{E}(Y^{2n})-\mathbb{E}\left(X^{n+1}\right)\right)$$ where $\displaystyle X\sim \mathcal{N}\left(3,\frac{1}{2}\right),\ Y\sim \mathcal{N}\left(0,\frac{1}{2}\right)$.
