Mathematics for AI and Machine Learning

Foundations for modern AI and machine learning

Ellipsoid

Chapter 7 Geometry & transforms

Chapter 7: Symmetric Matrix — Ellipsoid Geometry & Anomaly Detection

High-resolution PNG
Ellipsoid — high-resolution mind-map icon

From the book

Chapter 7: Symmetric Matrix. In the chapter mind map this icon labels Ellipsoid Geometry & Anomaly Detection. The discussion below is excerpted and lightly edited from § Example: Anomaly Detection with Correlated Features in Mathematics for AI and Machine Learning.

Problem: A health monitoring system tracks patients' height (in cm) and weight (in kg). The training data shows that height and weight are positively correlated: taller people tend to weigh more. The mean vector is $\boldsymbol\mu = [170, 70]^\top$ (170cm, 70kg) and the covariance matrix is

The diagonal elements of $\Sigma$ are the variances: $\sigma_{\text{height}}^2 = 100$ (standard deviation $\sigma_{\text{height}} = 10$ cm) and $\sigma_{\text{weight}}^2 = 25$ (standard deviation $\sigma_{\text{weight}} = 5$ kg). The off-diagonal covariance $\Sigma_{12} = 40$ indicates a positive correlation.

We evaluate two new patients: - Patient A: $\mathbf x_A = [180, 80]^\top$ (10cm taller and 10kg heavier than average) - Patient B: $\mathbf x_B = [180, 60]^\top$ (10cm taller but 10kg lighter than average)

Using Euclidean distance: Both patients are at the exact same Euclidean distance from the mean:

Euclidean distance is misleading here because it ignores scale differences between the features (adding centimeters directly to kilograms) and is blind to their correlation.

Using Mahalanobis distance: The Mahalanobis distance is $\|\mathbf x - \boldsymbol\mu\|_M = \sqrt{(\mathbf x - \boldsymbol\mu)^\top \Sigma^{-1} (\mathbf x - \boldsymbol\mu)}$. We compute the inverse covariance matrix:

What this drawing shows

What you see. Represents a transformed unit ball whose axes and radii encode covariance, singular values, or quadratic-form geometry.

In the mind map. Chapter 7 — Ellipsoid Geometry & Anomaly Detection. See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 7 companion →

Read the full definitions, figures, and worked examples in Chapter 7: Symmetric Matrix — see the mind-map node Ellipsoid Geometry & Anomaly Detection.