The Bounded Difference Method

Combining Azuma's inequality with the construction of Doob martingales, we have the powerful Bounded Difference Method for concentration of measures.

For arbitrary random variables

Given a sequence of random variables ${\displaystyle X_{1},\ldots ,X_{n}}$ and a function ${\displaystyle f}$. The Doob sequence constructs a martingale from them. Combining this construction with Azuma's inequality, we can get a very powerful theorem called "the method of averaged bounded differences" which bounds the concentration for arbitrary function on arbitrary random variables (not necessarily a martingale).

 Theorem (Method of averaged bounded differences) Let ${\displaystyle {\boldsymbol {X}}=(X_{1},\ldots ,X_{n})}$ be arbitrary random variables and let ${\displaystyle f}$ be a function of ${\displaystyle X_{0},X_{1},\ldots ,X_{n}}$ satisfying that, for all ${\displaystyle 1\leq i\leq n}$, ${\displaystyle |\mathbf {E} [f({\boldsymbol {X}})\mid X_{1},\ldots ,X_{i}]-\mathbf {E} [f({\boldsymbol {X}})\mid X_{1},\ldots ,X_{i-1}]|\leq c_{i},}$ Then {\displaystyle {\begin{aligned}\Pr \left[|f({\boldsymbol {X}})-\mathbf {E} [f({\boldsymbol {X}})]|\geq t\right]\leq 2\exp \left(-{\frac {t^{2}}{2\sum _{i=1}^{n}c_{i}^{2}}}\right).\end{aligned}}}
Proof.
 Define the Doob Martingale sequence ${\displaystyle Y_{0},Y_{1},\ldots ,Y_{n}}$ by setting ${\displaystyle Y_{0}=\mathbf {E} [f(X_{1},\ldots ,X_{n})]}$ and, for ${\displaystyle 1\leq i\leq n}$, ${\displaystyle Y_{i}=\mathbf {E} [f(X_{1},\ldots ,X_{n})\mid X_{1},\ldots ,X_{i}]}$. Then the above theorem is a restatement of the Azuma's inequality holding for ${\displaystyle Y_{0},Y_{1},\ldots ,Y_{n}}$.
${\displaystyle \square }$

For independent random variables

The condition of bounded averaged differences is usually hard to check. This severely limits the usefulness of the method. To overcome this, we introduce a property which is much easier to check, called the Lipschitz condition.

 Definition (Lipschitz condition) A function ${\displaystyle f(x_{1},\ldots ,x_{n})}$ satisfies the Lipschitz condition, if for any ${\displaystyle x_{1},\ldots ,x_{n}}$ and any ${\displaystyle y_{i}}$, {\displaystyle {\begin{aligned}|f(x_{1},\ldots ,x_{i-1},x_{i},x_{i+1},\ldots ,x_{n})-f(x_{1},\ldots ,x_{i-1},y_{i},x_{i+1},\ldots ,x_{n})|\leq 1.\end{aligned}}}

In other words, the function satisfies the Lipschitz condition if an arbitrary change in the value of any one argument does not change the value of the function by more than 1.

The diference of 1 can be replaced by arbitrary constants, which gives a generalized version of Lipschitz condition.

 Definition (Lipschitz condition, general version) A function ${\displaystyle f(x_{1},\ldots ,x_{n})}$ satisfies the Lipschitz condition with constants ${\displaystyle c_{i}}$, ${\displaystyle 1\leq i\leq n}$, if for any ${\displaystyle x_{1},\ldots ,x_{n}}$ and any ${\displaystyle y_{i}}$, {\displaystyle {\begin{aligned}|f(x_{1},\ldots ,x_{i-1},x_{i},x_{i+1},\ldots ,x_{n})-f(x_{1},\ldots ,x_{i-1},y_{i},x_{i+1},\ldots ,x_{n})|\leq c_{i}.\end{aligned}}}

The following "method of bounded differences" can be developed for functions satisfying the Lipschitz condition. Unfortunately, in order to imply the condition of averaged bounded differences from the Lipschitz condition, we have to restrict the method to independent random variables.

 Corollary (Method of bounded differences) Let ${\displaystyle {\boldsymbol {X}}=(X_{1},\ldots ,X_{n})}$ be ${\displaystyle n}$ independent random variables and let ${\displaystyle f}$ be a function satisfying the Lipschitz condition with constants ${\displaystyle c_{i}}$, ${\displaystyle 1\leq i\leq n}$. Then {\displaystyle {\begin{aligned}\Pr \left[|f({\boldsymbol {X}})-\mathbf {E} [f({\boldsymbol {X}})]|\geq t\right]\leq 2\exp \left(-{\frac {t^{2}}{2\sum _{i=1}^{n}c_{i}^{2}}}\right).\end{aligned}}}
