0
$\begingroup$

I'm tasked with evaluating this integral for class:

$\int_{-\infty}^\infty e^{-(x-\mu)^2 / (2\sigma^2)} \, dx$, assume $\mu$ and $\sigma^2$ are real scalars and $\sigma^2 > 0$.

At one point in my solution, I come up against the error function. I've gone over the math a few times and can't seem to figure out what happens. It'll be obvious where my question is in the work below. Let the Gaussian integral equal $I$ such that


Firstly, take $a = 1/(2\sigma^2)$, $u = x-\mu$, $ du = dx$. Notice that when $x=0$, $u=-\mu$. Now, the integral we must solve is the following: \begin{equation} \int_{0}^\infty e^{-(x-\mu)^2 / (2\sigma^2)} \, dx = \int_{-\mu}^\infty e^{-a u^2} \, du \nonumber \end{equation} To further simplify this expression, take $t = \sqrt{a} \, u$. Note that when $u = \mu$, $t = -\sqrt{a} \, \mu$. Then, \begin{align} \int_{-\mu}^\infty e^{-a u^2} \, du &= \dfrac{1}{\sqrt{a}} \int_{-\mu \sqrt{a}}^\infty e^{-t^2} \, dt \nonumber \\[.5em] &= \dfrac{1}{\sqrt{a}} \int_{-\mu \sqrt{a}}^0 e^{-t^2} \, dt + \dfrac{1}{\sqrt{a}} \int_{0}^\infty e^{-t^2} \, dt \nonumber \\[.5em] &= -\dfrac{1}{\sqrt{a}} \int_0^{-\mu \sqrt{a}} e^{-t^2} \, dt + \dfrac{1}{\sqrt{a}} \int_{0}^\infty e^{-t^2} \, dt. \label{eq:hw1_prob1.2} \end{align} We should pause here and take a look at each expression in the sum separately. First, we should note the expression of the Error Function, \begin{equation} Erf(z) = \dfrac{2}{\sqrt{\pi}} \int_0^z e^{-t^2} \, dt. \nonumber \end{equation} Applying this to the first expression in our sum, we have


BREAK

At this point in my work, I assume the following expression is true. I know the final answer is correct, but unless $-Erf(-z) = Erf(z)$ (I'm not sure this is true), I'm not sure why this works.


\begin{equation} -\dfrac{1}{\sqrt{a}} \int_0^{-\mu \sqrt{a}} e^{-t^2} \, dt = \dfrac{1}{\sqrt{a} \,}Erf{\left(\dfrac{\mu}{\sigma \sqrt{2}}\right)} \nonumber \end{equation}

Now, let's turn our focus to the second sum. Using the 'polar' method of solving this expression, we have \begin{align} I &= \int_0^\infty e^{-t^2} \, dt = \dfrac{1}{2} \int_{-\infty}^\infty e^{-t^2} \, dt \nonumber \\[.5em] I^2 &= \dfrac{1}{4} \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2 + y^2)} \, dx dy. \nonumber \end{align} Take $x = r\cos{\theta}$, $y = r \sin \theta$, $ dx dy = r \, dr d\theta$ such that \begin{equation} \dfrac{1}{4} \int_0^{2\pi} \int_{-\infty}^\infty r e^{-r^2} \, dr d\theta. \nonumber \end{equation} Now, let $u = -r^2$ so that $du = -2 r dr$. So, \begin{equation} I^2 = -\dfrac{1}{8} 2\pi \int_0^\infty e^u \, du = \dfrac{\pi}{4}, \nonumber \end{equation} and \begin{equation} I = \dfrac{\sqrt{\pi}}{2}. \nonumber \end{equation}

Putting this all together and skipping over some tedious algebra, we have \begin{equation} \boxed{ \int_{0}^\infty e^{-(x-\mu)^2 / (2\sigma^2)} \, dx = \sigma \sqrt{\dfrac{\pi}{2}} \left[ 1 + Erf\left(\dfrac{\mu}{\sigma\sqrt{2}}\right) \right] } \nonumber \end{equation}


Any help with this is appreciated. I'm sure it's a simple mistake that I am overlooking.

$\endgroup$
2
  • 1
    $\begingroup$ It is true that $-\text{erf}(-x) = \text{erf}(x)$, which can be seen by making the substitution $x \to -x$. $\endgroup$ Commented Jan 20, 2021 at 3:20
  • $\begingroup$ phew, thank you. If you write out a solution, I'll mark you as the correct answer. $\endgroup$
    – NoVa
    Commented Jan 20, 2021 at 3:41

1 Answer 1

1
$\begingroup$

Your approach is unnecessarily complicated. $\int_Re^{-(x-\mu)^2/(2\sigma^2)}dx=\int_Re^{(-y^2)/(2\sigma^2)}dy=\sigma \int_Re^{-u^2/2}du=\sigma\sqrt{2\pi}$

The error function is needed when you integrate over part of the real line.

$\endgroup$
2
  • $\begingroup$ I know, but I needed to show it in the form with the error function. $\endgroup$
    – NoVa
    Commented Jan 20, 2021 at 4:23
  • 1
    $\begingroup$ Split the integral into $(-\infty ,0)$ and $(0,\infty)$ Each part will contain erf term which will add up to simple sum. $\endgroup$ Commented Jan 20, 2021 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .