Expected Value of $\exp\left[{a+bX+X'cX}\right]$ Is there a closed-form expression for
$$
\mathbb{E}\left[e^{a+bX+X'cX}\right],
$$
where $a$ is a constant, $b$ is a vector of constants and $c$ a matrix of constants. $X$ is a vector of Gaussian RV's with vector of means $\mu$ and variance covariance $\Sigma$. I am aware of the $1$-dimensional version, but would to know if there is a general expression.
 A: We have
$$
\mathbb{E}\left[e^{a+bX+X'cX}\right] = \int_{\mathbb{R}^n}\frac{1}{(2\pi)^{n/2}\sqrt{\det(\Sigma)}}\exp\left(a+b'x+x'cx-\frac{1}{2}(x-\mu)'\Sigma^{-1} (x-\mu)  \right) \tag{1}dx
$$
Let's study the term inside the $\exp$
\begin{align}
L&= a+b'x+x'cx-\frac{1}{2}(x-\mu)'\Sigma^{-1} (x-\mu) \\
 &=  a+b'x+x'cx-\frac{1}{2}x'\Sigma^{-1} x + \mu'\Sigma^{-1} x-\frac{1}{2}\mu'\Sigma^{-1} \mu\\
&=  -\frac{1}{2}x'(\Sigma^{-1}-2c) x +(b+\Sigma^{-1}\mu)'x+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu\right)\\
&=  -\frac{1}{2}x'(\Sigma^{-1}-2c) x +(b+\Sigma^{-1}\mu)'x+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu\right)\\
\end{align}
Suppose the matrix $\Sigma^{-1} -2c$ is symmetric positive semidefinite. Then it can be decomposed as $$\Sigma^{-1} -2c = P'P$$
where $P=(\Sigma^{-1} -2c)^{\frac{1}{2}}$ is also symmetric positive semidefinite
So,
\begin{align}
L &=  -\frac{1}{2}x'P'Px +(b+\Sigma^{-1}\mu)'x+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu\right)\\
&=  -\frac{1}{2}(Px)'(Px) +(b+\Sigma^{-1}\mu)'P^{-1}Px+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu\right)\\
&=  -\frac{1}{2}(Px)'(Px) +(P^{-1}(b+\Sigma^{-1}\mu))'Px+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu\right)\\
&=  -\frac{1}{2}\left((Px)'(Px) -2(P^{-1}(b+\Sigma^{-1}\mu))'(Px) +||P^{-1}(b+\Sigma^{-1}\mu)||^2 \right)+\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu + \frac{1}{2}(b+\Sigma^{-1}\mu)'P^{-2}(b+\Sigma^{-1}\mu)\right) \\
& = -\frac{1}{2} \left(x - P^{-2}(b+\Sigma^{-1}\mu) \right)'(\Sigma^{-1} -2c)\left(x - P^{-2}(b+\Sigma^{-1}\mu) \right) +\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu  + \frac{1}{2}(b+\Sigma^{-1}\mu)'(\Sigma^{-1} -2c)^{-1}(b+\Sigma^{-1}\mu)\right)\\
\end{align}
Return back to the integral $(1)$and make a change of variable $y = x - P^{-2}(b+\Sigma^{-1}\mu)$
\begin{align}
\mathbb{E}\left[e^{a+bX+X'cX}\right] &= \int_{\mathbb{R}^n}\frac{1}{(2\pi)^{n/2}\sqrt{\det(\Sigma)}}\exp\left(L \right)dx  \\
&= \frac{\sqrt{\det(\Sigma^{-1}-2c)^{-1}}}{\sqrt{\det(\Sigma)}} \int_{\mathbb{R}^n}\frac{1}{(2\pi)^{n/2}\sqrt{\det(\Sigma^{-1}-2c)^{-1}}}\exp\left(L \right)dy  \\
&= \frac{\sqrt{\det(\Sigma^{-1}-2c)^{-1}}}{\sqrt{\det(\Sigma)}} \exp{\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu  + \frac{1}{2}(b+\Sigma^{-1}\mu)'(\Sigma^{-1} +2c)^{-1}(b+\Sigma^{-1}\mu)\right)}  \\
&= \frac{\exp{\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu  + \frac{1}{2}(b+\Sigma^{-1}\mu)'(\Sigma^{-1} -2c)^{-1}(b+\Sigma^{-1}\mu)\right)}}{\sqrt{\det(\Sigma)\det(\Sigma^{-1}-2c)}}   \\
\end{align}
Conclusion:
$$
\mathbb{E}\left[e^{a+bX+X'cX}\right]= \frac{\exp{\left(a -\frac{1}{2}\mu'\Sigma^{-1} \mu  + \frac{1}{2}(b+\Sigma^{-1}\mu)'(\Sigma^{-1} -2c)^{-1}(b+\Sigma^{-1}\mu)\right)}}{\sqrt{\det(\Sigma)\det(\Sigma^{-1}-2c)}} 
$$
Note: What happpen if the matrix $\Sigma^{-1} -2c$ is not positive semidefinite? In this case, we have $\mathbb{E}\left[e^{a+bX+X'cX}\right] = +\infty $.