Proof.
 For convenience, we denote that ${\displaystyle {\boldsymbol {X}}_{[i,j]}=(X_{i},X_{i+1},\ldots ,X_{j})}$ for any ${\displaystyle 1\leq i\leq j\leq n}$. We first show that the Lipschitz condition with constants ${\displaystyle c_{i}}$, ${\displaystyle 1\leq i\leq n}$, implies another condition called the averaged Lipschitz condition (ALC): for any ${\displaystyle a_{i},b_{i}}$, ${\displaystyle 1\leq i\leq n}$, ${\displaystyle \left|\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a_{i}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=b_{i}\right]\right|\leq c_{i}.}$ And this condition implies the averaged bounded difference condition: for all ${\displaystyle 1\leq i\leq n}$, ${\displaystyle \left|\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]}\right]\right|\leq c_{i}.}$ Then by applying the method of averaged bounded differences, the corollary can be proved. For any ${\displaystyle a}$, by the law of total expectation, {\displaystyle {\begin{aligned}&\quad \,\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a\right]\\&=\sum _{a_{i+1},\ldots ,a_{n}}\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a,{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\cdot \Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a\right]\\&=\sum _{a_{i+1},\ldots ,a_{n}}\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a,{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\cdot \Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\qquad ({\mbox{independence}})\\&=\sum _{a_{i+1},\ldots ,a_{n}}f({\boldsymbol {X}}_{[1,i-1]},a,{\boldsymbol {a}}_{[i+1,n]})\cdot \Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right].\end{aligned}}} Let ${\displaystyle a=a_{i}}$ and ${\displaystyle b_{i}}$, and take the diference. Then {\displaystyle {\begin{aligned}&\quad \,\left|\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a_{i}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=b_{i}\right]\right|\\&=\left|\sum _{a_{i+1},\ldots ,a_{n}}\left(f({\boldsymbol {X}}_{[1,i-1]},a_{i},{\boldsymbol {a}}_{[i+1,n]})-f({\boldsymbol {X}}_{[1,i-1]},b_{i},{\boldsymbol {a}}_{[i+1,n]})\right)\Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\right|\\&\leq \sum _{a_{i+1},\ldots ,a_{n}}\left|f({\boldsymbol {X}}_{[1,i-1]},a_{i},{\boldsymbol {a}}_{[i+1,n]})-f({\boldsymbol {X}}_{[1,i-1]},b_{i},{\boldsymbol {a}}_{[i+1,n]})\right|\Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\\&\leq \sum _{a_{i+1},\ldots ,a_{n}}c_{i}\Pr \left[{\boldsymbol {X}}_{[i+1,n]}={\boldsymbol {a}}_{[i+1,n]}\right]\qquad ({\mbox{Lipschitz condition}})\\&=c_{i}.\end{aligned}}} Thus, the Lipschitz condition is transformed to the ALC. We then deduce the averaged bounded difference condition from ALC. By the law of total expectation, ${\displaystyle \mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]}\right]=\sum _{a}\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a\right]\cdot \Pr[X_{i}=a\mid {\boldsymbol {X}}_{[1,i-1]}].}$ We can trivially write ${\displaystyle \mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]}$ as ${\displaystyle \mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]=\sum _{a}\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]\cdot \Pr \left[X_{i}=a\mid {\boldsymbol {X}}_{[1,i-1]}\right].}$ Hence, the difference is {\displaystyle {\begin{aligned}&\quad \left|\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]}\right]\right|\\&=\left|\sum _{a}\left(\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a\right]\right)\cdot \Pr \left[X_{i}=a\mid {\boldsymbol {X}}_{[1,i-1]}\right]\right|\\&\leq \sum _{a}\left|\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i]}\right]-\mathbf {E} \left[f({\boldsymbol {X}})\mid {\boldsymbol {X}}_{[1,i-1]},X_{i}=a\right]\right|\cdot \Pr \left[X_{i}=a\mid {\boldsymbol {X}}_{[1,i-1]}\right]\\&\leq \sum _{a}c_{i}\Pr \left[X_{i}=a\mid {\boldsymbol {X}}_{[1,i-1]}\right]\qquad ({\mbox{due to ALC}})\\&=c_{i}.\end{aligned}}} The averaged bounded diference condition is implied. Applying the method of averaged bounded diferences, the corollary follows.
