TL;DR
The curse of dimensionality is the set of problems that appear when data has many features, or when a space has many dimensions. Covering the space with samples at a fixed spacing needs a number of points that grows exponentially with the dimension. Distances between random points also become nearly equal, and most of a ball's volume moves to its thin outer shell. It matters because many learning methods rely on nearby points being similar, and that assumption weakens quickly as the dimension rises.
Builds on: Euclidean Distance, Uniform Distribution, Surface Area and Volume · Leads to: approximate nearest-neighbour search
Where it's used
Nearest-neighbour classification. A simple classifier labels a new point with the label of the closest training point. It works well with a few features. With hundreds of features, the closest and the farthest training points can be almost equally far away, so the nearest label carries little information unless the data has hidden structure.
Feature-rich models in biology and finance. A gene-expression study may measure 20,000 genes on 100 patients. A portfolio model may use hundreds of market signals on a few years of daily data. In both, the number of features far exceeds what the sample can fill, so any method that uses distances or local averages needs care.
Image and text embeddings. An image may be represented as a vector of a few thousand numbers, and a sentence as a few hundred. The raw space is huge, but real images and sentences lie near a much smaller set, which is why methods still work. The curse is the reason the structure matters.
Random search and optimisation. Sampling candidate settings uniformly in a high-dimensional box is inefficient, because almost every sample lands near the boundary of the box or the rim of a ball. The next section shows why.
How it works
Trace one simple question: how many points do you need so that every point in a unit cube has a sample within 0.1 of it along each axis? Use a regular grid, with 10 points on each axis, so spacing is 0.1.
- One dimension. On a line segment of length 1, 10 evenly spaced points are spaced 0.1 apart. Check: the largest gap from any point in the segment to its nearest sample is 0.05, which is within 0.1.
- Two dimensions. To keep the same spacing in both directions, use 10 points on the horizontal axis and 10 on the vertical. That is 10 times 10, or 100 points. Check: the count multiplied, not added, when the dimension went up.
- Three dimensions. Add a third axis with 10 points, and the total is 10 times 10 times 10, or 1,000. Check: each new axis multiplies the count by 10.
- Ten dimensions. The total is 10 to the power of 10, which is ten billion. Check: a data set of ten billion points is not something a typical experiment can collect.
- Distances in high dimension. Now draw two points uniformly at random in the cube. Their squared distance is the sum of one squared difference per axis. Each difference is random, so the sum is close to its average. Check: the average grows with the number of axes, but the spread grows more slowly, so the relative spread (the spread divided by the average) shrinks.
- Read the consequence. When the relative spread is small, almost every pair of points looks equally far apart, so "nearest" stops meaning much. The plot below shows the relative spread falling as the dimension grows.
- spread / mean of squared distance
The math
Let and be independent points drawn uniformly from the cube . Write and for their th coordinates. The squared distance is
Steps 1 to 4 in symbols
A grid with points on each axis has points in total. With , the count is . This is the exponential growth in step 4: the number of points to keep spacing fixed grows as the power of a constant. The exponential in is the whole problem in one line.
Step 5 in symbols
For one coordinate, let . Its density is the triangle on the interval from minus 1 to 1, from the uniform density of each coordinate. Two moments are needed:
Since the coordinates are independent, the mean of the squared distance is the sum of the means:
The variance of is , and the variances of independent coordinates add, so
The relative spread falls like one over the square root of . This is the curve in the plot.
Beyond the walkthrough: volume near the surface
Inside a ball of radius 1, the ball of radius has volume fraction of the whole, because volume scales with the power of the radius. So the fraction of volume within of the surface is
For a fixed , this approaches 1 as grows. Most of a high-dimensional ball is in its shell.
Worked examples
Cover the unit cube with a grid that has 2 points on each axis, so spacing is 0.5.
- In one dimension: 2 points.
- In two dimensions: 2 times 2, which is 4 points.
- In three dimensions: 2 times 2 times 2, which is 8 points.
- Interpret: each axis doubles the count. In ten dimensions the same grid would need 2 to the power 10, which is 1,024 points, and the spacing has not changed at all.
Take two random points in the unit square, so d = 2.
- The mean squared distance is d over 6, which is 2 over 6, or 0.333.
- The variance of the squared distance is 7d over 180, which is 14 over 180, about 0.0778.
- The standard deviation is the square root, about 0.279.
- The relative spread is 0.279 divided by 0.333, about 0.84.
- Interpret: the squared distance ranges widely around its average, so pairs differ a lot in how far apart they are.
A search samples points uniformly inside a ball of radius 1 in 100 dimensions, looking for a point near the centre.
- Take a shell of thickness 0.05 at the surface. The ball of radius 0.95 has volume fraction of the whole, because volume scales with the power of the radius. Compute .
- So the fraction of the ball within 0.05 of its surface is .
- Interpret: 99.4 percent of the samples land in a thin shell near the boundary. A search that looks for points near the centre finds almost none of them, and its samples are wasted on the rim.
Try it: in a ball of dimension 50, what fraction of volume lies within 0.1 of the surface? Answer: the fraction inside radius 0.9 is 0.9 to the power 50, about 0.0052, so the fraction within 0.1 of the surface is about 0.995, or 99.5 percent.
Common mistakes and tradeoffs
It is tempting to think more features always give a better model. In fact each feature that carries no information adds variation to every distance, so the signal can be drowned out. Feature selection, regularisation, or a model that ignores irrelevant directions often beats adding everything.
It is tempting to think the problem is only the number of points. In fact the density of points is what matters, and density falls off exponentially with dimension. A million points in 3 dimensions form a dense cloud, while a million points in 100 dimensions are sparse in the relevant sense, because the space they fill grows so much faster than the count.
It is tempting to think that equal distances mean every point is the same. In fact the relative spread shrinks, but the absolute differences can still carry information. Real data also seldom fills the cube uniformly. Images and text lie near much lower-dimensional sets, so their intrinsic dimension (the number of directions the data really varies along) is far below the raw count, and distance methods still work on them.
The curse matters most for methods that rely on local neighbourhoods, such as nearest-neighbour classification and kernel density estimates (estimates of a density built from local averages), and for uniform sampling in high dimension. It matters less for methods that impose structure, such as linear models with few parameters, or convolutional networks that share weights across positions.
Alternatives include dimensionality reduction, which projects data onto a smaller set of directions, feature selection, and models with strong built-in assumptions. Each trades some information for a sample size you can actually collect.
History
The name comes from Richard Bellman, who used it in 1961 in his book on adaptive control processes. He was describing how the number of grid points needed for optimisation grows exponentially with the number of variables, which makes exhaustive search impractical.
Statisticians and computer scientists later studied how distances behave in high dimension. In 1999 Beyer and colleagues showed that under common conditions the nearest and the farthest neighbours of a query point become almost equally far apart as the dimension grows, which undermines nearest-neighbour search on purely random data. That result is the distance-concentration effect in this lesson.
The problem gained weight in machine learning as feature sets grew in the 1990s and 2000s, and as deep learning later showed that learned representations can live in a small effective dimension even when the raw input is large. This is why the curse is a reason to design representations, not only to collect more data.
Recap
- Covering a space at fixed spacing needs a number of points that grows exponentially with the dimension.
- Squared distances between random points have a mean that grows with the dimension, but a relative spread that shrinks like one over the square root of the dimension.
- Most of the volume of a high-dimensional ball lies in its outer shell.
- Distance-based and uniform-sampling methods suffer most, and structure or low intrinsic dimension is the usual remedy.
Read next: approximate nearest-neighbour search, where the distance effect shows up directly in practice.
Check yourself
QuestionHow many points does a grid with 4 points per axis need in 3 dimensions, and how many in 5 dimensions?Show answer
In 3 dimensions the count is 4 times 4 times 4, which is 64. In 5 dimensions it is 4 to the power 5, which is 1,024. Each added axis multiplies the count by 4, so the total grows exponentially.
QuestionFor two random points in the cube with d = 3, what is the mean squared distance?Show answer
Each coordinate contributes an expected squared difference of 1 over 6, and the three coordinates are independent, so the mean is 3 times 1 over 6, which is one half. That is far below 3, the largest possible squared distance (between opposite corners), because most random pairs are not at opposite corners.
QuestionWhy does the relative spread of the squared distance shrink as the dimension grows, even though the spread itself grows?Show answer
The mean grows linearly with d, and the standard deviation grows like the square root of d, because variances of independent coordinates add. The ratio of the square root of d to d is one over the square root of d, so it shrinks. Distances become more alike in relative terms even as they become larger in absolute terms.
QuestionA search samples uniformly in a ball of dimension 30, and it accepts only points within 0.2 of the centre. Roughly what fraction of samples is accepted, and why is this a problem?Show answer
The accepted fraction is the volume of a radius 0.2 ball divided by the unit ball, which is 0.2 to the power 30, a number so small that essentially no samples are accepted. The problem is that uniform sampling wastes almost all of its effort on the shell, so a search must use structure or a different proposal distribution to be practical.
QuestionGive one reason a nearest-neighbour classifier can still work well on 1,000-dimensional image vectors, even though the curse applies to uniform data.Show answer
Real images do not fill the space uniformly. They lie near a much lower-dimensional set, so their intrinsic dimension is small, and the nearest neighbours in that set are still meaningfully closer than the others. The curse is strongest for data spread evenly through the cube, which real data rarely is.