Suppose that random variable $X$ is distributed as $N(0,\sigma^2)$.
We wish to find the density of $|X|$.
Let $F$ and $f$ be the cumulative distribution function and the density function of $|X|$ respectively.
Then $$ F(x) = \mathbb{P} ( -x \leq X \leq x) = \int_0^x \frac{1}{\sqrt{2 \pi} \sigma} e^{- \frac{u^2}{2\sigma^2}} \,du - \int_0^{-x} \frac{1}{\sqrt{2 \pi} \sigma} e^{- \frac{u^2}{2\sigma^2}} \,du. $$ Differentiating and applying fundamental theorem of calculus give $$ f(x) = \frac{1}{\sqrt{2 \pi} \sigma} e^{- \frac{x^2}{2\sigma^2}} - \frac{1}{\sqrt{2 \pi} \sigma} e^{- \frac{(-x)^2}{2\sigma^2}} (-1) = \frac{2}{\sqrt{2 \pi} \sigma} e^{- \frac{x^2}{2\sigma^2}}. $$ However, $$ \int_{\mathbb{R}} \frac{2}{\sqrt{2 \pi} \sigma} e^{- \frac{x^2}{2\sigma^2}} \,dx = 2,$$ so $\frac{2}{\sqrt{2 \pi} \sigma} e^{- \frac{x^2}{2\sigma^2}}$ cannot possibly be a density function.
I have checked this simple calculation many times and still cannot find the error. Any ideas?
Note that
$$F(x) = \mathbb{P} ( -x \leq X \leq x)$$
with $x\in[0,+\infty)$ and
$$\int_{\color{red}{\mathbb{R^+}}} \frac{2}{\sqrt{2 \pi} \sigma} e^{- \frac{x^2}{2\sigma^2}} \,dx = 1$$