${\displaystyle \square }$

Applications

Occupancy problem

Throwing ${\displaystyle m}$ balls uniformly and independently at random to ${\displaystyle n}$ bins, we ask for the occupancies of bins by the balls. In particular, we are interested in the number of empty bins.

This problem can be described equivalently as follows. Let ${\displaystyle f:[m]\rightarrow [n]}$ be a uniform random function from ${\displaystyle [m]\rightarrow [n]}$. We ask for the number of ${\displaystyle i\in [n]}$ that ${\displaystyle f^{-1}(i)}$ is empty.

For any ${\displaystyle i\in [n]}$, let ${\displaystyle X_{i}}$ indicate the emptiness of bin ${\displaystyle i}$. Let ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$ be the number of empty bins.

${\displaystyle \mathbf {E} [X_{i}]=\Pr[{\mbox{bin }}i{\mbox{ is empty}}]=\left(1-{\frac {1}{n}}\right)^{m}.}$

By the linearity of expectation,

${\displaystyle \mathbf {E} [X]=\sum _{i=1}^{n}\mathbf {E} [X_{i}]=n\left(1-{\frac {1}{n}}\right)^{m}.}$

We want to know how ${\displaystyle X}$ deviates from this expectation. The complication here is that ${\displaystyle X_{i}}$ are not independent. So we alternatively look at a sequence of independent random variables ${\displaystyle Y_{1},\ldots ,Y_{m}}$, where ${\displaystyle Y_{j}\in [n]}$ represents the bin into which the ${\displaystyle j}$th ball falls. Clearly ${\displaystyle X}$ is function of ${\displaystyle Y_{1},\ldots ,Y_{m}}$.

We than observe that changing the value of any ${\displaystyle Y_{i}}$ can change the value of ${\displaystyle X}$ by at most 1, because one ball can affect the emptiness of at most one bin. Thus as a function of independent random variables ${\displaystyle Y_{1},\ldots ,Y_{m}}$, ${\displaystyle X}$ satisfies the Lipschitz condition. Apply the method of bounded differences, it holds that

${\displaystyle \Pr \left[\left|X-n\left(1-{\frac {1}{n}}\right)^{m}\right|\geq t{\sqrt {m}}\right]=\Pr[|X-\mathbf {E} [X]|\geq t{\sqrt {m}}]\leq 2e^{-t^{2}/2}}$

Thus, for sufficiently large ${\displaystyle n}$ and ${\displaystyle m}$, the number of empty bins is tightly concentrated around ${\displaystyle n\left(1-{\frac {1}{n}}\right)^{m}\approx {\frac {n}{e^{m/n}}}}$

Pattern Matching

Let ${\displaystyle {\boldsymbol {X}}=(X_{1},\ldots ,X_{n})}$ be a sequence of characters chosen independently and uniformly at random from an alphabet ${\displaystyle \Sigma }$, where ${\displaystyle m=|\Sigma |}$. Let ${\displaystyle \pi \in \Sigma ^{k}}$ be an arbitrarily fixed string of ${\displaystyle k}$ characters from ${\displaystyle \Sigma }$, called a pattern. Let ${\displaystyle Y}$ be the number of occurrences of the pattern ${\displaystyle \pi }$ as a substring of the random string ${\displaystyle X}$.

By the linearity of expectation, it is obvious that

${\displaystyle \mathbf {E} [Y]=(n-k+1)\left({\frac {1}{m}}\right)^{k}.}$

We now look at the concentration of ${\displaystyle Y}$. The complication again lies in the dependencies between the matches. Yet we will see that ${\displaystyle Y}$ is well tightly concentrated around its expectation if ${\displaystyle k}$ is relatively small compared to ${\displaystyle n}$.

For a fixed pattern ${\displaystyle \pi }$, the random variable ${\displaystyle Y}$ is a function of the independent random variables ${\displaystyle (X_{1},\ldots ,X_{n})}$. Any character ${\displaystyle X_{i}}$ participates in no more than ${\displaystyle k}$ matches, thus changing the value of any ${\displaystyle X_{i}}$ can affect the value of ${\displaystyle Y}$ by at most ${\displaystyle k}$. ${\displaystyle Y}$ satisfies the Lipschitz condition with constant ${\displaystyle k}$. Apply the method of bounded differences,

