Calculate $\int_{S_A} x^T B x \, dx$ where $S_A$ is an ellipsoid

187 Views Asked by At

Suppose that $S_A \subset \mathbb{R}^n$ denotes an ellipsoid centered at the origin,

\begin{align} S_A= \{ x \in \mathbb{R}^n : x^T A x \le 1 \} , \end{align}

where matrix $A$ is symmetric and positive definite.

Let matrix $B$ be positive definite. Can the following integral be calculated in closed form?

\begin{align} \int_{S_A} x^T B x \, dx \end{align}

I understand we have to switch to spherical coordinates here, but there a few details that are not clear to me. For example, how to change the coordinates in this case.

3

There are 3 best solutions below

1
On

Hint:

By diagonalizing $A$ and scaling the Eigen axis, you can turn the domain to a unit sphere. At the same time, let $B$ follow these linear transformations. The Jacobian is just the volume of the ellipsoid $A$.

Now to integrate $x^TB'x$ in spherical coordinates, you can integrate separately the monomials such as $x_1^2$ and $x_1x_2$. By symmetry, it suffices to consider two coordinates.

4
On

I'll continue from where Daoust stopped. The integrals are indeed a bit messy. So we want to evaluate $$ \int_{S_A} x^t B x \, {\rm d}^nx = \left(\det \Lambda \right)^{-\frac{1}{2}}\int_S \xi^t B' \xi \, {\rm d}^n\xi = \left(\det \Lambda \right)^{-\frac{1}{2}} \int_S \xi_i b'_{ij} \xi_j \, {\rm d}^n\xi $$ where $B'=\Lambda^{-\frac{1}{2}}U^t B U \Lambda^{-\frac{1}{2}}$ and $\xi$ is related to $x$ by the transformation $\xi = \Lambda^{\frac{1}{2}} U^t x$. $\Lambda$ is the diagonal matrix of $A$ and $U$ the corresponding orthogonal matrix with eigenvectors as columns. Now introduce spherical coordinates $$ \begin{pmatrix} \xi_1 \\ \xi_2 \\ \xi_3 \\ \vdots \\ \xi_{n-1} \\ \xi_n \end{pmatrix} = r \begin{pmatrix} \cos\phi_1 \\ \sin \phi_1 \cos\phi_2 \\ \sin\phi_1 \sin\phi_2 \cos \phi_3 \\ \vdots \\ \sin\phi_1 \cdots \sin\phi_{n-2} \cos\phi_{n-1} \\ \sin \phi_1 \cdots \sin\phi_{n-2} \sin\phi_{n-1}\end{pmatrix} $$ and write \begin{align} &\int_S \xi_i b'_{ij} \xi_j \, {\rm d}^n\xi \\ = &\int_0^1 \int_0^{2\pi} \int_0^\pi \cdots \int_0^\pi \xi_i b'_{ij} \xi_j \, r^{n-1} (\sin \phi_1)^{n-2} (\sin \phi_2)^{n-3} \cdots \sin \phi_{n-2} \, {\rm d}\phi_1 {\rm d}\phi_2 \cdots {\rm d}\phi_{n-2} {\rm d}\phi_{n-1} {\rm d}r \, . \end{align} The $r$-integral can be done trivially and leads to an overall factor $\frac{1}{n+2}$. For the angular integrals consider first $j>i$ such that $\xi_i$ contributes a factor $\cos \phi_i$. Because $j>i$, $\xi_j$ always contains a factor $\sin \phi_i$, so that the integral over $\phi_i$ $$ \int_0^\pi (\sin \phi_i)^{n-i} \cos \phi_i \, {\rm d}\phi_i = 0 \qquad {\rm for \quad} i=1,2,...,n-1 \, . $$ For $i=n-1$ the integral actually goes from $0$ to $2\pi$, but it doesn't matter.

