Multidimensional ellipsoids are mathematically interesting figures per se. But there is a reason why they sometimes also appear in the context of Machine Learning experiments. One reason is that Multivariate Normal Distributions [MND] often describe the statistical distributions of properties which characterize natural objects we investigate by ML-methods. And the locations of constant probability density of MNDs are surfaces of multidimensional ellipsoids.

MNDs and ellipsoids may therefore appear in data distributions in diverse variable spaces which we use in ML to describe objects. E.g., the original variable space of training data, but also in abstract internal or latent variable spaces of e.g. Autoencoders.

This post shortly discusses the quadratic mathematical equation for vector components reaching to the surface of a multidimensional ellipsoid. We look in particular at the equations for *centered* ellipsoids. By “centered” we mean that the symmetry center of the ellipsoid coincides with the origin of the Euclidean Coordinate System in which we describe ponts and vectors in a n-dimensional variable space. The equations of a 2-dimensional ellipse and a 3-dimensional ellipsoid are briefly discussed.

**Level of this post series: Advanced. **Knowledge of Linear Algebra is required.

## Euclidean coordinate system

We work in an Euclidean Coordinate System of the ℝ^{n}. Points in this space have position vectors \( \pmb{v} \) which we write in vertical form

*T* symbolizes the transposition operation. A position vector has its starting point fixed at the ECS origin.

## Quadratic form for *n* = 3

The surface of a *n*-dimensional ellipsoid can be described by an equation for respective components of position vectors to pints on this surface. For *n*=3 the equation would have the following form for a vector \( \pmb{v_e} = \left( \, x,\, y,\, z\, \right)^T \) :

An equation of this form not only describes an ellipsoid. Its coefficients have to fulfill certain conditions. We summarize these conditions below as a requirement a certain matrix has to fulfill.

The image below show surfaces of three nested ellipsoid described by a general quadratic equation:

If the ellipsoid is ** centered** then we get only quadratic terms:

We have incorporated the constant term into the coefficients. This can be rewritten as a matrix equation:

Note that the matrix \( \pmb{\operatorname{A}} \) is a real-value symmetric (3×3)-matrix! Any such matrix has an eigenvalue decomposition. See the next post for more details.

An important property the matrix must fulfill to really describe a 3-dimensional ellipsoid and not another type of figure is:

Note also that though centered the ellipsoid described by a general quadratic equation still will be rotated against some or all coordinate axes. I.e. the principal axes of the ellipsoid may not be aligned with the ECS axes.

## Quadratic form for a *non-centered* *n-*dimensional ellipsoid

The formulas above can be generalized to *n* dimensions. If the center of a ** non-centered** ellipsoid is given by a position vector \( \pmb{\psi} \) then the formula for vectors \( \pmb{v_e} \) to its surface can be written as

## Equation for a *centered* n-dimensional ellipsoid

For a **centered***n*-dimensional ellipsoid equation (2) reduces to

Without loss of generality we can again put the *C* into the matrix coefficients.

Again, we deal with a real-valued, symmetric matrix. And we demand

Note that his condition makes the matrix invertible.

## Mapping matrix coefficients to the equation coefficients for *n* = 3

The general expression we have found for a non-centered ellipsoid can for *n*=3 be related to the coefficients of the respective quadratic form by :

## Axis-parallel ellipsoid as a special case

For *n*=2 and *n*=2 many readers may have got acquainted with an ellipsoid by an equation like

with principal axes \(r_1,\, r_2 \) and \(r_1,\, r_2, \, r_3 \) respectively, of an ellipsoid. The difference is that in this case the ellipsoid is not only centered, but its principal axes are also aligned with the axes of the ECS. This corresponds to a diagonal form of the matrix \( \pmb{\operatorname{A}}_q \) :

The matrix coefficients here have a direct geometrical interpretation.

## Diagonal matrices? Orientation of an ellipsoid?

Two questions arise:

- How can we build a general rotated ellipsoid starting with a diagonal form in 3- and in
*n*-dimensional spaces? - When a general matrix \( \pmb{\operatorname{A}}_q \) is given: By what kind of operation do we get a corresponding diagonal matrix describing the lengths of the principal axes? And how do we get an information about the orientation of an ellipsoid from \( \pmb{\operatorname{A}}_q \)?

These are topics of the next posts in this series.

## Conclusion

Vectors to the surfaces of centered and non-centered n-dimensional ellipsoids are described by an equation comprising quadratic terms of the vector components. Such an equations can be written in vector form with a symmetric and invertible matrices \( \pmb{\operatorname{A}}_q \). In the next post of this series I will discuss how to get information about geometrical properties of a centered ellipsoid from the coefficients of \( \pmb{\operatorname{A}}_q \).