Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

High Dimensional Data & The Curse of Dimensionality

High Dimensional Data & The Curse of Dimensionality

Mahmood Amintoosi, Fall 2026 Computer Science Dept, Ferdowsi University of Mashhad

Introduction

In modern data mining and machine learning, we often deal with data in very high-dimensional spaces (e.g., images, text embeddings, genomic data). A dataset is typically represented as an n×dn \times d matrix D\mathbf{D}.

Understanding the nature of high-dimensional space, or hyperspace, is very important because it does not behave like the more familiar geometry in two or three dimensions. This phenomenon is often referred to as the Curse of Dimensionality.

Key phenomena we will explore:

  1. Volume Concentration: The volume of a hypersphere vanishes relative to the hypercube.

  2. The Problem of Local Neighborhoods: Why “local” methods like k-NN fail (based on Elements of Statistical Learning).

  3. The Thin Shell: Most of the volume concentrates near the surface.

  4. Orthogonality: Random vectors in high dimensions are nearly orthogonal.

  5. Gaussian Behavior: Points concentrate in a thin ring around radius d\sqrt{d}.


Geometry of Hyperspace: Cubes and Spheres

Let’s define the two most basic shapes in dd-dimensions.

The Hypercube

The data space is often viewed as a dd-dimensional hyper-rectangle or hypercube. For a hypercube Hd(l)H_d(l) with side length ll, the volume is:

Vol(Hd(l))=ld\text{Vol}(H_d(l)) = l^d

The Hypersphere

The hypersphere Sd(r)S_d(r) consists of all points exactly at distance rr from the center. The volume of a dd-dimensional hyperball of radius rr is given by:

Vol(Sd(r))=Kdrd=πd/2Γ(d2+1)rd\text{Vol}(S_d(r)) = K_d r^d = \frac{\pi^{d/2}}{\Gamma(\frac{d}{2}+1)} r^d

Where Γ\Gamma is the Gamma function.

Figure 6.4. Hypersphere inscribed inside a hypercube: in (a) two and (b) three dimensions

The Empty Center (The “Porcupine” Effect)

Consider the space enclosed within the largest hypersphere that can be accommodated within a hypercube of side length l=2rl=2r. The ratio of their volumes is:

lim⁡d→∞Vol(Sd(r))Vol(Hd(2r))=lim⁡d→∞πd/22dΓ(d2+1)→0\lim_{d \to \infty} \frac{\text{Vol}(S_d(r))}{\text{Vol}(H_d(2r))} = \lim_{d \to \infty} \frac{\pi^{d/2}}{2^d \Gamma(\frac{d}{2}+1)} \to 0

Implication: As dimensionality increases, the volume of the hypersphere becomes negligible compared to the hypercube. Most of the volume of the hypercube is in the corners, whereas the center is essentially empty.

Corners in High Dimension

Conceptual view of high-dimensional space: (a) two, (b) three, (c) four, and (d) higher dimensions. In d dimensions there are 2d2^d “corners” and 2d−12^{d−1} diagonals. The radius of the inscribed circle accurately reflects the difference between the volume of the hypercube and the inscribed hypersphere in dd dimensions.


<Figure size 1000x600 with 1 Axes>

The Problem of Local Neighborhoods (k-NN)

One of the most significant manifestations of the curse of dimensionality affects “local” methods like k-Nearest Neighbors (k-NN).

Edge Length of Neighborhoods

Suppose we have inputs uniformly distributed in a pp-dimensional unit hypercube. We want to form a local neighborhood that captures a fraction rr of the observations. Since this corresponds to a fraction of the unit volume, the expected edge length ep(r)e_p(r) of this neighborhood is:

ep(r)=r1/pe_p(r) = r^{1/p}

FIGURE 2.6. The curse of dimensionality is well illustrated by a subcubical neighborhood for uniform data in a unit cube. The figure on the right shows the side-length of the subcube needed to capture a fraction r of the volume of the data, for different dimensions p. In ten dimensions we need to cover 80% of the range of each coordinate to capture 10% of the data

Let’s visualize this for different dimensions (pp) and fractions (rr).

<Figure size 800x600 with 1 Axes>