Therefore the only terms contributing to the integral are those for $i=j$. In this case $(i<n)$ we have \begin{align} c_i(n) = &\int_0^{2\pi} \int_0^\pi \cdots \int_0^\pi \left( \sin\phi_1 \sin\phi_2 \cdots \sin\phi_{i-1}\cos \phi_i \right)^2 (\sin \phi_1)^{n-2} (\sin \phi_2)^{n-3} \cdots \sin \phi_{n-2} \, {\rm d}\phi_1 {\rm d}\phi_2 \cdots {\rm d}\phi_{n-2} {\rm d}\phi_{n-1} \\ =&\int_0^{2\pi} \int_0^\pi \cdots \int_0^\pi (\sin \phi_1)^{n} (\sin \phi_2)^{n-1} \cdots (\sin \phi_{i-1})^{n-i+2} (\cos \phi_i)^2 (\sin \phi_i)^{n-i-1} (\sin \phi_{i+1})^{n-i-2} \cdots \sin \phi_{n-2} \, {\rm d}\phi_1 {\rm d}\phi_2 \cdots {\rm d}\phi_{i-1} {\rm d}\phi_{i} {\rm d}\phi_{i+1} \cdots {\rm d}\phi_{n-2} {\rm d}\phi_{n-1} \, . \end{align} Writing $(\cos \phi_i)^2=1-(\sin \phi_i)^2$ all integrals are of the form $$ \int_{0}^\pi (\sin \phi)^n \, {\rm d}\phi = 2^{-n} \pi \begin{pmatrix} n \\ \frac{n}{2} \end{pmatrix} = B\left(\frac{n+1}{2},\frac{1}{2}\right) $$ - where for odd $n$ the binomial coefficient is interpreted as the analytic continuation - except the $\phi_{n-1}$ integral which yields \begin{align} i<n-1: \qquad &\int_0^{2\pi} {\rm d}\phi_{n-1} = 2\pi \\ i=n-1: \qquad &\int_0^{2\pi} (\cos \phi_{n-1})^2 \, {\rm d}\phi_{n-1} = \pi \, . \end{align} All together for $i<n$ the integral is therefore \begin{align} c_i(n) = 2^{-\left(\frac{n(n-3)}{2}+2i\right)} \, \pi^{n-1} \, \begin{pmatrix} n \\ \frac{n}{2} \end{pmatrix} \begin{pmatrix} n-1 \\ \frac{n-1}{2} \end{pmatrix} \cdots \begin{pmatrix} n-i+2 \\ \frac{n-i+2}{2} \end{pmatrix} \left[ 2^2 \begin{pmatrix} n-i-1 \\ \frac{n-i-1}{2} \end{pmatrix} - \begin{pmatrix} n-i+1 \\ \frac{n-i+1}{2} \end{pmatrix} \right] \begin{pmatrix} n-i-2 \\ \frac{n-i-2}{2} \end{pmatrix} \cdots \begin{pmatrix} 1 \\ \frac{1}{2} \end{pmatrix} \end{align} though I haven't tried to simplify this expression.

For $i=n$ we similarly have \begin{align} c_n(n) &= \int_0^{2\pi} \int_0^\pi \cdots \int_0^\pi (\sin \phi_1)^{n} (\sin \phi_2)^{n-1} \cdots (\sin \phi_{n-2})^{3} (\sin \phi_{n-1})^2 \, {\rm d}\phi_1 {\rm d}\phi_2 \cdots {\rm d}\phi_{n-2} {\rm d}\phi_{n-1} \\ &= 2^{-\left(\frac{n(n+1)}{2}-2\right)} \, \pi^{n-1} \begin{pmatrix} n \\ \frac{n}{2} \end{pmatrix} \begin{pmatrix} n-1 \\ \frac{n-1}{2} \end{pmatrix} \cdots \begin{pmatrix} 3 \\ \frac{3}{2} \end{pmatrix} \begin{pmatrix} 2 \\ 1 \end{pmatrix} \end{align} which is the same as $c_{n-1}(n)$.

Putting everything together we get $$ \int_S \xi_i b'_{ij} \xi_j \, {\rm d}^n\xi = \frac{1}{n+2} \sum_{i=1}^n c_i(n) \, b'_{ii} \, . $$

