## Motivation:

To develop algorithms for problems in machine learning or statistical physics, it is useful to develop an understanding of high-dimensional Euclidean spaces. One interesting property is that almost all high-dimensional random vectors are orthogonal with respect to the cosine distance.

I shall start with a simple uniformly distributed random variable that gives insight into more complex cases.

## An illustrative problem:

We note that for any $X,Y \sim \mathcal{U}(\{-1,1\})^{2n}$:

$$\lVert X \rVert = \sqrt{2n}$$

$$X \cdot Y = \sum_{i=1}^{2n} x_i \cdot y_i$$

where $\forall i, x_i \cdot y_i$ equals $-1$ or $+1$ with equal probability.

As a result, if we define the cosine distance:

$$\text{COS}(X,Y) = \frac{X \cdot Y}{\lVert X \rVert \lVert Y \rVert}$$

we find that this expression simplifies to:

$$S_n = \frac{\sum_{i=1}^{2n} x_i \cdot y_i}{2n} \approx \mathbb{E}[X \cdot Y] = 0$$

and by applying the Central Limit Theorem to $S_n$ we find that:

$$\forall \epsilon > 0, \lim_{n \to \infty} P(|S_n - \mathbb{E}[X \cdot Y]| > \epsilon) = \lim_{n \to \infty} P(|S_n| > \epsilon) = 0$$

## The case of isotropic Gaussian vectors:

For the case of $X,Y \sim \mathcal{N}(0, \sigma^2)^{n}$ we may proceed in a similar manner. It’s particularly useful to start by analysing the denominator of the cosine formula:

$$\lVert X \rVert^2 = \sum_{x_i > 0} x_i^2 + \sum_{x_i < 0} x_i^2 \approx Cn$$

where the constant $C$ is given by:

$$C = \int_{0}^\infty x^2 \cdot \frac{f(x)}{P(x \geq 0)} dx = \int_{0}^\infty 2 x^2 \frac{1}{\sqrt{2 \pi \sigma^2}} e^{-\frac{x^2}{2 \sigma^2}} dx$$

As a result, if we compute the cosine distance of $X$ and $Y$ independently sampled from $\mathcal{N}(0, \sigma^2)^{n}$ we find that:

$$\text{COS}(X,Y) = \frac{X \cdot Y}{\lVert X \rVert \lVert Y \rVert} \approx \frac{X \cdot Y}{\lVert X \rVert^2} \approx \frac{S_n}{C}$$

where $S_n$ is given by:

$$S_n = \frac{\sum_{i=1}^{n} x_i \cdot y_i}{n} \approx \mathbb{E}[X \cdot Y]$$

and since $\mathbb{E}[X \cdot Y] = 0$ by the Central Limit Theorem we have:

$$\forall \epsilon > 0, \lim_{n \to \infty} P(|S_n| > \epsilon) = 0$$