${\displaystyle \Pr \left[\left|Y-{\frac {n-k+1}{m^{k}}}\right|\geq tk{\sqrt {n}}\right]=\Pr \left[\left|Y-\mathbf {E} [Y]\right|\geq tk{\sqrt {n}}\right]\leq 2e^{-t^{2}/2}}$

Combining unit vectors

Let ${\displaystyle u_{1},\ldots ,u_{n}}$ be ${\displaystyle n}$ unit vectors from some normed space. That is, ${\displaystyle \|u_{i}\|=1}$ for any ${\displaystyle 1\leq i\leq n}$, where ${\displaystyle \|\cdot \|}$ denote the vector norm (e.g. ${\displaystyle \ell _{1},\ell _{2},\ell _{\infty }}$) of the space.

Let ${\displaystyle \epsilon _{1},\ldots ,\epsilon _{n}\in \{-1,+1\}}$ be independently chosen and ${\displaystyle \Pr[\epsilon _{i}=-1]=\Pr[\epsilon _{i}=1]=1/2}$.

Let

${\displaystyle v=\epsilon _{1}u_{1}+\cdots +\epsilon _{n}u_{n},}$

and

${\displaystyle X=\|v\|.}$

This kind of construction is very useful in combinatorial proofs of metric problems. We will show that by this construction, the random variable ${\displaystyle X}$ is well concentrated around its mean.

${\displaystyle X}$ is a function of independent random variables ${\displaystyle \epsilon _{1},\ldots ,\epsilon _{n}}$. By the triangle inequality for norms, it is easy to verify that changing the sign of a unit vector ${\displaystyle u_{i}}$ can only change the value of ${\displaystyle X}$ for at most 2, thus ${\displaystyle X}$ satisfies the Lipschitz condition with constant 2. The concentration result follows by applying the method of bounded differences:

${\displaystyle \Pr[|X-\mathbf {E} [X]|\geq 2t{\sqrt {n}}]\leq 2e^{-t^{2}/2}.}$

Dimension Reduction

Consider a problem as follows: We have a set of ${\displaystyle n}$ points in a high-dimensional Euclidean space ${\displaystyle \mathbf {R} ^{d}}$. We want to project the points onto a space of low dimension ${\displaystyle \mathbf {R} ^{k}}$ in such a way that pairwise distances of the points are approximately the same as before.

Formally, we are looking for a map ${\displaystyle f:\mathbf {R} ^{d}\rightarrow \mathbf {R} ^{k}}$ such that for any pair of original points ${\displaystyle u,v}$, ${\displaystyle \|f(u)-f(v)\|}$ distorts little from ${\displaystyle \|u-v\|}$, where ${\displaystyle \|\cdot \|}$ is the Euclidean norm, i.e. ${\displaystyle \|u-v\|={\sqrt {(u_{1}-v_{1})^{2}+(u_{2}-v_{2})^{2}+\ldots +(u_{d}-v_{d})^{2}}}}$ is the distance between ${\displaystyle u}$ and ${\displaystyle v}$ in Euclidean space.

This problem has various important applications in both theory and practice. In many tasks, the data points are drawn from a high dimensional space, however, computations on high-dimensional data are usually hard due to the infamous "curse of dimensionality". The computational tasks can be greatly eased if we can project the data points onto a space of low dimension while the pairwise relations between the points are approximately preserved.

Johnson-Lindenstrauss Theorem

The Johnson-Lindenstrauss Theorem states that it is possible to project ${\displaystyle n}$ points in a space of arbitrarily high dimension onto an ${\displaystyle O(\log n)}$-dimensional space, such that the pairwise distances between the points are approximately preserved.

 Johnson-Lindenstrauss Theorem For any ${\displaystyle 0<\epsilon <1}$ and any positive integer ${\displaystyle n}$, let ${\displaystyle k}$ be a positive integer such that ${\displaystyle k\geq 4(\epsilon ^{2}/2-\epsilon ^{3}/3)^{-1}\ln n}$ Then for any set ${\displaystyle V}$ of ${\displaystyle n}$ points in ${\displaystyle \mathbf {R} ^{d}}$, there is a map ${\displaystyle f:\mathbf {R} ^{d}\rightarrow \mathbf {R} ^{k}}$ such that for all ${\displaystyle u,v\in V}$, ${\displaystyle (1-\epsilon )\|u-v\|^{2}\leq \|f(u)-f(v)\|^{2}\leq (1+\epsilon )\|u-v\|^{2}}$. Furthermore, this map can be found in expected polynomial time.

The random projections

