# Azimuthal and polar integration of a 3D Gaussian

Numerical evaluation of the following integral of a 3D gaussian $G$ seems to result in a 1D Gaussian $g$ (or at least very close to one) $$\int_{0}^{2\pi}\!\!\int_{0}^{\pi}G(R,\phi,\theta) \sin\theta\ \text{d}\theta \ \text{d}\phi= g(R)$$ where the 3D Gaussian in spherical coordinates with mean $\mu$ and covariance matrix $\Sigma$ $$G(R,\phi,\theta)=H \exp\left[-\frac{1}{2}(X-\mu)^{T}\cdot \Sigma^{-1}\cdot (X-\mu)\right]$$ $$X=\begin{bmatrix}R\cos\phi\sin\theta\\\ R\sin\phi\sin\theta\\\ R\cos\theta\end{bmatrix}$$ and the 1D Gaussian with mean $R_\mu$ and variance $\sigma^2$ $$g(R)=H'\exp\left[-\frac{(R-R_\mu)}{2\sigma^2}\right]$$ The question is: is this true and how do the parameters of $g$ relate to the parameters of $G$?

My attempt to solve this problem involved transforming $G$ so that $\mu=(0\ 0\ R_\mu)$ (adapting $\Sigma$ in the process) and substitute $z=\cos\theta$. After some basic math I get the following $$\int_{0}^{2\pi}\!\!\int_{0}^{\pi}G(R,\phi,\theta) \sin\theta\ \text{d}\theta \ \text{d}\phi=\int_{0}^{2\pi}\!\!\int_{-1}^{1}\exp(Az^2 + (Bz+C)\sqrt{1-z^2}+Dz+E) \text{d}z \ \text{d}\phi$$ where $A,\ldots,E$ depend on azimuth $\phi$. Alternatively this can be written as $$\int_{0}^{2\pi}\!\!\int_{0}^{\pi}G(R,\phi,\theta) \sin\theta\ \text{d}\theta \ \text{d}\phi=\int_{-1}^{1}\!\!\int_{0}^{2\pi}\exp(A_{1}\cos(2\phi+ \delta_{1})+A_{2}\cos(2\phi+\delta_{2})+A_{3}) \text{d}\phi \ \text{d}z$$ where $A_1,\ldots,A_3$ depend on $z$. However I was unable to solve either of these integrals over $z$ or $\phi$, let alone solve the double integral.

Edit: I found a solution for a special case thanks to Joriki's answer. Suppose the covariance matrix is a scalar matrix $\Sigma=\sigma^{2}I$. Then we find that (L is the rotation matrix to get $\mu=(0\ 0\ R_\mu)$) $$\begin{split}G(R,\phi,\theta)=&H \exp\left[-\frac{1}{2}(X-\mu)^{T}\cdot (L\cdot\Sigma\cdot L^T)^{-1}\cdot (X-\mu)\right]\\ =&\frac{V}{2\pi\sigma^2\sqrt{2\pi\sigma^2}}\exp\left[-\frac{R^2-R_\mu^2}{2\sigma^2}\right]\exp\left[\frac{RR_\mu}{\sigma^2}z\right]\end{split}$$ where $V$ the volume of the Gaussian. The double integral can then be solved $$\begin{split}\int_{0}^{2\pi}\!\!\int_{0}^{\pi}G(R,\phi,\theta) \sin\theta\ \text{d}\theta \ \text{d}\phi=&\frac{V}{\sigma^2\sqrt{2\pi\sigma^2}}\exp\left[-\frac{R^2+R_\mu^2}{2\sigma^2}\right]\int_{-1}^{1}\exp\left[\frac{RR_\mu}{\sigma^2}z\right]\ \text{d}z\\ =&\frac{V}{\sigma^2\sqrt{2\pi\sigma^2}}\exp\left[-\frac{R^2+R_\mu^2}{2\sigma^2}\right]\frac{\sigma^2}{RR_\mu}(\exp\left[\frac{RR_\mu}{\sigma^2}\right]-\exp\left[-\frac{RR_\mu}{\sigma^2}\right])\\ =&\frac{V}{RR_\mu\sqrt{2\pi\sigma^2}}\exp\left[-\frac{(R-R_\mu)^2}{2\sigma^2}\right](1-\exp\left[-\frac{2RR_\mu}{\sigma^2}\right])\\ \approx& \frac{V}{RR_\mu\sqrt{2\pi\sigma^2}}\exp\left[-\frac{(R-R_\mu)^2}{2\sigma^2}\right]\\ =&\frac{1}{RR_\mu}g(R) \end{split}$$ Thus for an isotropic 3D Gaussian with $R_\mu\gg \sigma$ the integral is a Gaussian with variance $\sigma^2$, mean $R_\mu$ and area $V$, but then divided by $RR_\mu$. Therefore not a Gaussian but very close. Can a similar expression be found for the general case? Non-linear least squares refinement of a numerical R-profile with this function works, although a slight skewness is observed and the relation between $\sigma^{2}$ and $\Sigma$ is not clear. The area however seems to be the same (volume of the 3D Gaussian).

-

This is wrong; as the edited question shows, the exponent is linear in $z$ and the factor multiplying the Gaussian comes out as $R^{-1}$, not $R^{-2}$. I'd delete the answer, but I can't because it's accepted.

To show that this is not a Gaussian, we can determine the behaviour for $R\to\infty$.

Let's choose $\sigma=I$ for simplicity, and rotate such that $\mu=(0,0,R_\mu)$ as you did. Then $g(0)=\mathrm e^{-\frac12R_\mu^2}$. For $R\to\infty$, the contributions from the neighbourhood of the point closest to the mean asymptotically dominate, and we can approximate the sphere by a plane through that point to obtain

$$g(R)\sim R^{-2}\int_0^\infty\mathrm e^{-\frac12((R-R_\mu)^2+r^2)}2\pi r\mathrm dr=2\pi R^{-2}\mathrm e^{-\frac12(R-R_\mu)^2}\;.$$

Since a Gaussian cannot be asymptotic to this function, $g(R)$ is not a Gaussian. Although $R^2g(R)$ is asymptotic to a Gaussian for $R\to\infty$, it is $0$ at $R=0$ and thus also not a Gaussian.

-
Thanks! It is indeed not a Gaussian. Your reasoning led me to consider a special case where the covariance matrix is a scalar matrix (added to my post). The result is indeed not a Gaussian but its very close. If I could find something similar for the general case, that would be a great result! –  Wox Sep 28 '12 at 11:38