Show $\mathbb{E}Xf(X)=m\mathbb{E}f(X)+\sigma^2\mathbb{E}f'(X)$, for any function $f$, where $X$ is a Gaussian random variable$

65 Views Asked by At

I have the following problem which I am struggling to solve. I have the solution, but I think I am using the formula wrong. Any help would be really appreciated, thanks a lot in advance!

QUESTION: Show $\mathbb{E}Xf(X)=m\mathbb{E}f(X)+\sigma^2\mathbb{E}f'(X)$, for any function $f$, where $X$ is a Gaussian random variable with distribution $N(m,\sigma^2)$.

SOLUTION GIVEN BY PROFESSOR $$\mathbb{E}Xf(X)=\frac{1}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^{\infty}(x-m)f(x)e^{-\frac{(x-m)^2}{2\sigma^2}}dx+\frac{m}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^{\infty}f(x)e^{-\frac{(x-m)^2}{2\sigma^2}}dx$$ $$=-\frac{\sigma^2}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^{\infty}f(x)\frac{d}{dx}e^{-\frac{(x-m)^2}{2\sigma^2}}dx+m\mathbb{E}f(X)$$ $$=\sigma^2\mathbb{E}f'(X)+m\mathbb{E}f(X)$$

WHAT I DON'T UNDERSTAND

As far as I know, the probability density function of $X$ is $p(x)=\frac{1}{\sqrt{2\pi\sigma^2}}e^{-\frac{(x-m)^2}{2\sigma^2}}$, and $$\mathbb{E}X=\int_{-\infty}^{\infty} x p(x)dx$$

So then I assume we would have

$$\mathbb{E}Xf(X)=\int_{-\infty}^{\infty} x f(x) \frac{1}{\sqrt{2\pi\sigma^2}}e^{-\frac{(x-m)^2}{2\sigma^2}} dx$$

If that is correct, how does my professor do the integration by parts? Because if we use $u=x$, $du=dx$, $dv=e^{-\frac{(x-m)^2}{2\sigma^2}}$, I cannot really obtain anything sensible. And if I use $u=e^{-\frac{(x-m)^2}{2\sigma^2}}$, $du=\frac{(m-x)e^{-\frac{(x-m)^2}{2\sigma^2}}}{\sigma^2}$, $dv=x dx$ and $v=x^2$, I still cannot get anything sensible.