2

I'm trying to sample points on the surface of a 9 dimensional ellipsoid represented by

$$x^T Mx = 1,\hspace{2cm}x\in \mathcal{R}^9, M\in\mathcal{R}^{9x9}$$

and $M$ is positive symmetric definite.

If it was in the form:

$$(\frac{x_1}{r_1})^2 + (\frac{x_2}{r_2})^2 + ... + (\frac{x_9}{r_9})^2 = 1$$

I would then just sample points randomly, and then scale them as described here: How to generate points uniformly distributed on the surface of an ellipsoid?

Thus, my question is how would I convert the ellipse from matrix form to the equation form in 9 dimensions? I saw a post on how to do it in 3 dimensions related to Euler angles here: How to generate points uniformly distributed on the surface of an ellipsoid? but I have no idea how to extend that to 9 dimensions.

1 Answers1

1

Since $M$ is symmetric PD, we can work out (numerically or symbolically) the eigendecomposition $M= QDQ^{-1}$ where $Q$ is orthogonal and $D$ contains the positive eigenvalues of $M$. Hence we can write $$x^T M x=(Qx)^T D Q x=\lambda_1 y_1^2+\lambda_2 y_2^2+\cdots+\lambda_9 y_9^2 =1.$$ But this is exactly the form you know how to solve, with $r_k =\lambda_k^{-1/2}>0$ for all $k$. Moreover, the orthogonality of the matrix $Q$ means that all we've done is a global rotation (up to a possible reflection) which doesn't affect the uniformity of the point distribution. So it suffices to generate points with respect to $y\in \mathcal{R}^9$ and back-transform via $x=Q^{-1}y$.

Semiclassical
  • 15,842
  • Ah thanks! Hm, now that I think about it from your answer, instead of doing a transformation, could I generate random vectors $\hat x$, evaluate the scale factor $s = \hat x ^T M \hat x$, and then set $x = \frac{\hat x}{\sqrt{s}}$? – Richard Nai Aug 30 '21 at 21:58
  • Perhaps. One reference you may find useful is this Q&A over at Cross-Validated: https://stats.stackexchange.com/questions/367136/how-to-sample-uniformly-from-the-surface-of-a-hyper-ellipsoid-constant-mahalano. In their code they do work with the transformation matrix; however, it seems like they're partly doing that to find the scale factors. So I'm not completely sure, but I do think they don't entirely get rid of the need for $Q$. – Semiclassical Aug 30 '21 at 22:10