How can I evaluate $\int_{-\infty}^{\infty}\frac{e^{-x^2}(2x^2-1)}{1+x^2}dx$? 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?
 A: 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) \;.
$$
A: Hint:  If you want to use Laplace transform, you'll want a change of variables $x^2 = t$.
A: 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.
A: I will evaluate the integral
$$I=\int_{-\infty}^\infty\frac{e^{-x^2}}{1+x^2}dx$$
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
$$\int_{-\infty}^\infty\frac{e^{-x^2}(2x^2+2-3)}{1+x^2}dx=2\sqrt{\pi}-3I.$$
To find the value of $I$, we let, for $t\geq 0$,
$$I(t)=\int_{-\infty}^\infty\frac{e^{-tx^2}}{1+x^2}dx.$$
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.
A: 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}}$.)
