Calculation of $\frac{1}{\sqrt{2\pi}\sigma(x)}\int_{-\infty}^{\infty}|u|\exp\left(-\frac{u^2}{2\sigma{^2}(x)}\right)\ du$ How to show that $$\dfrac{1}{\sqrt{2\pi}\sigma(x)}\int_{-\infty}^{\infty}|u|\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\mathop{du}=\sqrt{\dfrac{2}{\pi}}\sigma(x)$$
I think it has to be shown through polar coordinates and then $u$ susbstituion, but I am not sure.
 A: Exploit the evenness of the integrand to write
$$\frac{2}{\sqrt{2\pi}\sigma(x)}\int_{0}^{\infty}u\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\ du$$
Then let $ z= \frac{u^2}{2\sigma{^2}(x)}$ so $\sigma{^2}(x)\ dz = u\ du$. Note that $\sigma$ has no functional dependence on $u$ and can be brought in front of the integral.
$$\begin{align*}
=& \frac{\sqrt{2}}{\sqrt{\pi}\sigma(x)}\int_{0}^{\infty}e^{-z}\sigma{^2}(x) dz \\ \\
=& \sqrt{\frac{2}{\pi}}\sigma(x)\int_{0}^{\infty}e^{-z}\ dz\\ \\
=& \sqrt{\frac{2}{\pi}}\sigma(x)
\end{align*}$$
A: Observe that you are doing integration of an even function and $\sigma(x)$ is nothing but a constant.
$$
\int_{0}^{\infty}u\exp\left(-\dfrac{u^2}{2\sigma{^2}}\right)\ du
= \int_{0}^{\infty}\frac{\sqrt{2}\sigma}{2}\exp\left(-\dfrac{u^2}{2\sigma{^2}}\right)\ d\left(\frac{u^2}{\sqrt{2}\sigma}\right)\\
=\frac{\sqrt{2}\sigma}{2}
\int_0^\infty\exp(-v)\ dv
$$
with $\sigma:=\sigma(x)$.
A: $$\dfrac{1}{\sqrt{2\pi}\sigma(x)}\int_{-\infty}^{\infty}|u|\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\mathop{du}
=\dfrac{1}{\sqrt{2\pi}\sigma(x)}\left(\int_{0}^{\infty}u\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\mathop{du}-
\int_{-\infty}^{0}u\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\mathop{du}\right)=\\
\dfrac{2}{\sqrt{2\pi}\sigma(x)}\int_{0}^{\infty}u\operatorname{exp}\left(-\dfrac{u^2}{2\sigma{^2}(x)}\right)\mathop{du}=\\
\dfrac{2\sigma (x)^2}{\sqrt{2\pi}\sigma(x)}
 \left(-e^{-\frac{u^2}{2 \sigma (x)^2}}\right)\Bigg|_0^\infty
=\sqrt{\dfrac{2}{\pi}}\sigma(x)
$$
A: I will let $\sigma(x)$ be $\sigma$. Using symmetry,
\begin{align*}
\frac{1}{\sqrt{2\pi}\sigma}\int_{-\infty}^\infty|u|\exp\left\{-\frac{1}{2}\frac{u^2}{\sigma^2}\right\} du &= \frac{2}{\sqrt{2\pi}\sigma}\int_{0}^\infty u \exp\left\{-\frac{1}{2}\frac{u^2}{\sigma^2}\right\}du\\
&= \frac{2}{\sqrt{2\pi}\sigma}\sigma^2\int_{0}^\infty \frac{u}{\sigma^2} \exp\left\{-\frac{1}{2}\frac{u^2}{\sigma^2}\right\}du\tag{1}\\
&=\sqrt{\frac{2}{\pi}}\sigma,
\end{align*}
where $(1)$ is a Rayleigh distribution.