Analysis: In 10 dimensions (p=10p=10), to capture just 10% (r=0.1r=0.1) of the data, we need to cover 80% of the range of each input variable. Such neighborhoods are no longer “local”. To find neighbors, we must look very far away.

Distance to Boundary

Another consequence is that sampling density is sparse. For NN data points in a pp-dimensional unit ball, the median distance from the origin to the closest data point is:

d(p,N)=(1−121/N)1/pd(p,N) = \left(1 - \frac{1}{2}^{1/N}\right)^{1/p}

For N=500N=500 and p=10p=10, this distance is ≈0.52\approx 0.52, which is more than halfway to the boundary. Hence, most data points are closer to the boundary of the sample space than to any other data point. This makes prediction a problem of extrapolation rather than interpolation.


The Thin Shell Argument

Where is the volume located inside a hypersphere itself? Consider a thin shell of width ϵ\epsilon near the surface of a sphere of radius rr. The volume of this shell is:

Vol(Sd(r,ϵ))=Vol(Sd(r))−Vol(Sd(r−ϵ))\text{Vol}(S_d(r, \epsilon)) = \text{Vol}(S_d(r)) - \text{Vol}(S_d(r - \epsilon))

The ratio of the shell’s volume to the total volume is:

Vol(Sd(r,ϵ))Vol(Sd(r))=1−(1−ϵr)d\frac{\text{Vol}(S_d(r, \epsilon))}{\text{Vol}(S_d(r))} = 1 - \left( 1 - \frac{\epsilon}{r} \right)^d

As d→∞d \to \infty, the term (1−ϵr)d(1 - \frac{\epsilon}{r})^d tends to 0.

lim⁡d→∞Vol(Sd(r,ϵ))Vol(Sd(r))→1\lim_{d \to \infty} \frac{\text{Vol}(S_d(r, \epsilon))}{\text{Vol}(S_d(r))} \to 1

For example, for a circle in two dimensions, with r =1 and ϵ\epsilon = 0.01 the volume of the thin shell is 1−(0.99)2=0.0199≃2%1−(0.99)^2 = 0.0199 ≃ 2\%. As expected, in two-dimensions, the thin shell encloses only a small fraction of the volume of the original hypersphere. But for 100 dimensions thin shell volume becomes 1−(0.99)100≃1−0.37≃0.631−(0.99)^{100} ≃ 1 - 0.37 ≃ 0.63.

Conclusion: In high dimensions, almost 100% of the volume (and probability mass) of a hypersphere is concentrated in a thin shell near the surface (crust). The interior is essentially empty.


<Figure size 1000x600 with 1 Axes>

Generating Uniform Points on a Hypersphere

Generating points uniformly inside a hypersphere in high dimensions is tricky. Due to the volume properties discussed above, simple methods like “Rejection Sampling” (generate in cube, keep if in sphere) fail because the acceptance rate approaches zero (remember the Empty Center/Porcupine effect).

Rejection Sampling: Generate points in a Hypercube and keep those inside the Sphere.

Problem: As we proved in Section 1, the ratio of sphere volume to cube volume goes to 0. You will reject almost 100% of your points. This is computationally infeasible.

<Figure size 600x600 with 1 Axes>
Dimension: 2, Total points generated: 2574, Ratio: 0.777000777000777
Dimension: 3, Total points generated: 3766, Ratio: 0.5310674455655868
Dimension: 4, Total points generated: 6580, Ratio: 0.303951367781155
Dimension: 5, Total points generated: 11398, Ratio: 0.1754693805930865
Dimension: 6, Total points generated: 23695, Ratio: 0.0844059928254906
Dimension: 7, Total points generated: 53522, Ratio: 0.037367811367288215
Dimension: 8, Total points generated: 123644, Ratio: 0.016175471514994662
Dimension: 9, Total points generated: 310177, Ratio: 0.0064479313424270655
Dimension: 10, Total points generated: 807321, Ratio: 0.0024773293398784374
<Figure size 800x600 with 1 Axes>

Generate points form Gaussian distribution

<Figure size 640x480 with 1 Axes>

Random vector uniformly distributed on the surface of a unit hypersphere

To generate a random vector y\mathbf{y} uniformly distributed on the surface of a unit hypersphere Sd(1)S_d(1):

  1. Generate xi∼N(0,1)x_i \sim \mathcal{N}(0, 1) for i=1…di=1 \dots d.

  2. Normalize: y=x∣∣x∣∣\mathbf{y} = \frac{\mathbf{x}}{||\mathbf{x}||}.

