# What are the set of vectors satisfying this quadratic form equality (real entries only)

This question was already asked in the case of Hermitian matrices, which have complex entries.

I want to pose the same question in the case of matrices which have only real entries. I.e. for a given $c$ How to determine the set of vectors $\mathbf{x}$ satisfying the quadratic form equality

$$\mathbf{x^TMx}=c$$

where $\mathbf{M}$ is a non-singular (square, p.d., probably symmetric) matrix with only real entries.

Forgive me if I should have been able to figure this out from the linked post.

• By definition, the solution set is a quadric (hyper)surface. If $\bf M$ is symmetric, then Sylvester's Law of Inertia implies there is a matrix $P$ such that $P^T M P$ has the form $\textrm{diag}(1, \ldots, 1, -1, \ldots, -1)$, and so the corresponding change of basis puts the quadric into a standard form, for which parameterizations are available. – Travis Willse Apr 4 '17 at 14:24

\begin{align*} x^T M x & = c \\ x^T V \Lambda V^T x & = c && M \text{ is symmetric and real, so can use spectral theorem} \\ y^T \Lambda v & = c && y = V^T x \\ y^T \Lambda^{1/2} \Lambda^{1/2} y &= c && M \text{ is PSD so the square roots exist} \\ ||\Lambda^{1/2} y||^2 &= c \\ \sum_{i=1}^n \lambda_i y_i^2 &= c \\ \sum_{i=1}^n \frac{y_i^2}{\Big(\frac{\sqrt{c}}{\sqrt{\lambda_i}}\Big)^2} &= 1 && \text{Equation of an axis-aligned ellipsoid with }i \text{-th axis length } \frac{\sqrt{c}}{\sqrt{\lambda_i}} \\ \end{align*}

Once you have $y$, you can solve for $x$ as $Vy = x$. So, the isosurface is an ellipsoid transformed by $V$.

Notice also that the $i$-th axis vector $w^i$ is given by

\begin{align*} w_{j}^i & = \begin{cases} \frac{\sqrt{c}}{\sqrt{\lambda_i}} & i = j \\ 0 & \text{otherwise} \end{cases} \end{align*}

So, when transforming the axes by $V$ we find that the $i$-th axis vector $z^i$ is given by

\begin{align*} z^i & = Vw^i \\ & = \frac{\sqrt{c}}{\sqrt{\lambda_i}} v_i && \text{where } v_i \text{ is the } i\text{-th eigenvector of } M \end{align*}

This is because $V$ is a matrix where the $i$-th column is the $i$-th eigenvector of $M$. Therefore, the shape of the solution set to $x^TMx=c$ is an ellipsoid centered at the origin with the eigenvectors of $M$ as axes with lengths $\frac{\sqrt{c}}{\sqrt{\lambda_i}}$

I should note that I recognized this problem because it's basically the same as the problem found starting on page 42 of the notes for my machine learning class. That's page 42 in the actual text, page 48 in the pdf file.

• Thanks for this answer. Very helpful, although I don't quite get how you can just drop out $V$. When I work through an example it sort of seems okay, but this would mean you could replace $x^TMx$ with $x^T \Lambda x$ any time $M$ is symmetric. That seems like cheating. – ben Apr 5 '17 at 14:52
• @ben Whoops, you're right. I changed my answer. – michaelsnowden Apr 5 '17 at 16:29
• @ben Check out my latest edit. I added some important details about what the shape is after transforming by $V$. – michaelsnowden Apr 5 '17 at 21:15