Update: I just figured out that all the $c_i(n)$ are in fact equal to $c_n(n)$ as is seen by induction \begin{align} c_{i+1}(n)&=\frac{\int_0^\pi (\sin \phi_{i+1})^{n-i-2} (\cos \phi_{i+1})^{2} \, {\rm d}\phi_{i+1}}{\int_0^\pi (\sin \phi_{i+1})^{n-i-2} \, {\rm d}\phi_{i+1}} \frac{\int_0^\pi (\sin \phi_{i})^{n-i+1} \, {\rm d}\phi_{i}}{\int_0^\pi (\sin \phi_{i})^{n-i-1} (\cos \phi_{i})^{2}\, {\rm d}\phi_{i}} \, c_i(n)\\ &=\frac{1-\frac{B\left(\frac{n-i+1}{2},\frac{1}{2}\right)}{B\left(\frac{n-i-1}{2},\frac{1}{2}\right)}}{\frac{B\left(\frac{n-i}{2},\frac{1}{2}\right)}{B\left(\frac{n-i+2}{2},\frac{1}{2}\right)}-1} \, c_i(n) \\ &=\dots \\ &= c_i(n) \, . \end{align}

$c_n(n)$ in turn can be simplified significantly $$ c_n(n)=\begin{cases} \frac{\pi^k}{k!} = \frac{(2\pi)^k}{(2k)!!} \qquad {\rm if} \qquad n=2k \\ \frac{2(2\pi)^k}{(2k+1)!!} \qquad {\rm if} \qquad n=2k+1 \end{cases} \, . $$ This can be written as $$ c_n(n) = \frac{\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2}+1\right)} \qquad n=2,3,4,... $$ which then also simplifies the result to a nice expression $$ \int_S \xi_i b'_{ij} \xi_j \, {\rm d}^n\xi = \frac{c_n(n)}{n+2} \sum_{i=1}^n b'_{ii} = \frac{c_n(n)}{n+2} \, {\rm Tr}\left(B'\right) = \frac{c_n(n)}{n+2} \, {\rm Tr}\left(BA^{-1}\right) \, . $$

$c_n(n)$ is actually just the volume of the $n$-ball of radius $1$. Indeed for $B'=I$ the result of the integral is just \begin{align} \int_S \xi_i \xi_i \, {\rm d}^n\xi &= S_{n-1} \int_0^1 r^{n+1} \, {\rm d}r = \frac{S_{n-1}}{n+2} \\ &=\frac{\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2}+1\right)} \frac{n}{n+2}= \frac{2 \, \pi^{\frac{n}{2}}}{(n+2) \, \Gamma\left(\frac{n}{2}\right)} \end{align} where $S_{n-1}$ is the surface of the $n$-dimensional unit-sphere.

3
On

We don't have to go into the details of spherical coordinates.

There is a (nonorthogonal) basis of ${\mathbb R}^n$ that diagonalizes both quadratic forms $q_A$ and $q_B$ simultaneously. We may even assume that $q_A$ is given by $q_A(x)=x_1^2+x_2^2+\ldots+x_n^2$. Up to taking care of Jacobians it therefore remains to compute $$\int_D(\lambda_1x_1^2+\lambda_2x_2^2+\ldots +\lambda_n x_n^2)\>{\rm d}(x)\ ,$$ whereby $D$ is the unit ball in ${\mathbb R}^n$, and the $\lambda_i$ result from some eigenvalue calculations involving the given matrices $A$ and $B$.

Write $x=:(t,x')$ with $t\in{\mathbb R}$, $x'\in{\mathbb R}^{n-1}$, and denote by $D_r'$ the ball of radius $r$ in ${\mathbb R}^{n-1}$. Then we have to find the value of the following integral: $$\int_D t^2\>{\rm d}(x)=\int_{-1}^1 t^2\>{\rm vol}_{n-1}\bigl(D'_{\sqrt{1-t^2}}\bigr)\>dt=\beta_{n-1}\int_{-1}^1 t^2(1-t^2)^{(n-1)/2}\>dt\ .\tag{1}$$ Here $\beta_n$ denotes the volume of the $n$-dimensional unit ball. The RHS of $(1)$ can be expressed in terms of standard mathematical constants.