# Map an ellipsoid to a sphere

If I have a ellipsoid described by:

$(\boldsymbol{x} - c)^T \boldsymbol{A} (\boldsymbol{x} - c) = 1$

How do I get the transformation to an unit sphere centered at the origin?

From the principal axis theorem, I know that $\boldsymbol{A}$ must be diagonalized by:

$\boldsymbol{A} = \boldsymbol{R}^T \boldsymbol{D} \boldsymbol{R}$

Where $\boldsymbol{R}$ is an orthonormal matrix, which columns are the orthonormal eigenbasis, and $\boldsymbol{D}$ is the diagonal matrix.

However I don't get how to proceed in order to get $\boldsymbol{M}$ in:

$\boldsymbol{y} = \boldsymbol{M}(\boldsymbol{x} - c)$

where $\boldsymbol{y}$ is a point in the unit sphere.

Context: What I'm really trying to do is calibrate a magnetometer sensor, which due to distortions instead of displaying a spherical locus, it is an ellipsoid. Knowing the center and the transformation between both should be enough to allow me to calibrate it for the application in hands.

• Presumably, $A$ is symmetric positive-definite. The eigenvalues of $A$ are the reciprocals of the squares of the semi-axis lengths. $M$ will be a matrix that scales by the appropriate factor along the direction of each eigenvector.
– amd
Commented Apr 12, 2016 at 20:06

Hint: $$(x-c)^TA(x-c) = (x-c)^TR^TD^{1/2}D^{1/2}R(x-c) = \\ [D^{1/2}R(x-c)]^T [D^{1/2}R(x-c)]$$