This works because the multivariate Gaussian is spherically symmetric.

<Figure size 600x600 with 1 Axes>

The joint probability density of the independent Gaussian components is spherically symmetric:

f(x)=∏i=1d12πe−xi2/2=1(2π)d/2e−12∑xi2=1(2π)d/2e−∣∣x∣∣22f(x) = \prod_{i=1}^d \frac{1}{\sqrt{2\pi}} e^{-x_i^2/2} = \frac{1}{(2\pi)^{d/2}} e^{-\frac{1}{2}\sum x_i^2} = \frac{1}{(2\pi)^{d/2}} e^{-\frac{||x||^2}{2}}

Since the density depends only on the length ∣∣x∣∣||x|| and not the direction, the direction vectors are uniformly distributed.

Conclusion: The density function f(x)f(\mathbf{x}) depends only on the length (magnitude) of the vector ∣∣x∣∣||\mathbf{x}||, and not on its coordinates (direction).

  • This property is called Spherical Symmetry or Isotropy.

  • It implies that the distribution is invariant under rotation. Therefore, all directions are equally probable, and the normalized vector y=x/∣∣x∣∣\mathbf{y} = \mathbf{x} / ||\mathbf{x}|| is uniformly distributed on the hypersphere.

Generating Points Inside the Ball

If we want points uniformly distributed inside the ball (not just on the surface), simply scaling by a uniform random number ρ∈[0,1]\rho \in [0,1] is incorrect because it bunches points near the center (volume is smaller there).

y=ρx∣∣x∣∣,0≤ρ≤1y=\rho\frac{x}{||x||}, \quad 0\le \rho \le 1
<Figure size 600x600 with 1 Axes>

Why is the naive approach incorrect?
If we simply sample the radius ρ\rho uniformly from [0,1][0,1], the generated points will cluster near the center.
In dd dimensions, the volume of a thin shell at radius rr grows proportionally to rd−1r^{d-1}.
This means there is far more volume near the surface (r≈1r \approx 1) than near the center (r≈0r \approx 0).
To achieve a truly uniform distribution inside the ball, the probability of a point lying within radius rr must be proportional to the volume enclosed by that radius.

For uniform volume density, the cumulative distribution function (CDF) must follow the volume growth rdr^d.
Thus, we require the random variable RR (the radius) to satisfy: P(R≤r)=rd.P(R \le r) = r^d. Using Inverse Transform Sampling with a∼U(0,1)a \sim U(0,1), we obtain: R=a1/d.R = a^{1/d}. A particular sample of RR will be denoted by ρ\rho.


1. Determining the Target CDF

Let RR denote the random variable representing the radius of a point.
The cumulative distribution function (CDF), F(r)F(r), gives the probability that a point lies within radius rr:

F(r)=P(R≤r).F(r) = P(R \le r).

For a uniform distribution inside the dd‑ball, this probability equals the ratio of the volume of the ball of radius rr to the total volume (radius 1):

F(r)=Vol(Sd(r))Vol(Sd(1))=KdrdKd⋅1d=rd.F(r) = \frac{\text{Vol}(S_d(r))}{\text{Vol}(S_d(1))} = \frac{K_d r^d}{K_d \cdot 1^d} = r^d.

So our target CDF is simply:

F(r)=rd.F(r) = r^d.

2. Inverse Transform Sampling

How do we generate random radii that follow F(r)=rdF(r) = r^d?
We use the Inverse Transform Sampling method:

  • If a∼U(0,1)a \sim \mathcal{U}(0,1) and FF is a continuous CDF, then X=F−1(a)X = F^{-1}(a) has distribution FF.

  • Intuitively: we draw a random probability aa from [0,1][0,1], and ask: “Which radius rr corresponds to this cumulative probability?”

  • Formally: If a∼U(0,1)a \sim U(0,1), then X=F−1(a)X = F^{-1}(a) has distribution FF:

P(X≤R)=P(F−1(a)≤R)=P(a≤F(R))=F(R).P(X \le R) = P(F^{-1}(a) \le R) = P(a \le F(R)) = F(R).

