Show that $E[g(X)(X-\theta)]=\sigma^2 E[g'(X)]$. Let $X$ have normal distribution with mean $\theta$ and variance $\sigma^2$ and let $g$ be a differentiable function satisfying $E\mid g'(X)\mid <\infty$. Show that $E[g(X)(X-\theta)]=\sigma^2 E[g'(X)]$.
Thoughts: I want to use the definition of expectation by using integration by parts. However, I run into two problems: 1. After I used the integration by parts, I don't know how to evaluate the term at boundary, i.e. at the infinity. 2. For the expectation of $g'$, it seems I CANNOT use integration by parts since I don't know whether $g$ has second order derivative.
Update 1: $E[g(X)(X-\theta)]=\int g(x)(x-\theta)dF(x)=g(x)(x-\theta)F(x)\mid_{-\infty}^{\infty}-\int F(x)[g(x)+(x-\theta)g'(x)]dx$
Thank you.
 A: Without loss of generality, let's assume $\theta = 0$ and $\sigma = 1$ for simplicity (for the general case, consider the transformation $Z = \frac{X - \theta}{\sigma}$).
Rigorously, we have to show $E[|g(X)X|] < \infty$ at beginning. Indeed, denote $\frac{1}{\sqrt{2\pi}}$ by $c$, it follows that
\begin{align}
& E[|g(X)X|] \\
= & \int_{-\infty}^\infty |xg(x)|ce^{-x^2/2} dx \\
= & -\int_{-\infty}^0 |g(x)|x c e^{-x^2/2} dx + \int_0^\infty |g(x)|x c e^{-x^2/2} dx
\end{align}
Let's analyze the latter term in detail. By fundamental theorem of calculus, $g(x) = g(0) + \int_0^x g'(t) dt$. Therefore,
\begin{align}
& \int_0^\infty |g(x)|x c e^{-x^2/2} dx \\
= & \int_0^\infty \left|g(0) + \int_0^x g'(t) dt\right|x c e^{-x^2/2} dx \\
\leq & \int_0^\infty |g(0)| x c e^{-x^2/2} dx + \int_0^\infty \left[\int_0^x |g'(t)|dt\right] x c e^{-x^2/2} dx \\
\end{align}
The first term of the right hand side of the above expression is clearly finite. By Tonelli's theorem, the second term of that equals to 
\begin{align}
& c\int_0^\infty \left[\int_t^\infty xe^{-x^2/2}dx\right]|g'(t)|dt \\
= & c \int_0^\infty |g'(t)| e^{-t^2/2} dt \\
\leq & E[|g'(X)|] < \infty.
\end{align}
We thus showed $\int_0^\infty |g(x)|x c e^{-x^2/2} dx < \infty$. With an obviously similar argument, it can be shown that $-\int_{-\infty}^0 |g(x)|x c e^{-x^2/2} dx < \infty$, therefore $E[|g(X)X|] < \infty$. And because of this, we can use Fubini theorem to show the statement as follows:
\begin{align}
& E[g(X)X] \\
= & \int_{-\infty}^\infty xg(x)ce^{-x^2/2} dx \\
= & \int_{-\infty}^\infty \left[\int_0^x g'(t) dt + g(0)\right]xce^{-x^2/2} dx \\
= & \int_{-\infty}^\infty \left[\int_0^x g'(t) dt\right]xce^{-x^2/2} dx \\
=  & \int_{-\infty}^0 \left[\int_0^x g'(t) dt\right]xce^{-x^2/2} dx + \int_0^\infty \left[\int_0^x g'(t) dt\right]xce^{-x^2/2} dx \\
= & -c\int_{-\infty}^0 \left[\int_{-\infty}^t xe^{-x^2/2} dx\right]g'(t) dt + c \int_0^\infty \left[\int_t^\infty xe^{-x^2/2} dt\right] g'(t) dt \\
= & c\int_{-\infty}^0 g'(t)e^{-t^2/2} dt + c \int_0^\infty g'(t)e^{-t^2/2} dt \\
= & \int_{-\infty}^\infty g'(t)ce^{-t^2/2} dt \\
= & E[g'(X)].
\end{align}
Remark: The straightforward idea to solve this problem is to use the integration by parts formula. However, essentially, that formula is derived by Fubini's theorem so we take the latter approach. The more important reason that I took the Fubini theorem - approach lies in that this method protects us from dealing with the technicalities appeared at $\pm \infty$, which would appear in the integration by parts formula.
