I am trying to find the expectation of the normal distribution with parameters $\mu$ and $\sigma^2$. My methodology is to show that $E(X-\mu)$=0.
So I begin calculating the integral $\frac{1}{\sqrt{2\pi}\sigma}\int_{-\infty}^{\infty}(x-\mu)e^{\frac{-(x-\mu)^2)}{2\sigma^2}}dx $.
My first question is am I allowed to use integration by substitution for this improper integral? Can I take $y=\frac{x-\mu}{\sigma}$ and transform this integral to $\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}ye^{\frac{-y^2}{2}}dy$. If yes then can you tell me how or give me a reference quoting a theorem that allows this?
Or else am I supposed to write the improper integral $\frac{1}{\sqrt{2\pi}\sigma}\int_{-\infty}^{\infty}(x-\mu)e^{\frac{-(x-\mu)^2)}{2\sigma^2}}dx $ as $\lim_{R\longrightarrow \infty}\frac{1}{\sqrt{2\pi}\sigma}\int_{-R}^{R}(x-\mu)e^{\frac{-(x-\mu)^2)}{2\sigma^2}}dx $ and then use substitution? But in this way, I am unable to make the integral zero after substitution.
Define for $r > 0$ and fixed constants $\mu \in \mathbb R$ and $\sigma > 0$ $$\begin{align} I(r) &= \int_{x=-r}^r (x-\mu) e^{-(x-\mu)^2/(2\sigma^2)} \, dx \\ &= \int_{u=-r-\mu}^{r-\mu} u e^{-u^2/(2\sigma^2)} \, du \\ &= \sigma^2 \int_{v=-(r+\mu)/\sigma}^{(r-\mu)/\sigma} v e^{-v^2/2} \, dv \\ &= \sigma^2 \Bigl[ -e^{-v^2/2} \Bigr]_{v=-(r+\mu)/\sigma}^{(r-\mu)/\sigma} \\ &= \sigma^2 \left( e^{-(r+\mu)^2/(2\sigma^2)} - e^{-(r-\mu)^2/(2\sigma^2)} \right). \\ \end{align}$$ So $$\begin{align} \lim_{r \to +\infty} I(r) &= \sigma^2 \left( \lim_{r \to +\infty} e^{-(r+\mu)^2/(2\sigma^2)} - \lim_{r \to +\infty} e^{-(r-\mu)^2/(2\sigma^2)} \right). \end{align}$$
Since $\mu$ is fixed and $\sigma > 0$, each limit behaves as $e^{-r^2}$ as $r \to +\infty$, which is to say they both tend to $0$. So, I do not understand why you think that such an approach doesn't work, when it clearly does.