\documentclass[11pt]{article}
\include{lecture}
\usepackage{alg}

\begin{document}
% *************
% LECTURE
% *************
\lecture{14}{3/4/2010}{Amplification}{Matthew Anderson \& Tyson Williams}
Last lecture we introduced expander graphs. From a combinatorial point of view,
expanders are relatively sparse graphs where each vertex has a constant degree
and are non-trivially expanding. From an algebraic point of view, expanders are
graphs of constant degree which have $\lambda(G) < 1$. Recall that $\lambda(G)$
is the largest absolute value eigenvalue of the normalized adjacency matrix of
$G$ corresponding to an eigenvector which is perpendicular to the all ones
vector. Stated formally,
\begin{align*}
 \lambda(G) = \max \{|\lambda|\ |\ (\exists 0 \neq x \bot u)\ Ax = \lambda x\}
\end{align*}
where $A$ is the normalized adjacency matrix of $A$ and $u$ is the uniform
distribution.

Today we discuss two applications of expanders for performing correctness
amplification on randomized algorithms. The first application decreases the
error rate of an algorithm using no additional randomness. The second
application decreases the error rate of an algorithm even further using only
slightly more randomness. Both applications use the expander mixing lemma that
was proved in the previous lecture.

\section{Deterministic Amplification}
Using expanders, it is possible to transform a random ($\BPP$) algorithm $R$
that takes $r$ random bits and errs with probability $\epsilon_0 \le
\frac{1}{3}$ into an equivalent random ($\BPP$) algorithm $R'$ that also uses
$r$ random bits and errs with probability $\le \epsilon$ by calling $R$
poly($\frac{1}{\epsilon}$) times.

\subsection{Construction}
The idea behind this transformation is to consider an explicit expander graph
$G$ with $2^r$ vertices where each vertex corresponds to a random bit string in
$\{0,1\}^r$. Pick a vertex $\rho'$ at random from $G$ using $r$ random bits.
Look at all neighbors $\rho$ at distance $t$ from $\rho'$. Run $R$ on each of
these neighbors $\rho$ and return the majority vote of these neighbors as the
output of $R'$.

Intuitively, because $G$ is expanding the set of neighbors at distance $t$ will
be ``spread out'' on the graph and close to uniformly distributed.

\subsection{Analysis}
Let $B$ be the set of the bad random strings for $R$ (the strings that give the
wrong answer for an input $x$). Let $B'$ be the set of bad random strings for
$R'$ (the strings whose majority of neighbors at distance $t$ give the wrong
answer).
\begin{align}
 B &= \{ \rho\ |\ R \text{ gives incorrect answer}\} \\
 B' &= \{ \rho'\ | \text { majority of } N^t(\rho')
\text{ give the incorrect answer}\}
\end{align}

