I must be overlooking something simple. I found these notes online Lemma 3.6.5 and I cannot understand why the last term in Here is 0...
I will restate the Lemma from the paper below with slight alterations in the derivation because I was working through it in my own way...
Lemma 3.6.5 (Stein's Lemma)
Let $X \sim N(\theta, \sigma^2)$, and let $g$ be a differentiable function satisfying $\mathbb{E}[|g'(X)|] \lt \infty$. Then
$$ \mathbb{E}[g(X)(X - \theta)] = \sigma^2\mathbb{E}[g'(X)] $$
Proof
We can evaluate the left hand side using integration by parts $u = g(x)$ and $dv = (x - \theta)e^{-\frac{(x - \theta)^2}{2\sigma^2}}$ which means that $v = -\sigma^2e^{-\frac{(x - \theta)^2}{2\sigma^2}}$
$$ \begin{aligned} \mathbb{E}[g(x)(X - \theta)] &= \frac{1}{\sqrt{2\pi}\sigma} \int g(x)(x - \theta)e^{-\frac{(x - \theta)^2}{2\sigma^2}}dx \\ &= \frac{1}{\sqrt{2\pi}\sigma} \Bigg( \Big[ -\sigma^2g(x)e^{-\frac{(x - \theta)^2}{2\sigma^2}} \Big]_{-\infty}^{\infty} - \int -\sigma^2g'(x)e^{-\frac{(x - \theta)^2}{2\sigma^2}}dx \Bigg) \\ &= \frac{1}{\sqrt{2\pi}\sigma} \Bigg( \int \sigma^2g'(x)e^{-\frac{(x - \theta)^2}{2\sigma^2}}dx - \Big[ \sigma^2g(x)e^{-\frac{(x - \theta)^2}{2\sigma^2}} \Big]_{-\infty}^{\infty} \Bigg) \\ &= \sigma^2 \mathbb{E}[g'(x)] - \frac{1}{\sqrt{2\pi}\sigma}\Big[ \sigma^2g(x)e^{-\frac{(x - \theta)^2}{2\sigma^2}} \Big]_{-\infty}^{\infty} \\ \end{aligned} $$
The notes then say that
The condition on $g'$ is enough to ensure that the last term is 0 and what remains on the RHS is $\sigma^2 \mathbb{E}[g'(x)]$
I must be missing something simple, but I cannot see why the last term there should be zero. Why is that?
For any $t\in \mathbb{R}$, we have $$|g'(t)| e^{-(x-\theta)^2/(2\sigma^2)}\cdot 1_{[\theta,x]}(t) \leq |g'(t)|e^{-(t-\theta)^2/(2\sigma^2)},$$ where we recognize the dominating function as integrable by assumption and independent of $x$. Additionally, as $x\to\infty$, the smaller function goes to $0$ pointwise for every $t$. Therefore, by the Dominated Convergence Theorem, $$\begin{align*}\lim_{x\to\infty} g(x)e^{-(x-\theta)^2/(2\sigma^2)} &= \lim_{x\to\infty} (g(x)-g(\theta))e^{-(x-\theta)^2/(2\sigma^2)} \\ &= \lim_{x\to\infty} \int_\theta^x g'(t)e^{-(x-\theta)^2/(2\sigma^2)}\,dt \\ &= 0\end{align*}$$
This gives half of the result. Showing the other half is similar.
On notation: