Calculate $\int_{S_A} x^T B x \, dx$ where $S_A$ is an ellipsoid 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.
 A: 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.
A: 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.