The map ${\displaystyle f:\mathbf {R} ^{d}\rightarrow \mathbf {R} ^{k}}$ is done by random projection. There are several ways of applying the random projection. We adopt the one in the original Johnson-Lindenstrauss paper.

 The projection (due to Johnson-Lindenstrauss) Let ${\displaystyle A}$ be a random ${\displaystyle k\times d}$ matrix that projects ${\displaystyle \mathbf {R} ^{d}}$ onto a uniform random k-dimensional subspace. Multiply ${\displaystyle A}$ by a fixed scalar ${\displaystyle {\sqrt {\frac {d}{k}}}}$. For every ${\displaystyle v\in \mathbf {R} ^{d}}$, ${\displaystyle v}$ is mapped to ${\displaystyle {\sqrt {\frac {d}{k}}}Av}$.

The projected point ${\displaystyle {\sqrt {\frac {d}{k}}}Av}$ is a vector in ${\displaystyle \mathbf {R} ^{k}}$.

The purpose of multiplying the scalar ${\displaystyle {\sqrt {\frac {d}{k}}}}$ is to guarantee that ${\displaystyle \mathbf {E} \left[\left\|{\sqrt {\frac {d}{k}}}Av\right\|^{2}\right]=\|v\|^{2}}$.

Besides the uniform random subspace, there are other choices of random projections known to have good performances, including:

• A matrix whose entries follow i.i.d. normal distributions. (Due to Indyk-Motwani)
• A matrix whose entries are i.i.d. ${\displaystyle \pm 1}$. (Due to Achlioptas)

In both cases, the matrix is also multiplied by a fixed scalar for normalization.

A proof of the Theorem

We present a proof due to Dasgupta-Gupta, which is much simpler than the original proof of Johnson-Lindenstrauss. The proof is for the projection onto uniform random subspace. The idea of the proof is outlined as follows:

1. To bound the distortions to pairwise distances, it is sufficient to bound the distortions to the length of unit vectors.
2. A uniform random subspace of a fixed unit vector is identically distributed as a fixed subspace of a uniform random unit vector. We can fix the subspace as the first k coordinates of the vector, thus it is sufficient to bound the length (norm) of the first k coordinates of a uniform random unit vector.
3. Prove that for a uniform random unit vector, the length of its first k coordinates is concentrated to the expectation.

From pairwise distances to norms of unit vectors

Let ${\displaystyle w\in \mathbf {R} ^{d}}$ be a vector in the original space, the random ${\displaystyle k\times d}$ matrix ${\displaystyle A}$ projects ${\displaystyle w}$ onto a uniformly random k-dimensional subspace of ${\displaystyle \mathbf {R} ^{d}}$. We only need to show that

{\displaystyle {\begin{aligned}\Pr \left[\left\|{\sqrt {\frac {d}{k}}}Aw\right\|^{2}<(1-\epsilon )\|w\|^{2}\right]&\leq {\frac {1}{n^{2}}};\quad {\mbox{and}}\\\Pr \left[\left\|{\sqrt {\frac {d}{k}}}Aw\right\|^{2}>(1+\epsilon )\|w\|^{2}\right]&\leq {\frac {1}{n^{2}}}.\end{aligned}}}

Think of ${\displaystyle w}$ as a ${\displaystyle w=u-v}$ for some ${\displaystyle u,v\in V}$. Then by applying the union bound to all ${\displaystyle {n \choose 2}}$ pairs of the ${\displaystyle n}$ points in ${\displaystyle V}$, the random projection ${\displaystyle A}$ violates the distortion requirement with probability at most

${\displaystyle {n \choose 2}\cdot {\frac {2}{n^{2}}}=1-{\frac {1}{n}},}$

so ${\displaystyle A}$ has the desirable low-distortion with probability at least ${\displaystyle {\frac {1}{n}}}$. Thus, the low-distortion embedding can be found by trying for expected ${\displaystyle n}$ times (recalling the analysis fo geometric distribution).

We can further simplify the problem by normalizing the ${\displaystyle w}$. Note that for nonzero ${\displaystyle w}$'s, the statement that

${\displaystyle (1-\epsilon )\|w\|^{2}\leq \left\|{\sqrt {\frac {d}{k}}}Aw\right\|^{2}\leq (1+\epsilon )\|w\|^{2}}$

is equivalent to that

${\displaystyle (1-\epsilon ){\frac {k}{d}}\leq \left\|A\left({\frac {w}{\|w\|}}\right)\right\|^{2}\leq (1+\epsilon ){\frac {k}{d}}.}$

