TITLE: The Gravity Potential of an Ellipsoid
QUESTION [9 upvotes]: The Original Problem
Recently, I have encountered the following volume integral
$$\mathcal{I}=\int_{\Omega}\frac{1}{|\mathbf{x}-\mathbf{x}'|}dV(\mathbf{x}') \tag{1}$$
where $\Omega$ is an ellipsoid defined by
$$\Omega=\bigg\{(x'_1,x'_2,x'_3):\frac{{x'}_1^2}{a_1^2}+\frac{{x'}_2^2}{a_2^2}+\frac{{x'}_3^2}{a_3^2}\le1\bigg\}$$
and $a_1,\,a_2,\,a_3$ are the semi-major axes of ellipsoid. This representation of $\Omega$ also implies that the origin of our coordinate system is at the center of the ellipsoid. Also, $\mathbf{x}$ is some arbitrary point in $\mathbb{R}^3$ which may belong to $\Omega$ or not. This integral arises in different problems of physics like the gravitation of a solid ellipsoidal mass or the electrostatic field of a solid ellipsoidal distribution of charges.
I want to simplify this integral as far as possible. I have been told that it can be represented in terms a simple integral over the real line and the answer will depend on wheather the point $\mathbf{x}$ is inside or outside $\Omega$.
I first do a translation by using the change of coordinates $\mathbf{x}'-\mathbf{x}=\mathbf{y}$
\begin{align*}
\mathcal{I} &= \int_{\Omega}\frac{1}{|\mathbf{x}-\mathbf{x}'|}dV(\mathbf{x}') \\
&= \int_{\Omega}\frac{1}{|\mathbf{x}'-\mathbf{x}|}dV(\mathbf{x}') \\
&= \int_{\Omega}\frac{1}{|\mathbf{y}|}dV(\mathbf{y}) 
\end{align*}
consequently, $\Omega$ can be represented as below
$$\Omega=\bigg\{(y_1,y_2,y_3):\frac{(y_1+x_1)^2}{a_1^2}+\frac{(y_2+x_2)^2}{a_2^2}+\frac{(y_3+x_3)^2}{a_3^2}\le1\bigg\}$$
and then I use the following transformation of coordinates
\begin{align*}
y_1&=r\sin\theta\cos\phi \\
y_2&=r\sin\theta\sin\phi \\
y_3&=r\cos\theta
\end{align*}
so I can get
\begin{align*}
|\mathbf{y}|&=r \\
dV(\mathbf{y})&=r^2\sin\theta dr\,d\theta\,d\phi \\
\Omega&=\bigg\{(r,\theta,\phi):\frac{(r\sin\theta\cos\phi+x_1)^2}{a_1^2}+\frac{(r\sin\theta\sin\phi+x_2)^2}{a_2^2}+\frac{(r\cos\theta+x_3)^2}{a_3^2}\le1\bigg\}
\end{align*}
so the integral becomes
\begin{align*} 
\mathcal{I}=\int_{\Omega}r\sin\theta\,dr\,d\theta\,d\phi
\tag{2}
\end{align*}
I am stuck right here. 

Can someone help to determine the limits of integration in $(2)$ and proceed to do the integration?

I don't need every detail. An outline will also suffice but not just the final answer! Any help is appreciated. :)
Extension of the Original Problem
Indeed Eq. (1) happens when the density of the distribution of mass or charges is uniform. A more interesting problem would be to evaluate the following integral.
$$\mathcal{I}=\int_{\Omega}\frac{\rho(\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|}dV(\mathbf{x}') \tag{3}$$
as a special case of the above problem, I am interested in the evaluation of the following integral
$$\mathcal{I}_{IJ\dots K}=\int_{\Omega}\frac{x'_Ix'_J \dots x'_K}{|\mathbf{x}-\mathbf{x}'|}dV(\mathbf{x}') \tag{4}$$
where $I,\,J,\dots,K$ are positive integers which range from $1$ to $3$ and $x'_I$ is the $I$th component of $\mathbf{x}'$ with respect to the standard Cartesian basis.

REPLY [7 votes]: Confocal ellipsoidal coordinates:
$$\frac{x^2}{a^2+s}+\frac{y^2}{b^2+s}+\frac{z^2}{c^2+s}=1$$

Let $s=\lambda$ be the greatest root.
$$\phi_{\text{interior}}=
\pi abc \int_{0}^{\infty}
\left(
  1-\frac{x^2}{a^2+t}-\frac{y^2}{b^2+t}-\frac{z^2}{c^2+t}
\right)
\frac{dt}{\sqrt{(a^2+t)(b^2+t)(c^2+t)}}$$
$$\phi_{\text{exterior}}=
\pi abc \int_{\lambda}^{\infty}
\left(
  1-\frac{x^2}{a^2+t}-\frac{y^2}{b^2+t}-\frac{z^2}{c^2+t}
\right)
\frac{dt}{\sqrt{(a^2+t)(b^2+t)(c^2+t)}}$$
A good reference:
A collection of problems in mathematical physics