2

I need the following integral and struggle with calculating it or finding a citable source.

$$\int_{-\infty}^{\infty}(x-\mu)^2\exp\!\left(-\frac{|x-\nu|}{\tau}\right)dx.$$

Background: I want to find an expression for the KL-Divergence from a Gaussian density $f()$ to a Laplace density $g(),$ i.e. $\mathbb{E}_g[\log g(x)]-\mathbb{E}_g[\log f(x)]$. I have done the first expectation, with user whuber's trick and(KL Divergence Normal and Laplace densities) and brute force. The trick, however doesnt apply for the second expectation, whose hardest part is the integral in the question.

Joe_base
  • 105
  • 8

1 Answers1

3

Assuming $\tau>0,$ let $\xi=x-\mu$ and $\lambda=\nu-\mu.$ Then $dx=d\xi,$ and we have \begin{align*} \int_{-\infty}^{\infty}(x-\mu)^2 e^{-|x-\nu|/\tau}\,dx &=\int_{-\infty}^{\infty}\xi^2 e^{-|\xi+\mu-\nu|/\tau}\,d\xi\\ &=\int_{-\infty}^{\infty}\xi^2 e^{-|\xi-\lambda|/\tau}\,d\xi\\ &=\int_{-\infty}^\lambda \xi^2 e^{(\xi-\lambda)/\tau}\,d\xi +\int_\lambda^\infty \xi^2 e^{-(\xi-\lambda)/\tau}\,d\xi\\ &=\left[e^{(\xi-\lambda)/\tau}\tau\left(2\tau^2-2\tau\xi+\xi^2\right)\right]_{-\infty}^{\lambda}\\ &\quad-\left[e^{-(\xi-\lambda)/\tau}\tau\left(2\tau^2+2\tau\xi+\xi^2\right)\right]_{\lambda}^{\infty}\\ &=\tau\left(\lambda^2-2\lambda\tau+2\tau^2\right)+\tau\left(\lambda^2+2\lambda\tau+2\tau^2\right)\\ &=4\tau^3+2\tau\lambda^2\\ &=4\tau^3+2\tau(\nu-\mu)^2. \end{align*} The antiderivatives you can get from integration by-parts.

Adrian Keister
  • 3,664
  • 5
  • 18
  • 35