How to obtain the equation of the projection/shadow of an ellipsoid into 2D plane?

Given an ellipsoid equation of the form \begin{equation}\label{eq_1}x'Ax=1\end{equation} where $A\in\mathbb{R}^{n\times n}$ is positive definite and non-diagonal and $x\in\mathbb{R}^n$. So, how can I obtain the projection or shadow of the ellipsoid into a 2D plane?
In these links: How to prove the parallel projection of an ellipsoid is an ellipse? and Projection of ellipsoid part of this question was answered, but I need a general way to find an expression of the ellipse in the 2D plane for a given $A$.


Let $f(\mathbf{x})=\mathbf{x'}A\mathbf{x}-1$. The projection you seek into the $(x1,x2)$ plane is the set of points (see Christian Blatter's answer here) where the gradient $\nabla f$ has no $x_3,...,x_n$ components. Since $\nabla f = 2 A x$, this means you have n-2 linear equations relating $x_1, ..., x_n$. For example, in the 4 dimensional case, you will have 2 equations $$a_{13}x_1+ a_{23}x_2 + a_{33}x_3 + a_{43}x_4 = 0$$ and $$a_{14}x_1+ a_{24}x_2 + a_{34}x_3 + a_{44}x_4 = 0$$ This lets you solve for $x_3,...,x_n$ in terms of $x_1$ and $x_2$.

For the more general n-dimensional case, partition the matrix A into submatrices in this way: $$ \mathbf{A}= \left[\begin{array}{r|r} J & L' \\ \hline L & K \\ \end{array} \right]$$

where $J$ is a $2\times 2$ submatrix, $L$ is $(n-2) \times 2$, and $K$ is $(n-2) \times (n-2)$. Let $\mathbf{y}$ be the vector $(x_1,x_2)$ and let $\mathbf{z}$ be the vector $(x_3,...,x_n)$ The conditions I mentioned from the gradient would be $$ L\mathbf{y}+K\mathbf{z} =0$$. Solve this along with the equation of the original ellipsoid $$ \left( \begin{array}{r|r} \mathbf{y'} | \mathbf{z'} \\ \end{array}\right) \left[\begin{array}{r|r} J & L' \\ \hline L & K \\ \end{array} \right] \left( \begin{array}{r} \mathbf{y} \\ \hline \mathbf{z} \\ \end{array}\right) = 1$$

This gives the equation of the curve you seek as $$ \mathbf{y'} \left( J - L'K^{-1}L\right)\mathbf{y}= 1$$

Please see Jean Marie's answer to my question (specific 3-d case of the multi-dimensional case in your question) to see that $J - L'K^{-1}L$, a Schur complement, is also positive definite. This shows that the projection is an ellipse.