By construction of $B$, $\mu(B) \le \epsilon_0 \le \frac{1}{3}$. In order for
$R'$ to have the required error we want $\mu(B') \le \epsilon$. Consider fixing
$t = 1$ then:
\begin{align}
 \frac{|E(B,B')|}{dN} \ge \frac{|B'|\frac{d}{2}}{dN} = \frac{\mu(B')}{2}.
\label{14.eqn.1}
\end{align}

This is because at least half of the immediate neighbors $(t = 1)$ of each
$\rho'$ in $B'$ are also in $B$ (they were incorrect for $R$). Applying the
expander mixing lemma to (\ref{14.eqn.1}) gives:
\begin{align}
 \mu(B') \left|\frac{1}{2} - \mu(B)\right|
 &= \left|\frac{\mu(B')}{2} - \mu(B)\mu(B')\right| \\
 &\le \left|\frac{|E(B,B')|}{dN} - \mu(B)\mu(B')\right|
\label{14.eqn.drop_measure}\\
 &\le \lambda \sqrt{\mu(B)\mu(B')}.
\end{align}

The last two terms in (\ref{14.eqn.drop_measure}) were dropped because they must
be less than or equal to 1. Rearranging terms and bounding $\mu(B) \le
\epsilon_0$ gives:
\begin{align}
 \mu(B') \le \frac{\lambda^2 \mu(B)}{\left(\frac{1}{2} - \mu(B)\right)^2} \le
\frac{\lambda^2 \epsilon_0}{\left(\frac{1}{2} - \epsilon_0\right)^2} \le
\epsilon. \label{14.eqn.2}
\end{align}

This only gives a constant decrease in error. Consider the effect of taking
neighbors at distance $t$ instead of only immediate neighbors. Replace $G$ with
$G'$ where $G'$ has the same vertices as $G$ but there is an edge between two
vertices $u$ and $v$ in $G'$ iff there is a path of length $t$ between $u$ and
$v$ in $G$ (allow multiple edges between two vertices in $G'$). This has the
effect of increasing the degree of $G'$ to $d^t$ and decreasing the second
eigenvalue $\lambda(G') = \lambda^t(G)$. The prior analysis still holds with
$\lambda(G')$ substituted for $\lambda(G)$. This changes the result of
(\ref{14.eqn.2}) to give:
\begin{align}
 \mu(B') \le \frac{\lambda^{2t} \epsilon_0}{\left(\frac{1}{2} -
\epsilon_0\right)^2} \le \epsilon.
\end{align}

Selecting $t = O(\log\frac{1}{\epsilon})$ gives error less than $\epsilon$. The
number of neighbors of $\rho'$ at distance $t$ is
$d^{O(\log\frac{1}{\epsilon})}$ which is polynomial in $\frac{1}{\epsilon}$. The
complexity of determining the neighbors is polynomial because $G$ is an explicit
expander construction. Therefore we can reduce the error to
$\frac{1}{\text{poly}}$ from a constant using polynomial time and the same
randomness as the original algorithm.

\section{Randomness Efficient Amplification}
The idea of this second application is to reduce the error further by using a
little additional randomness.

Given a random ($\BPP$) algorithm $R$ which uses $r$ random bits and errs with
probability $\epsilon_0 \le \frac{1}{3}$, it can be transformed into an
equivalent random ($\BPP$) algorithm $R'$ which uses $r +
O(\log\frac{1}{\epsilon})$ random bits with error $\le \epsilon$ by calling $R$
only $O(\log\frac{1}{\epsilon})$ times in total. Notice this construction allows
us to achieve exponentially small error ($\frac{1}{2^n}$) in polynomial time
with only slightly more randomness.

Such a transformation can be done trivially using $O(r\log\frac{1}{\epsilon})$
bits by sampling $\log\frac{1}{\epsilon}$ random strings but does not achieve
the additive result suggested. In order to improve on the trivial result, we
perform a variation upon the approach in the previous application.

\subsection{Construction}
Again, pick $\rho' \in \{0,1\}^r$ uniform at random. Consider all $\rho$ on a
random walk of length $t$ starting at $\rho'$. Run $R$ on all such $\rho$ and
take the majority vote.

The idea here is that we can do a better job than in the previous application
because there is more randomness to work with and neighbors at a further
distance can be visited (because only one neighbor at each distance is visited).

\subsection{Analysis}
There is one key lemma that will allow us to bound the error of this approach:

\begin{lemma} \label{14.lemma.random_amp}
 Let $P$ be a projection on those $\rho$ for which $R$ errs, then for any vector
$x$:
 \begin{align}
  \|PAx\|_2 \le \sqrt{\epsilon_0 + \lambda^2} \|x\|_2.
 \end{align}
\end{lemma}
\begin{proof}
 Consider the representation of $x = x^\parallel + x^\perp$ in the eigenbasis
with respect to $u$ as stated in the previous lecture. Then by the triangle
inequality:
 \begin{align}
  \|PAx\|_2 \le \|PAx^\parallel\|_2 + \|PAx^\perp\|_2. \label{14.eqn.2_norm_PAx}
 \end{align}

 Using the facts that the uniform distribution is invariant under $A$ and that
the bad set is small, we get:
 \begin{align}
  \|PAx^\parallel\|_2 &= \|Px^\parallel\|_2 \le \sqrt{\epsilon}
\|x^\parallel\|_2. \label{14.eqn.2_norm_PAx_para}
 \end{align}
 Using the facts that $P$ projects onto the bad set (so it does not affect a
perpendicular vector) and that $x^\perp$ contracts by at least $\lambda$, we
get:
 \begin{align}
  \|PAx^\perp\|_2 &\le \|Ax^\perp\|_2 \le \lambda \|x^\perp\|_2.
\label{14.eqn.2_norm_PAx_perp}.
 \end{align}

 Substituting (\ref{14.eqn.2_norm_PAx_para}) and (\ref{14.eqn.2_norm_PAx_perp})
back into the (\ref{14.eqn.2_norm_PAx}), we have:
 \begin{align}
  \|PAx\|_2
  &\le \sqrt{\epsilon_0} \|x^\parallel\|_2 + \lambda \|x^\perp\|_2 \\
  &= (\sqrt{\epsilon_0}, \lambda) \cdot \left(\|x^\parallel\|_2,
\|x^\perp\|_2\right)^\intercal \\
  &\le \sqrt{\epsilon_0 + \lambda^2}\|x\|_2 \tag{Follows from Cauchy-Schwarz}
 \end{align}
\end{proof}

This lemma can be used to bound the error probability of $R'$. Consider the
probability that $R'$ errs. This is the same as the probability that at least
half of the steps in the random walk fell in the set where $R$ errs.
\begin{align}
 \Pr[R' \text{ errs}]
 &= \Pr[\text{At least } \frac{t}{2} \text{ of } \rho
\text{ fall in the set on which } R \text{ errs}] \\
 &\le \sum_{B \subseteq [t], |B| \ge \frac{t}{2}} \Pr[(\forall i \in B)
i^{\text{th}} \text{ step lies in the bad set for } R]
\label{14.eqn.pr_upper_bound}\\
 &= \sum_{B \subseteq [t], |B| \ge \frac{t}{2}} \|M_tA M_{t-1}A \ldots M_2A M_1A
M_0 u\|_1 \label{14.eqn.pr_as_matrix}\\
 &\le \sum_{B \subseteq [t], |B| \ge \frac{t}{2}} \sqrt{2^r} \|M_tA \ldots M_1A
M_0 u\|_2 \\
 &\le \sum_{B \subseteq [t], |B| \ge \frac{t}{2}} \sqrt{2^r}
\left(\sqrt{\epsilon_0 + \lambda^2}\right)^{|B|} \|u\|_2
\label{14.eqn.repeat_lemma}\\
 &= \sum_{B \subseteq [t], |B| \ge \frac{t}{2}} \left(\sqrt{\epsilon_0 +
\lambda^2}\right)^{|B|} \\
 &\le 2^t \cdot \left(\sqrt{\epsilon_0 + \lambda^2}\right)^{\frac{t}{2}} \\
 &= (4 \sqrt{\epsilon_0 + \lambda^2})^{\frac{t}{2}} \le \epsilon.
\end{align}

Line (\ref{14.eqn.pr_upper_bound}) is an upper bounds the actual probability
because it is over counting the bad strings. This probability is rewritten as a
product of matrices in (\ref{14.eqn.pr_as_matrix}) where
\begin{align*}
 M_i =
 \left\{
 \begin{array}{ll}
  P & i \in B\\
  I & \text{otherwise.}
 \end{array}
 \right.
\end{align*}
Line (\ref{14.eqn.repeat_lemma}) follows from repeated applications of Lemma
\ref{14.lemma.random_amp}. A constant number of iterations can decrease
$\sqrt{\epsilon_0 + \lambda^2}$ to less than $\frac{1}{4}$, making $|B| =
\frac{t}{2}$ maximize the RHS. We can use the deterministic amplification
procedure to acheive this.

If $4\sqrt{\epsilon_0 + \lambda^2} \ge 1$, then we can decrease $\epsilon_0$ by
running $R$ a constant number of times, which is the randomness ineffecient
approach to amplification. The better option is to preform a random walk of
length $c \cdot t$ where $c$ is a constant. Just like in the deterministic case,
this has the effect of replacing $\lambda$ with $\lambda^c$. Because we are free
to decrease $\epsilon_0$ or $\lambda$, we can get $4\sqrt{\epsilon_0 +
\lambda^2} < 1$.

If $4\sqrt{\epsilon_0 + \lambda^2} < 1$, then walking for $t =
O(\log\frac{1}{\epsilon})$ steps will give error less than $\epsilon$. This
procedure uses $r$ random bits to pick the starting vertex, and $\log d$ bits
for each of the $\log\frac{1}{\epsilon}$ steps in the random walk for a total of
$r + O(\log\frac{1}{\epsilon})$ random bits for $R'$.

\section{Other Results}
A stronger result which considers the variance of random walks is known as the
Expander Chernoff Bound. It states that the fraction of times a random walk
lands in the bad set does not vary much from the expected number. Let $X_i$ be
an indicator variable that indicates the event that the $i^{\text{th}}$ step
lies in some set $B_i \subseteq V$. Then the probability that the walk varies
from the the expected number of steps in the bad sets can be written as
\begin{align}
 \Pr\left[\sum_i^t (X_i - \mu(B_i)) \ge \alpha t \right] \le e^{-b \alpha^2 (1 -
\lambda) t},
\end{align}
where $b$ is some universal constant and $\alpha \ge 0$. The probability that
the walk varies from the expectation for a constant $\alpha$ decreases
exponentially as $t$ increases linearly. This inequality reduces to the standard
Chernoff Bound if $G$ is a complete graph ($\lambda(G) = 0$ because rank($G$) =
1 and all the $X_i$ are independent).

\section{Next Time}
In the next lecture, we will discuss pseudorandom generators for space-bounded
computation as another application of expanders. This application leverages the
power of being able to pick one vertex and a neighbor at random instead of
picking two vertices uniformly at random. We will apply this procedure
recursively to construct pretty good (though perhaps not the best) pseudorandom
generators. Pseudorandom number generation is the dual of amplification. In
pseudorandom number generation, we will try to reduce the amount of randomness
used while not making the error grow by too much more.
\end{document}
