Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This sounds like a simple problem, but I can't get it done. Given the general equation $ax^2 + by^2 + cz^2 + dxy + exz + fyz + gx + hy + iz + j = 0,$ what are the requirements on the coefficients so that this equation represents an ellipsoid? All coefficients are real.

Some more context. To make the representation unique, we establish another constraint: $a + c = 1$. I'm not sure how important that might be. The question is in homework where we have to fit this equation to a set of points, using QR-decomposition. That isn't a problem, the small followup question "how can you see the coefficients determine an ellipsoid" is the problem.

I tried working on the equation to get something usable, from basic term regrouping to putting stuff in matrices and decomposing these, which didn't really help. One theoretic way to do it, I think, is to find the center of mass of the surface, translate to the origin, then find the principal axes, transform again, and show the radii are all larger than 0. Sounds like a lot of work for a simple question, and I'm kind of stuck on the "center of mass" part, I don't feel the idea here is to integrate the formula over $\mathbb{R}^3$. I've also been thinking about calculating curvature or something with the Frenet-Serret formulas, but my geometry courses have been too long ago to know what I want here.

Is there a simple test to determine this? Something along the lines of "the eigenvalues of matrix foo are all positive" or "the value of bar is real" or I don't know what...

Thanks a lot for any insights you can give me!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

There are two steps involved.

Step 1: translate to centre of mass

The goal of translation to the centre of mass is to remove the linear terms in your coefficients. You want to turn your expression into the form

$$ AX^2 + BY^2 + CZ^2 + D XY + E YZ + F XZ + G = 0$$

where $X = (x - x_0)$, $Y = (y - y_0)$ and $Z = (z-z_0)$, where $x_0, y_0, z_0$ are the coordinates for the centre of mass. To do so you can solve forward by completing the square, or solve backwards by plugging in the expressions for $X,Y,Z$ and matching coefficients.

Step 2: check for positivity of eigenvalues

Relative to the centre of mass, you can write your equation as

$$ Q(v) = -G $$

where $Q$ is the quadratic form

$$ Q(v) = AX^2 + BY^2 + \cdots + F XZ, \qquad v = (X,Y,Z) $$

Then recall that the level surfaces of a quadratic form define ellipsoids if and only if it is positive definite. So computing the eigenvalues (among the many ways to check that a quadratic form is positive definite) will get you the answer. (Of course, this will also require $G$ to be a negative number for there to be a solution.)

share|improve this answer
The matrix involved may be merely 3-by-3, but Cholesky remains a quicker way of verifying positive definiteness than explicitly computing eigenvalues. However, if you'll be doing more than merely verifying positive definiteness (e.g. you need the directions of the principal axes), then eigendecomposition is required. –  J. M. Dec 13 '10 at 2:21
Well, there are ways of verifying positive definiteness, but I'm almost sure the OP is supposed to be doing this by hand; Cholesky is surely an over-kill. He doesn't even need to compute the eigenvalues. All he need is the determinant and $AB - D^2$ both positive (since if $A,B,C$ not all positive you can trivially rule-out positive-definiteness...) –  Willie Wong Dec 13 '10 at 2:47
"The question is in homework where we have to fit this equation to a set of points, using QR-decomposition." - I supposed from this that this is a programming problem... unless he'd be doing least-squares via Gram-Schmidt, but I don't believe anybody's that cruel... –  J. M. Dec 13 '10 at 2:56
@J.M. Why not? I've given homework questions like that before. And the phrasing of the follow-up question suggests to me it is not programming. But as long as the OP does not specify, this debate is purely academic. –  Willie Wong Dec 13 '10 at 3:16
Yes, this works out. Thanks a lot! I did the calculations in Matlab, but I still had to provide proof of my method in the report, obviously. The QR-decomposition was also with computer, I wouldn't want to do the least-squares fit of 150 points with Gram-Schmidt... –  Verhoevenv Dec 13 '10 at 3:54

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.