13

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
Thanks

Serg
  • 277
  • 2
    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
  • 1
    If $A$ happens to be symmetric, then the solution of your equation is equivalent to finding all points on a quadric in $\mathbb{R}^n$. – Shaun Ault Jul 20 '11 at 20:00
  • 2
    @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
  • 2
    I cleaned up the math notation, and a notice says that my edits await "peer review". – Michael Hardy Jul 20 '11 at 20:40
  • 3
    @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
  • 2
    Yes---I'm the same person. – Michael Hardy Jul 21 '11 at 16:13

1 Answers1

10

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.


Edit ($12$ years later): To all those who insist in asking for a "explicit full solution": there is no formula for finding ${\bf x}$. The solutions to the equation are (in general) infinite, and lie over a quadric hypersurface. For $n=3$ you already have many possible cases (five, plus the degenerate ones). My hints above just point to a procedure for symplifying a little the math, by aligning the axis (see https://en.wikipedia.org/wiki/Principal_axis_theorem ) and help you to understand the case and identify the corresponding quadric. In particular, it shows that if ${\bf B}$ is positive definite, the solutions lie over a hyperellipse, and you can find the parameters (center, axis, radius, etc).

leonbloy
  • 63,430
  • The matrix A is symmetric (it's covariance). – Serg Jul 21 '11 at 16:43
  • 1
    @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.
    Now I get it by denoting A = V'DV, z = V*x.
    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
  • 14
    I am wondering if you can make this answer more explicit rather than just giving the hints. I have a similar problem that I feel may be solvable this way, but I am no linear algebra expert and it would be nice to see the full solution for this. – Ben Farmer Aug 22 '18 at 14:55
  • Please can we indeed get a full solution to this? – Euler_Salter Sep 27 '22 at 12:43
  • Even for the special case $\mathbf{x}^T\mathbf{x}=v$ the solution is not a formula to calculate $\mathbf{x}$. I think this is the reason for the hints by @leonbloy . – Ted Black Oct 07 '23 at 08:33