Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hope it is a right place to ask how to solve the equation on $\mathbf x$: $$ \mathbf x^T \mathbf A\mathbf x + \mathbf x^T \mathbf b + c = 0. $$ where:
$\mathbf x$ is an $n\times 1$ column vector
$\mathbf A$ is an $n\times n$ matrix
$\mathbf b$ is an $n\times 1$ vector
$c$ is a scalar

share|cite|improve this question
Welcome to MSE! The set of solutions of your equation forms a quadratic hypersurface. The procedure of finding it is not too difficult, but it takes a little bit of space, so I'm not going to try to describe it to you. May be somebody else will? The principal axis theorem plays a key role (it has an $n$-dimensional analogue). Hopefully you have seen images of spheres, ellipsoids, parabaloids, cones, hyperboloids, parabolic hyperboloids (=saddle surface) et cetera in the case $n=3$. Something very similar will happen here. – Jyrki Lahtonen Jul 20 '11 at 19:55
@Shaun: Does the equation not stay the same, if we replace $A$ with $(A+A^T)/2$? So we can always assume that $A$ is symmetric? – Jyrki Lahtonen Jul 20 '11 at 20:19
I cleaned up the math notation, and a notice says that my edits await "peer review". – Michael Hardy Jul 20 '11 at 20:40
@Michael: They've been reviewed in the meantime. You can edit with reputation $\ge2000$. BTW, are you the Michael Hardy from Wikipedia? If so, I'm glad you found your way here :-) (I'm also joriki from Wikipedia.) – joriki Jul 20 '11 at 21:02
Yes---I'm the same person. – Michael Hardy Jul 21 '11 at 16:13
up vote 5 down vote accepted

Hint 1: We can assume ${\bf A}$ is symmetric. If it's not, we can replace it by ${\bf B}=({\bf A}+{\bf A}^T)/2$, because ${\bf x}^T {\bf A}{\bf x} = {\bf x}^T {\bf B}{\bf x}$ (check it). (That's why quadratic equations are usually expressed using symmetric matrices; we don't lose generality).

Hint 2: This is the generalization of the (scalar) quadratic $$ax^2 + b x + c = 0$$ Do you know how to solve it (completing the square)? If so, try to generalize the procedure. If not, learn it.

Hint 3: Consider the special case ${\bf x}^T {\bf x} = v$. If $v$ is positive, the solutions lie on a sphere. Now, if ${\bf x^T A x} = v$ , if we can write ${\bf A} = {\bf P \Lambda P^T }$ (we can if A is symmetric), we make a change of variable ${\bf z} = {\bf P^T x}$ (a rotation of axis) and we get the equation of a (hyper)ellipse, if $ v$ is positive and ${\bf \Lambda }$ is diagonal with positive entries.

share|cite|improve this answer
The matrix A is symmetric (it's covariance). – Serg Jul 21 '11 at 16:43
@Serg: Do you know how to diagonalize that symmetric matrix? You need to do that step (and the related change of coordinate systems) before you can start completing the squares. If you don't, look up some linear algebra books for help. – Jyrki Lahtonen Jul 21 '11 at 20:33
So, the best hint was to diagonalize matrix A.<br> Now I get it by denoting A = V'DV, z = V*x.<br> Thanks! – Serg Jul 22 '11 at 11:37
Not sure why you're making $v$ bold when it's a scalar... – anon Jul 22 '11 at 13:07
@anon: my bad, fixed – leonbloy Jul 22 '11 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.