How can I solve this integral: $$\int_{-\infty}^{\infty}\frac{e^{-x^2}(2x^2-1)}{1+x^2}dx.$$ Can I solve this problem using the Laplace transform? How can I do this?


I will evaluate the integral


using one of my favorite techniques (which I have heard was also Richard Feynman's favorite). This will solve your problem since, as Dilip points out, your integral can be written as


To find the value of $I$, we let, for $t\geq 0$,


Then $I(0)=\arctan{\infty}-\arctan{(-\infty)} = \pi$, and $$I'(t)=\int_{-\infty}^\infty\frac{-x^2e^{-tx^2}}{1+x^2}dx.$$

Hence $I(t)$ satisfies the differential equation

$$I(t)-I'(t)=\int_{-\infty}^\infty e^{-tx^2}dx = \sqrt{\frac{\pi}{t}}.$$

Multiplying throughout by $e^{-t}$ we have

$$-\frac{d}{dt}(e^{-t}I(t)) = e^{-t}\sqrt{\frac{\pi}{t}}.$$

Integrating from $t=0$ to $t$, we find

$$-e^{-t}I(t)+I(0) = \sqrt{\pi} \int_0^t \frac{e^{-t}}{\sqrt t}dt = 2\sqrt{\pi} \int_0^\sqrt{t}e^{-u^2} du = \pi \text{ erf}\sqrt{t}$$

Since $I(0)=\pi$, we have

$$I(t)=e^t(\pi - \pi \text{ erf}(\sqrt{t})) = e^{t}\pi \text{ erfc}(\sqrt{t}).$$

Thus $I=I(1) = e\pi\: \text{erfc}(1)$, and your integral is $2\sqrt\pi - 3e\pi\text{erfc}(1)$. (Look!)

Note: my other solution below is much quicker, but not as much fun.

| cite | improve this answer | |
  • 2
    $\begingroup$ Ah, this is what I wanted to see... +1! I suppose integration by parts will take care of the higher moments $\int_{-\infty}^\infty\frac{e^{-x^2}}{1+x^2}x^{2k}\mathrm dx$ $\endgroup$ – J. M. isn't a mathematician Dec 24 '11 at 0:06

Here is yet another way to evaluate the integral

$$I=\int_{-\infty}^\infty \frac{e^{-x^2}}{1+x^2}dx.$$ Write

$$\frac{1}{1+x^2}= \int_0^\infty e^{-s(1+x^2)}ds,$$

so that

$$I=\int_{-\infty}^\infty e^{-x^2} \int_{0}^\infty e^{-s(1+x^2)}ds\: dx.$$

We switch the order of integration to get

$$\int_{0}^\infty e^{-s} \int_{-\infty}^\infty e^{-x^2(1+s)}dx\: ds = \int_{0}^\infty e^{-s} \sqrt{\frac{\pi}{1+s}} ds = e\sqrt{\pi}\int_{0}^\infty \frac{e^{-(s+1)}}{\sqrt{1+s}} ds = e\pi \text{ erfc}(1).$$

(To see that this last integral is indeed $\sqrt\pi \text{ erfc}(1)$, put $u=\sqrt{1+s}$, $du= \frac{ds}{2\sqrt{1+s}}$.)

| cite | improve this answer | |
  • $\begingroup$ I liked the other way (which I upvoted) better because it does not require looking up (or knowing) that that last integral has value $\sqrt{\pi}\text{erfc}(1)$. Ditto for @J.M.'s one-liner comment which has since been deleted. $\endgroup$ – Dilip Sarwate Dec 24 '11 at 1:21
  • 1
    $\begingroup$ Thanks Dilip! Doesn't it follow immediately from the definition of $\text{erfc}$ after the substitution $u=\sqrt{1+s}$? $\endgroup$ – Bruno Joyal Dec 24 '11 at 1:23
  • $\begingroup$ I didn't notice that it would work out that way, but then I don't tend to use erf or erfc at all, preferring $\Phi(\cdot)$, the cumulative normal distribution instead (cf. my own answer to the problem). In fact, I request you to edit your answer to point out how that last step follows by simple substitution. Thanks $\endgroup$ – Dilip Sarwate Dec 24 '11 at 1:26
  • $\begingroup$ You don't have to look things up if you know how the complementary error function $\mathrm{erfc}(x)=\int_x^\infty \exp(-u^2)\mathrm du$ is defined. Let $s=u^2-1$, $\mathrm ds=2u\mathrm du$. $\endgroup$ – J. M. isn't a mathematician Dec 24 '11 at 1:26
  • $\begingroup$ @Dilip: I see why you're used to the normal CDF, so I understand why you like that route. Me, I like being able to exploit the oddness of the error function, and a few other things besides. $\endgroup$ – J. M. isn't a mathematician Dec 24 '11 at 1:28

To find $I=\int_{-\infty}^{\infty}\frac{e^{-x^2}(2x^2-1)}{1+x^2}dx$, let us start by defining for $n \in \mathbb{N}$ $$ I_n = \int_{-\infty}^{\infty} x^{2n} e^{-x^2}\,dx $$ and note that $I_0=\sqrt{\pi}$, also called the Gaussian integral, can be solved either by a beautiful polar coordinate trick or by this technique, and that $I_1=\frac{\sqrt{\pi}}{2}$ was shown here. We can find the rest using integration by parts. With $$ \begin{array}{lcl} v=-\frac{1}{2}e^{-x^2} && dv=xe^{-x^2}dx \\ u=x^{2n-1} && du=(2n-1)x^{2n-2}dx, \end{array} $$ for $n>1$ we have $$ \begin{array}{lcl} I_n &=& \int udv = uv - \int vdu \\ &=& -\frac{1}{2} \left[ x^{2n-1} e^{-x^2} \right]_{-\infty}^{\infty} + \frac{2n-1}{2} \int_{-\infty}^{\infty} x^{2n-2} e^{-x^2} \\ &=& \frac{2n-1}{2} I_{n-1} \end{array} $$ where the first right-hand term vanishes because the exponential term dominates all polynomial terms. This shows that, inductively, $$ I_n = \frac{(2n)!}{2^{2n}n!} I_0 $$ But using $\frac{1}{1-t}=\sum_{n=0}^{\infty}t^n$, we can expand the integrand of $I$: $$ \frac{2x^2-1}{1+x^2} = (2x^2-1) \sum_{n=0}^{\infty} (-1)^n x^{2n} = 2-3\sum_{n=0}^{\infty} (-1)^n x^{2n} $$ and hence we get (noting that the integrals all converge because of the dominating exponential term) $$ \begin{array}{lcl} I &=& 2I_0-3(I_0-I_1+\dots) = 2I_0-3 \sum_{n=0}^{\infty} (-1)^n I_n \\ &=& \left( 2-3 \sum_{n=0}^{\infty} (-1)^n \frac{(2n)!}{2^{2n}n!} \right) I_0 \end{array} $$ where the series $$ \sum_{n=0}^{\infty} (-1)^n \frac{(2n)!}{2^{2n}n!} = 1 - \frac{1}{2} + \frac{1 \cdot 3}{2 \cdot 2} - \frac{1 \cdot 3 \cdot 5}{2 \cdot 2 \cdot 2} + \cdots = e \sqrt\pi\; \text{erfc}(1) $$ can also be expressed using $\Gamma(\frac{1}{2}-n)=(-1)^n\frac{(2n)!}{4^{n}n!}\sqrt\pi$ and a series expansion for the complementary error function as $$ I = 2\sqrt\pi - 3 \; \sum_{n=0}^{\infty} \; \Gamma(\tfrac{1}{2}-n) = 2\sqrt\pi - 3e\pi\;\text{erfc}(1) \;. $$

| cite | improve this answer | |
  • $\begingroup$ Why are you allowed to use the geometric series? I don't understand why we can guarantee $|t|<1$. $\endgroup$ – mathmath8128 Dec 23 '11 at 22:08
  • $\begingroup$ The geometric series doesn't converge outside the radius of convergence you give. But when we multiply by the exponential in the next step, each term converges since $x^ne^{-x} \to 0$ (and so also $x^ne^{-x^2} \to 0$) as $x\to\infty$ for all $n\in\mathbb{N}$. $\endgroup$ – bgins Dec 23 '11 at 22:32
  • 3
    $\begingroup$ Your last series needs some love. $\endgroup$ – Jonas Teuwen Dec 23 '11 at 22:33
  • $\begingroup$ Yes, you caught me between edits, with a nasty mistake! $\endgroup$ – bgins Dec 23 '11 at 23:19

Hint: If you want to use Laplace transform, you'll want a change of variables $x^2 = t$.

| cite | improve this answer | |
  • 7
    $\begingroup$ Why the downvotes? Using that change of variables (and symmetry) the integral becomes $\int_0^\infty \frac{2t-1}{(t+1)\sqrt{t}} e^{-t}\ dt= 2 \int_0^\infty \frac{1}{\sqrt{t}} e^{-t}\ dt - 3 \int_0^\infty e^{-t} \frac{1}{\sqrt{t} (1+t)}\ dt$. Any decent table of Laplace transforms will handle this. $\endgroup$ – Robert Israel Dec 25 '11 at 4:27

Writing $2x^2-1$ as $2x^2 + 2 - 3$, the integral simplifies to $$\begin{align*} \int_{-\infty}^{\infty}\exp(-x^2)\frac{2x^2-1}{1+x^2}\mathrm dx &= 2\int_{-\infty}^{\infty}\exp(-x^2)\mathrm dx -3 \int_{-\infty}^{\infty}\exp(-x^2)\frac{1}{1+x^2}\mathrm dx\\ &= 2\sqrt{\pi} - \frac{3}{2\pi}\int_{-\infty}^{\infty}\sqrt{\pi}\exp(-\omega^2/4) \pi\exp(-|\omega|)\mathrm d\omega\\ &= 2\sqrt{\pi} - 3\sqrt{\pi}\int_{0}^{\infty}\exp(-\omega^2/4) \exp(-\omega)\mathrm d\omega\\ &= 2\sqrt{\pi} - 6\pi e \int_{0}^{\infty}\frac{1}{\sqrt{2}\sqrt{2\pi}} \exp\left(-\frac{(\omega + 2)^2}{2\cdot(\sqrt{2})^2}\right) \mathrm d\omega\\ \end{align*}$$ where in the second step, we have used a well-known result (see e.g. the answer by bgins and the links therein) on the first integral, and applied the inner-product form of Parseval's theorem to convert the second integral to the integral of the product of the Fourier transforms $\sqrt{\pi}\exp(-\omega^2/4)$ and $\pi\exp(-|\omega|)$ of $\exp(-x^2)$ and $(1+x^2)^{-1}$ respectively, while the last step follows upon completing the square in the exponent and writing the integrand as the probability density function of a normal random variable with mean $-2$ and variance $2$. Hence we have that $$\begin{align*} \int_{-\infty}^{\infty}\exp(-x^2)\frac{2x^2-1}{1+x^2}\mathrm dx &= 2\sqrt{\pi} -6\pi e \Phi(-2/\sqrt{2})\\ &= 2\sqrt{\pi} -6\pi e Q(\sqrt{2}) \end{align*}$$ where $\Phi(\cdot)$ is the cumulative standard normal distribution function and $Q(x) = 1-\Phi(x)$ is its complement. Since $\text{erfc}(x) = 2Q(x\sqrt{2})$, the value can also be expressed as $2\sqrt{\pi} - 3e\pi \text{erfc}(1)$ as in the answers by Bruno and bgins.

| cite | improve this answer | |
  • $\begingroup$ Would the down-voter care to add a comment? $\endgroup$ – Dilip Sarwate Mar 7 '12 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.