Question
I have an ellipsoid represented as a Covariance $\Sigma \in \mathbb{R}^{3\times3}$ and a mean centroid $\mu\in \mathbb{R}^{3}$. I want to represent it as a homogenous quadric, which is a $4\times4$ symmetric matrix. A quadric fulfills the property $\hat{x}^{\top}Q\hat{x}=0$ for all points $\hat{x} = [x^\top;1]^{\top}$ on the surface of the ellipsoid.
Background
This post describes how to convert a Covariance to quadric form but assumes $\mu=0$. I tried setting $b=\mu, c=-1$, but that does not work.
I specifically need it in this form, as I want to project in onto a conic like so $C^{*}=PQ^{*}P^\top$ in the next step.
Does anyone know how to adapt the quadric if the Ellipsoid is not zero-centered?
Update
I tried to derive the Quadric parametrization from a given $(\Sigma, \mu)$.
We can define the $\sigma$-surface of this ellipsoid:
$$(x-\mu)^\top\Sigma^{-1}(x-\mu)-\sigma=0$$
It can also be described with the general quadric equation:
$$x^{\top}Ax+2b^{\top}x+c=0$$
By multiplying out the first equation and comparing the constant, linear and quadratic terms, the following correspondances between the parameters can be established:
$$A=\Sigma^{-1}, b=-A\mu ,\; c=\mu^⊤\mu-\sigma$$
The general quadric equation can be expressed more compact with homogenous formulation:
$$Q = \begin{bmatrix}A & b \\ b^⊤ & c\end{bmatrix}, $$ $$ \hat{x}^{\top}Q\hat{x}=0, \hat{x}=[x^{\top},1]^{\top}$$
Remaining Problem (Example)
For an axis-aligned, non zero-centered Ellipsoid parametrized by
$$\Sigma=\begin{bmatrix}2 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}, \mu=[1, 1, 1]^\top$$
the resulting quadric looks like this
$$Q=\begin{bmatrix} 0.5 & 0 & 0 & -0.5\\ 0 & 1 & 0 & -1 \\ 0 & 0 & 1 & -1\\ -0.5 & -1 & -1 & 2 \end{bmatrix}$$.
The problem is, that the equation $\hat{x}^{\top}Q\hat{x}=0$ is not fulfilled anymore:
$$\hat{x} = [3, 1, 1, 1]\rightarrow \hat{x}^{\top}Q\hat{x}= 1.5$$ $$\hat{x} = [1, 2, 1, 1]\rightarrow \hat{x}^{\top}Q\hat{x}= 0.5$$ $$\hat{x} = [1, 1, 2, 1]\rightarrow \hat{x}^{\top}Q\hat{x}= 0.5$$
Am I missing something? This Colab Notebook shows the code I used to test this all. Feel free to leave a comment.
Sample $z\sim N(0,I)$ standard Gaussian, then map it to $x=Az+\mu$ then $x\sim N(\mu,\Sigma)$ is distributed as the ellipsoidal Gaussian as you need. you can generate $|z|=1$, then $Az$ is the equidensity ellipsoid.
– Binxu Wang 王彬旭 May 16 '22 at 05:13on_ellipsoidmethod checks out for all samples on the ellipsoid. Do you have a clue, why $x^{T}Qx=0.5$ and not $0$ as expected? – rohlemax May 16 '22 at 13:46