Thus, we only need to bound the distortions for the unit vectors, i.e. the vectors ${\displaystyle w\in \mathbf {R} ^{d}}$ that ${\displaystyle \|w\|=1}$. The rest of the proof is to prove the following lemma for the unit vector in ${\displaystyle \mathbf {R} ^{d}}$.

 Lemma 3.1 For any unit vector ${\displaystyle w\in \mathbf {R} ^{d}}$, it holds that ${\displaystyle \Pr \left[\|Aw\|^{2}<(1-\epsilon ){\frac {k}{d}}\right]\leq {\frac {1}{n^{2}}};}$ ${\displaystyle \Pr \left[\|Aw\|^{2}>(1+\epsilon ){\frac {k}{d}}\right]\leq {\frac {1}{n^{2}}}.}$

As we argued above, this lemma implies the Johnson-Lindenstrauss Theorem.

Random projection of fixed unit vector ${\displaystyle \equiv }$ fixed projection of random unit vector

Let ${\displaystyle w\in \mathbf {R} ^{d}}$ be a fixed unit vector in ${\displaystyle \mathbf {R} ^{d}}$. Let ${\displaystyle A}$ be a random matrix which projects the points in ${\displaystyle \mathbf {R} ^{d}}$ onto a uniformly random ${\displaystyle k}$-dimensional subspace of ${\displaystyle \mathbf {R} ^{d}}$.

Let ${\displaystyle Y\in \mathbf {R} ^{d}}$ be a uniformly random unit vector in ${\displaystyle \mathbf {R} ^{d}}$. Let ${\displaystyle B}$ be such a fixed matrix which extracts the first ${\displaystyle k}$ coordinates of the vectors in ${\displaystyle \mathbf {R} ^{d}}$, i.e. for any ${\displaystyle Y=(Y_{1},Y_{2},\ldots ,Y_{d})}$, ${\displaystyle BY=(Y_{1},Y_{2},\ldots ,Y_{k})}$.

In other words, ${\displaystyle Aw}$ is a random projection of a fixed unit vector; and ${\displaystyle BY}$ is a fixed projection of a uniformly random unit vector.

A key observation is that:

 Observation The distribution of ${\displaystyle \|Aw\|}$ is the same as the distribution of ${\displaystyle \|BY\|}$.

The proof of this observation is omitted here.

With this observation, it is sufficient to work on the subspace of the first ${\displaystyle k}$ coordinates of the uniformly random unit vector ${\displaystyle Y\in \mathbf {R} ^{d}}$. Our task is now reduced to the following lemma.

 Lemma 3.2 Let ${\displaystyle Y=(Y_{1},Y_{2},\ldots ,Y_{d})}$ be a uniformly random unit vector in ${\displaystyle \mathbf {R} ^{d}}$. Let ${\displaystyle Z=(Y_{1},Y_{2},\ldots ,Y_{k})}$ be the projection of ${\displaystyle Y}$ to the subspace of the first ${\displaystyle k}$-coordinates of ${\displaystyle \mathbf {R} ^{d}}$. Then ${\displaystyle \Pr \left[\|Z\|^{2}<(1-\epsilon ){\frac {k}{d}}\right]\leq {\frac {1}{n^{2}}};}$ ${\displaystyle \Pr \left[\|Z\|^{2}>(1+\epsilon ){\frac {k}{d}}\right]\leq {\frac {1}{n^{2}}}.}$

Due to the above observation, Lemma 3.2 implies Lemma 3.1 and thus proves the Johnson-Lindenstrauss theorem.

Note that ${\displaystyle \|Z\|^{2}=\sum _{i=1}^{k}Y_{i}^{2}}$. Due to the linearity of expectations,

${\displaystyle \mathbf {E} [\|Z\|^{2}]=\sum _{i=1}^{k}\mathbf {E} [Y_{i}^{2}]}$.

Since ${\displaystyle Y}$ is a uniform random unit vector, it holds that ${\displaystyle \sum _{i=1}^{d}Y_{i}^{2}=\|Y\|^{2}=1}$. And due to the symmetry, all ${\displaystyle \mathbf {E} [Y_{i}^{2}]}$'s are equal. Thus, ${\displaystyle \mathbf {E} [Y_{i}^{2}]={\frac {1}{d}}}$ for all ${\displaystyle i}$. Therefore,

${\displaystyle \mathbf {E} [\|Z\|^{2}]=\sum _{i=1}^{k}\mathbf {E} [Y_{i}^{2}]={\frac {k}{d}}}$.