Therefore, if a∼U(0,1)a \sim \mathcal{U}(0,1), then:

R=F−1(a)=a1/d.R = F^{-1}(a) = a^{1/d}.

And when we actually generate a sample, we denote it by:

ρ=a1/d.\rho = a^{1/d}.

3. Example (for d=2d=2)

For a 2‑dimensional ball (a disk), we have:

ρ=a.\rho = \sqrt{a}.
a∼U(0,1)a \sim \mathcal{U}(0,1)ρ=a\rho = \sqrt{a}
0.000.000
0.100.316
0.250.500
0.500.707
0.750.866
1.001.000

This table shows how the transformation spreads points more evenly across the disk, avoiding clustering near the center.


4. Application to the Hypersphere

Applying this to our radius variable RR:

  1. Generate a uniform random number a∼U(0,1)a \sim \mathcal{U}(0,1).

  2. Compute the radius sample: ρ=a1/d\rho = a^{1/d}.

  3. Combine with a random direction to obtain a point inside the ball.


Algorithm for Uniform Points in a dd‑Ball

  1. Generate a random vector x∼N(0,Id)\mathbf{x} \sim \mathcal{N}(0, I_d).

  2. Normalize: y=x/∥x∥\mathbf{y} = \mathbf{x} / \|\mathbf{x}\| (this gives a random direction on the unit sphere).

  3. Generate a∼U(0,1)a \sim \mathcal{U}(0,1).

  4. Scale: z=(a1/d)y\mathbf{z} = (a^{1/d}) \mathbf{y} (this places the point uniformly inside the ball).

<Figure size 500x500 with 1 Axes>

Another counter-intuitive property is that “every direction is orthogonal to every other direction.” or random vectors in high dimensions are nearly orthogonal to each other.

Random Vectors

Consider the diagonal vector in a hypercube 1=(1,1,…,1)T\mathbf{1} = (1, 1, \dots, 1)^T. The angle θd\theta_d between this diagonal and any coordinate axis e1=(1,0,…,0)T\mathbf{e}_1 = (1, 0, \dots, 0)^T is:

cos⁡θd=e1T1∣∣e1∣∣⋅∣∣1∣∣=11⋅d=1d\cos \theta_d = \frac{\mathbf{e}_1^T \mathbf{1}}{||\mathbf{e}_1|| \cdot ||\mathbf{1}||} = \frac{1}{1 \cdot \sqrt{d}} = \frac{1}{\sqrt{d}}

As d→∞d \to \infty, cos⁡θd→0\cos \theta_d \to 0, which means θd→90∘\theta_d \to 90^\circ. The diagonal is effectively orthogonal to the axes!

Furthermore, random vectors in high dimensions are nearly orthogonal to each other.

Dot products of random pairs in 200-D:
Vector 0 . Vector 1 = -0.0345
Vector 0 . Vector 2 = 0.0655
Vector 0 . Vector 3 = 0.0054
Vector 1 . Vector 2 = -0.0890
Vector 1 . Vector 3 = -0.0445
Vector 2 . Vector 3 = 0.0598

Gaussian Distribution in High Dimensions

From Geometric Thin Shells to Statistical Thin Shells

In previous sections, we saw several geometric phenomena:

  • The Empty Center / Porcupine Effect in hypercubes

  • The Thin Shell inside hyperspheres

  • How uniform sampling becomes concentrated near the surface rather than the center

We also generated uniform points on and inside a hypersphere and observed that the volume grows outward, causing most points to stay away from the center.

Now we show that Gaussian data behave in exactly the same way — even though the Gaussian distribution is centered at the origin.


Why Gaussian Points Do Not Cluster Near the Mean (Unlike 1D)

Let x=(x1,…,xd)∼N(0,Id) x = (x_1,\dots,x_d) \sim \mathcal{N}(0, I_d) .

In one dimension, many sampled points lie “close to zero,” and the distance ∣x∣|x| is usually small. However, this intuition completely breaks down as soon as we move to dimension 2 or higher.

The key difference is geometry:

  • In 1D, “the center” is just a point, and the line has no notion of volume growth.

  • In higher dimensions, volume explodes with radius:

    • Area ∝r2\propto r^2

    • Volume ∝r3\propto r^3

    • In general: hypersphere volume ∝rd\propto r^{d}