Lemma 3.2 actually states that ${\displaystyle \|Z\|^{2}}$ is well-concentrated to its expectation.

Concentration of the norm of the first ${\displaystyle k}$ entries of uniform random unit vector

We now prove Lemma 3.2. Specifically, we will prove the ${\displaystyle (1-\epsilon )}$ direction:

${\displaystyle \Pr[\|Z\|^{2}<(1-\epsilon ){\frac {k}{d}}]\leq {\frac {1}{n^{2}}}}$.

The ${\displaystyle (1+\epsilon )}$ direction is proved with the same argument.

Due to the discussion in the last section, this can be interpreted as a concentration bound for ${\displaystyle \|Z\|^{2}}$, which is a sum of ${\displaystyle Y_{1}^{2},Y_{2}^{2},\ldots ,Y_{k}^{2}}$. This hints us to use Chernoff-like bounds. However, for uniformly random unit vector ${\displaystyle Y}$, ${\displaystyle Y_{i}}$'s are not independent (because of the constraint that ${\displaystyle \|Y\|=1}$). We overcome this by generating uniform unit vectors from independent normal distributions.

The following is a very useful fact regarding the generation of uniform unit vectors.

 Generating uniform unit vector Let ${\displaystyle X_{1},X_{2},\ldots ,X_{d}}$ be i.i.d. random variables, each drawn from the normal distribution ${\displaystyle N(0,1)}$. Let ${\displaystyle X=(X_{1},X_{2},\ldots ,X_{d})}$. Then ${\displaystyle Y={\frac {1}{\|X\|}}X}$ is a uniformly random unit vector.

Then for ${\displaystyle Z=(Y_{1},Y_{2},\ldots ,Z_{k})}$,

${\displaystyle \|Z\|^{2}=Y_{1}^{2}+Y_{2}^{2}+\cdots +Y_{k}^{2}={\frac {X_{1}^{2}}{\|X\|^{2}}}+{\frac {X_{2}^{2}}{\|X\|^{2}}}+\cdots +{\frac {X_{k}^{2}}{\|X\|^{2}}}={\frac {X_{1}^{2}+X_{2}^{2}+\cdots +X_{k}^{2}}{X_{1}^{2}+X_{2}^{2}+\cdots +X_{d}^{2}}}}$.

To avoid writing a lot of ${\displaystyle (1-\epsilon )}$'s. We write ${\displaystyle \beta =(1-\epsilon )}$. The first inequality (the lower tail) of Lemma 3.2 can be written as:

{\displaystyle {\begin{aligned}\Pr \left[\|Z\|^{2}<{\frac {\beta k}{d}}\right]&=\Pr \left[{\frac {X_{1}^{2}+X_{2}^{2}+\cdots +X_{k}^{2}}{X_{1}^{2}+X_{2}^{2}+\cdots +X_{d}^{2}}}<{\frac {\beta k}{d}}\right]\\&=\Pr \left[d(X_{1}^{2}+X_{2}^{2}+\cdots +X_{k}^{2})<\beta k(X_{1}^{2}+X_{2}^{2}+\cdots +X_{d}^{2})\right]\\&=\Pr \left[(\beta k-d)\sum _{i=1}^{k}X_{i}^{2}+\beta k\sum _{i=k+1}^{d}X_{i}^{2}>0\right].&\qquad (**)\end{aligned}}}

The probability is a tail probability of the sum of ${\displaystyle d}$ independent variables. The ${\displaystyle X_{i}^{2}}$'s are not 0-1 variables, thus we cannot directly apply the Chernoff bounds. However, the following two key ingredients of the Chernoff bounds are satisfiable for the above sum:

• The ${\displaystyle X_{i}^{2}}$'s are independent.
• Because ${\displaystyle X_{i}^{2}}$'s are normal, it is known that the moment generating functions for ${\displaystyle X_{i}^{2}}$'s can be computed as follows:
 Fact 3.3 If ${\displaystyle X}$ follows the normal distribution ${\displaystyle N(0,1)}$, then ${\displaystyle \mathbf {E} \left[e^{\lambda X^{2}}\right]=(1-2\lambda )^{-{\frac {1}{2}}}}$, for ${\displaystyle \lambda \in \left(-\infty ,1/2\right)}$

Therefore, we can re-apply the technique of the Chernoff bound (applying Markov's inequality to the moment generating function and optimizing the parameter ${\displaystyle \lambda }$) to bound the probability ${\displaystyle (**)}$:

{\displaystyle {\begin{aligned}&\quad \,\Pr \left[(\beta k-d)\sum _{i=1}^{k}X_{i}^{2}+\beta k\sum _{i=k+1}^{d}X_{i}^{2}>0\right]\\&=\Pr \left[\exp \left\{(\beta k-d)\sum _{i=1}^{k}X_{i}^{2}+\beta k\sum _{i=k+1}^{d}X_{i}^{2}\right\}>1\right]\\&=\Pr \left[\exp \left\{\lambda \left((\beta k-d)\sum _{i=1}^{k}X_{i}^{2}+\beta k\sum _{i=k+1}^{d}X_{i}^{2}\right)\right\}>1\right]&\quad ({\text{for }}\lambda >0)\\&\leq \mathbf {E} \left[\exp \left\{\lambda \left((\beta k-d)\sum _{i=1}^{k}X_{i}^{2}+\beta k\sum _{i=k+1}^{d}X_{i}^{2}\right)\right\}\right]&\quad {\text{(by Markov inequality)}}\\&=\prod _{i=1}^{k}\mathbf {E} \left[e^{\lambda (\beta k-d)X_{i}^{2}}\right]\cdot \prod _{i=k+1}^{d}\mathbf {E} \left[e^{\lambda \beta kX_{i}^{2}}\right]&\quad ({\text{independence of }}X_{i})\\&=\mathbf {E} \left[e^{\lambda (\beta k-d)X_{1}^{2}}\right]^{k}\cdot \mathbf {E} \left[e^{\lambda \beta kX_{1}^{2}}\right]^{d-k}&\quad {\text{(symmetry)}}\\&=(1-2\lambda (\beta k-d))^{-{\frac {k}{2}}}(1-2\lambda \beta k)^{-{\frac {d-k}{2}}}&\quad {\text{(by Fact 3.3)}}\end{aligned}}}

The last term ${\displaystyle (1-2\lambda (\beta k-d))^{-{\frac {k}{2}}}(1-2\lambda \beta k)^{-{\frac {d-k}{2}}}}$ is minimized when

${\displaystyle \lambda ={\frac {1-\beta }{2\beta (d-k\beta )}},}$

so that

{\displaystyle {\begin{aligned}&\quad \,(1-2\lambda (\beta k-d))^{-{\frac {k}{2}}}(1-2\lambda \beta k)^{-{\frac {d-k}{2}}}\\&=\beta ^{\frac {k}{2}}\left(1+{\frac {(1-\beta )k}{(d-k)}}\right)^{\frac {d-k}{2}}\\&\leq \exp \left({\frac {k}{2}}(1-\beta +\ln \beta )\right)&\qquad ({\text{since }}\left(1+{\frac {(1-\beta )k}{(d-k)}}\right)^{\frac {d-k}{(1-\beta )k}}\leq e)\\&=\exp \left({\frac {k}{2}}(\epsilon +\ln(1-\epsilon ))\right)&\qquad (\beta =1-\epsilon )\\&\leq \exp \left(-{\frac {k\epsilon ^{2}}{4}}\right)&\qquad ({\text{by Taylor expansion }}\ln(1-\epsilon )\leq -\epsilon -{\frac {\epsilon ^{2}}{2}}),\end{aligned}}}

which is is ${\displaystyle \leq {\frac {1}{n^{2}}}}$ for the choice of k in the Johnson-Lindenstrauss theorem that

${\displaystyle k\geq 4(\epsilon ^{2}/2-\epsilon ^{3}/3)^{-1}\ln n}$.

So we have proved that

${\displaystyle \Pr[\|Z\|^{2}<(1-\epsilon ){\frac {k}{d}}]\leq {\frac {1}{n^{2}}}}$.

With the same argument, the other direction can be proved so that

${\displaystyle \Pr[\|Z\|^{2}>(1+\epsilon ){\frac {k}{d}}]\leq \exp \left({\frac {k}{2}}(-\epsilon +\ln(1+\epsilon ))\right)\leq \exp \left(-{\frac {k(\epsilon ^{2}/2-\epsilon ^{3}/3)}{2}}\right)}$,

which is also ${\displaystyle \leq {\frac {1}{n^{2}}}}$ for ${\displaystyle k\geq 4(\epsilon ^{2}/2-\epsilon ^{3}/3)^{-1}\ln n}$.

Lemma 3.2 is proved. As we discussed in the previous sections, Lemma 3.2 implies Lemma 3.1, which implies the Johnson-Lindenstrauss theorem.