Thus, although the Gaussian density is highest at the origin, the available volume near the origin is vanishingly small.

The center has the highest density but almost zero volume ⇒\Rightarrow almost no sampled points appear there.

This exactly mirrors the thin-shell phenomenon you observed for uniform sampling.


Distance of a Gaussian Vector from the Origin

A central identity explains the behavior:

∣x∣2=∑i=1dxi2∼χd2|x|^2 = \sum_{i=1}^d x_i^2 \sim \chi^2_d

Thus (See Chi-squared distribution):

E[∣x∣2]=d⇒E[∣x∣]≈d.\mathbb{E}[|x|^2] = d \qquad\Rightarrow\qquad \mathbb{E}[|x|] \approx \sqrt{d}.
  • In 1D: ∣x∣≈0.8|x| \approx 0.8 (close to the center)

  • In 2D: ∣x∣≈2≈1.41|x| \approx \sqrt{2} \approx 1.41

  • In 10D: ∣x∣≈10≈3.16|x| \approx \sqrt{10} \approx 3.16

  • In 200D: ∣x∣≈200≈14.1|x| \approx \sqrt{200} \approx 14.1

And importantly:

Increasing dimension pushes all Gaussian samples outward, not just a few outliers. Almost the entire distribution lies in a thin spherical shell around radius d\sqrt{d}.

This is the statistical analogue of the geometric thin-shell effect.


Numerical Simulation: Gaussian Thin Shell

<Figure size 1200x500 with 2 Axes>

These two plots illustrate the fundamental shift from “mass at center” (low dimension) to “mass in a thin shell” (high dimension).


The Gaussian Annulus Phenomenon

A formal version states:

With overwhelming probability, a Gaussian sample lies inside d±O(1) \sqrt{d} \pm O(1) — a thin annulus whose thickness does not grow with dd.

As dd increases:

  • Radius grows like d\sqrt{d}

  • Shell thickness remains constant

  • Relative shell thickness →\rightarrow 0

So the Gaussian distribution becomes extremely concentrated on a thin spherical layer.

This mirrors exactly what we saw earlier for:

  • Uniform points inside a hypersphere

  • Rejection sampling

  • Volume concentration

  • Empty Center effect

This is why Gaussian distributions are used so heavily in theory: they reflect the intrinsic geometry of high-dimensional space.


Connection to Previous Sections

Here is how the Gaussian phenomenon links back to the concepts earlier in the notebook:

Relation to “Empty Center / Porcupine Effect”

Volume around the center is negligible in high dimensions →\rightarrow Gaussian mass avoids the center, exactly like uniform points.


Relation to “Thin Shell Argument”

Uniform hypersphere volume concentrates at radius rr: Gaussian probability mass concentrates at radius d\sqrt{d}. The geometry is identical; only the radius scale differs.


Relation to “Generating Points Inside the Ball”

You observed that uniform points require special sampling (ρ=a1/d\rho = a^{1/d}) because naive sampling bunches points near the center.

Gaussian sampling naturally avoids the center due to the same volume effects.


Relation to “Random Vectors are Nearly Orthogonal”

Since nearly all Gaussian points lie at distance d\sqrt{d}, their normalized directions behave almost like points uniformly distributed on the sphere.

Thus Gaussian vectors are almost orthogonal — the basis for random projection and Johnson–Lindenstrauss.


Why This Matters (Preparing for JL)

Gaussian thin-shell concentration ensures:

  • Pairwise distances are stable

  • Dot products are small

  • Random projections preserve geometry

These facts are exactly what the Johnson–Lindenstrauss Lemma formalizes.

This section therefore serves as the bridge from geometric properties of high-dimensional space to the theoretical foundation of dimensionality reduction.

Summary

  • High-dimensional space is empty in the center.

  • Volume is in the corners or a thin shell at the surface.

  • Neighbors are far away (breaking local methods like k-NN).

  • Random vectors are orthogonal.

References

  1. Zaki, M. J., & Meira Jr, W. (2014). Data Mining and Machine Learning: Fundamental Concepts and Algorithms. Cambridge University Press. (Chapter 6).

  2. Blum, A., Hopcroft, J., & Kannan, R. (2020). Foundations of Data Science. Cambridge University Press.

  3. Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning.