\documentclass[11pt]{article}

\usepackage{lecture}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\lecture{11}{2/25-27/2013}{Applications of Expanders}{Mahnaz Akbari
  and Nick Pappas} 

In this lecture we discuss a central application of expanders in
the context of derandomization, namely randomness-efficient {\em
  confidence boosting}, i.e., reducing the error probability of a
randomized algorithm without increasing the need for random bits by
too much. We present two approaches -- a deterministic one
and a randomized one.  Deterministic confidence boosting requires no
additional randomness but takes more time to achieve a certain level
of confidence. Randomized confidence boosting takes less time but
requires a small amount of additional randomness.

Recall the setting of confidence boosting from Lecture 5. Given a
randomized algorithm $A(x,\rho)$ with error at most
$\frac{1}{2}-\eta$, we want to construct a randomized algorithm 
$A'(x,\rho')$ for the same problem but with error at most $\delta$
such that (i) the number of random bits $r' \doteq |\rho'|$ that $A'$
needs is not much larger than the $r \doteq |\rho|$ random bits $A$
needs, and (ii) the running time of $A'$ is not much larger than the
running time of $A$. The new algorithm $A'(x,\rho')$ runs
$A(x,\rho_i)$ for $t$ random bit sequences $\rho_i$,  $i \in [t]$, and
combines the results in an appropriate way. If the underlying problem
has a unique solution, the combining function is simply the plurality
vote. 

In Lecture 5 we analyzed confidence boosting when the $\rho_i$ are
chosen (a) independently uniformly and (b) pairwise uniformly. In this
lecture we do the same for two ways of obtaining the $\rho_i$ as
vertices of an explicit expander $G$ of size $N=2^r$, equating the
vertices of $G$ with the bit strings in $\zo^r$. 

\section{Deterministic Confidence Boosting}

For deterministic confidence boosting we take the $\rho_i$ as the
neighbors of $\rho'$ in $G$. We denote the set of neighbors of $\rho'$
as $\Gamma(\rho')$. Note that no additional random bits are required:
We only need to pick $\rho'$ uniformly at random and $|\rho'|=\rho_i$,
so we have $r'=r$. Intuitively, because $G$ is expanding the neighbors
are spread out fairly well over the graph, which means we are close to
the setting where we pick the $\rho_i$ independently uniformly. We
analyze the resulting reduction in error using the quasi-randomness
property of expanders.

\begin{lemma}\label{lemma:boosting:det}
Suppose that the randomized algorithm $A$ on input $x$ uses $r$ random
bits and outputs $y$ with probability $\frac{1}{2} + \eta$. Let $G$ be
a regular multigraph on $\zo^r$. Then 
\[ \Pr_{\rho' \leftarrow U_r} [ \mathrm{plurality}_{\rho \in
  \Gamma(\rho')} A(x,\rho) \not= y \} ] \leq \lambda(G)^2
(\frac{1}{4}-\eta^2) / \eta^2. \]
\end{lemma}
\begin{proof}
Fix the input $x$ and the output $y$. Let $B$ denote the set of random
bit strings that yield an output for $A$ other than $y$, and let $B'$
denote the corresponding set for the boosted algorithm, i.e., 
\[ B = \{ \rho \, : \, A(x,\rho) \not= y \} \textrm{ and }
    B' = \{ \rho' \, : \, \mathrm{plurality}_{\rho \in \Gamma(\rho')}
    A(x,\rho) \not= y  \}. 
\]
We know that $\mu(B) = \frac{1}{2}-\eta$ and want to upper bound
$\mu(B')$. Note that for every $\rho' \in B'$, $A(x,\rho)$ differs
from $y$ for at least half of the neighbors $\rho \in
\Gamma(\rho')$, i.e., $|\Gamma(\rho') \cap B| \geq \frac{d}{2}$, where
$d$ denotes the degree of $G$. Therefore,
\begin{equation}\label{eq:edge:bound}
 |E(B,B')| \geq |B'| \cdot \frac{d}{2}.
\end{equation}
The quasi-randomness property (Theorem
\ref{lect09:thm:expander:mixing} 
from Lecture 9) of $G$ with $S=B$ and $T=B'$ tells us that
\begin{equation}\label{eq:mixing}
\left| \frac{|E(B,B')|}{dN} - \mu(B)\mu(B') \right| \leq 
\lambda(G) \cdot \sqrt{\mu(B)(1-\mu(B))} \cdot \sqrt{\mu(B')(1-\mu(B'))}.
\end{equation}
By the above we know that 
$\frac{|E(B,B')|}{dN} \geq \frac{\mu(B')}{2}$ and that $\mu(B)\mu(B')
\leq \frac{\mu(B')}{2}$, so we can drop the absolute value signs on
the left-hand side of \eqref{eq:mixing}. Using \eqref{eq:edge:bound}
we obtain from \eqref{eq:mixing} that
\begin{eqnarray*}
\mu(B') \cdot \eta & = & \frac{\mu(B')}{2} - (\frac{1}{2}-\eta) \mu(B') \\
& \leq & \frac{|E(B,B')|}{dN} - \mu(B)\mu(B') \\
& \leq & \lambda(G) \cdot \sqrt{\mu(B)(1-\mu(B))} \cdot
\sqrt{\mu(B')(1-\mu(B'))} \\ 
& = & \lambda(G) \cdot \sqrt{\frac{1}{4}-\eta^2} \cdot
\sqrt{\mu(B')(1-\mu(B'))}. 
\end{eqnarray*}
After rearranging and simplifying this gives us
\[ \sqrt{\mu(B')} \leq \frac{\lambda(G)}{\eta} \cdot 
\sqrt{\frac{1}{4}-\eta^2}, \]
which is equivalent to the bound in the statement.
\end{proof}

Using the fully explicit expanders from Lecture 10, Lemma
\ref{lemma:boosting:det} leads to the following confidence boosting
result. For simplicity we state it for decision procedures only.
\begin{theorem}[Deterministic Confidence
  Boosting]\label{thm:boosting:det} 
Given a randomized decision algorithm $A$ that uses $r$ random bits,
has error at most $\frac{1}{2}-\eta$, and runs in time $t$, there
exists a randomized decision algorithm $A'$ for the same problem that
has error at most $\delta$, uses $r$ random bits, and runs in time
$\poly(\frac{1}{\delta\eta}) \cdot (\poly(r)+t)$.
\end{theorem}
\begin{proof}
We let $A'(x,\rho')$ output the majority vote of $A(x,\rho)$ over
$\rho \in \Gamma(\rho')$. 
In order to guarantee that the error bound given by Lemma
\ref{lemma:boosting:det} is no more than $\delta$, it suffices that
\begin{equation}\label{eq:cond}
\lambda(G) \leq \sqrt{\delta} \cdot \eta.
\end{equation} 
The fully explicit expanders $G$ given by Theorem \ref{lect10:thm:torus} 
from Lecture 10 satisfy $\lambda(G) \leq \lambda$ for some
constant $\lambda < 1$, and have constant degree $d$. By taking
their $s$-th power, i.e., by considering all walks of length $s$ in
$G$, we obtain graphs $G'=G^s$ with $\lambda(G') \leq \lambda^s$
and degree $d'=d^s$. Setting  $s =
\frac{\log(1/(\sqrt{\delta}\eta))}{\log(1/\lambda_0)}$ ensures 
\eqref{eq:cond} and yields degree $d' = \poly(\frac{1}{\delta\eta})$. 
The resulting algorithm $A'(x,\rho')$ runs $A(x,\rho_i)$ on $d'$
random bit sequences $\rho_i$, and additionally needs to compute at
most $d'$ times a neighbor of a vertex in $G$. Since $G$ is fully 
explicit and has $N=2^r$ vertices, the latter can be done in time
polynomial in $r$ per neighbor. Thus, the overall running time is 
\[ d' \cdot (\poly(r)+t) = \poly(\frac{1}{\delta\eta}) \cdot
(\poly(r)+t).\]

Strictly speaking, Theorem \ref{lect10:thm:torus} from Lecture 10 only
guarantees the existence of $G$ on $N=2^r$ vertices for even
$r$. However, for odd $r$ we can use $G$ with $N=2^{r+1}$ vertices,
and on a given $\rho' \in \zo^r$ use all of $\Gamma(\rho'0) \cup
\Gamma(\rho'1)$ as the $\rho_i$. The overall majority vote can only
be incorrect if the majority over at least one of $\Gamma(\rho'0)$ or
$\Gamma(\rho'1)$ is incorrect. Thus, by a union bound, the error
probability of this modified procedure is at most $2\delta$.
\end{proof}

For decision procedures with {\em one-sided error} there is a better
combining function. If $A$ has no false positives, $A'$ can accept as
soon as at least one of the runs of $A$ accepts; $A'$ rejects
otherwise. Then $A'$ also has no false positives, and $A'$ errs iff
$A$ errs on all runs. This allows us to handle error rates for $A$
that are close to 1. We leave the analysis as an exercise.
\begin{exercise}\label{ex:one-sided:det}
Show that if $A$ has one-sided error, then the upper bound of
$\frac{1}{2}-\eta$ in the statement of Theorem \ref{thm:boosting:det}
can be relaxed to $1-\eta$ and $A'$ can be made one-sided, without any
further changes to the statement. Hint: First show how to modify Lemma
\ref{lemma:boosting:det}. 
\end{exercise}

\section{Randomized Confidence Boosting}

Instead of picking the $\rho_i$ as the neighbors of some
vertex $\rho$ of $G$, we can pick them as the vertices on a random
walk starting from $\rho$. Intuitively, this improves the confidence
more because we get further away from the start vertex $\rho$, and
therefore closer to the situation where we pick the $\rho_i$
independently uniformly. The number of random bits needed for the
random walk of length $s-1$ (consisting of $s$ vertices including the
start vertex $\rho$) is $r + (s-1) \cdot \log d$, where $d$ denotes
the degree of $G$.

\subsection{One-Sided Error}

We first analyze this boosting procedure in the case of decision
algorithms with one-sided error.
The following analysis uses the matrix decomposition given by
Proposition \ref{lect09:prop:decomposition} from Lecture 9:
\begin{equation}\label{eq:decomposition}
M_G = (1-\lambda(G)) \cdot M_K + \lambda(G) \cdot \Delta,
\end{equation}
where $K$ denotes the complete digraph with self-loops, and
$\|\Delta\|_2 \leq 1$. 
\begin{lemma}\label{lemma:boosting:one-sided}
Suppose that the randomized algorithm $A$ on input $x$ uses $r$ random
bits and outputs $y$ with probability $\eta$. Let $G$ be a regular
multigraph on $\zo^r$, and consider a random walk of length $s-1$ in
$G$. Then  
\begin{equation}\label{eq:bound:one-sided}
\Pr_{\rho' \leftarrow U_r} [ (\forall k \in [s]) A(x,\rho_k) \not=
y] \leq (1-\eta) \left( 1- (1-\lambda(G)) (1-\sqrt{1-\eta}) \right)^{s-1}, 
\end{equation}
where $\rho'$ describes a random walk of length $s-1$, and $\rho_k$
denotes the $k$-th vertex on the random walk.
\end{lemma}
\begin{proof}
Fix the input $x$ and the output $y$. Let $B$ denote the set of random
bit strings that yield an output for $A$ other than $y$. Let $B' = \{
\rho' \, : \, (\forall k \in [s]) \, \rho_k \in B \}$. We have that
$\mu(B)=1-\eta$ and want to upper bound $\mu(B')$. 

We first express $\mu(B')$ in linear-algebraic terms using $M_G$.
Let $N \doteq 2^r$, and let $P \in \zo^{N \times
  N}$ denote the projection onto $B$: 
\[ P_{ij} = \left\{ \begin{array}{ll}
                1 & \textrm{ if } i=j \in B \\
                0 & \textrm{ otherwise.}
               \end{array}
\right. \]
The key is the following claim.
\begin{claim}\label{claim:one-sided}
For every $i,j \in [N]$ and every integer $\ell \geq 0$,
$((PM_G)^\ell P)_{ij}$ equals the probability that a random walk of length
$\ell$ in $G$ starting from $j$ stays entirely within $B$ and ends in
$i$. 
\end{claim}
Intuitively, the effect of each application of $P$ is to annihilate
all walks that fall outside of $B$ at that point in time, and to leave
all others unaffected. The formal proof follows by induction on $\ell$
and is left as an exercise.  

By Claim \ref{claim:one-sided} we can write the probability that the
random walk stays entirely within $B$ and ends in $i$ as
$((PM_G)^{s-1}PU_N)_i$.  Therefore,
\begin{eqnarray}
\mu(B')  & \doteq & \Pr[ (\forall k \in [s]) \, \rho_k \in B ]  \nonumber \\
& = & \| (PM_G)^{s-1}PU_N \|_1 \nonumber \\
& \leq & \sqrt{N} \cdot \| (PM_G)^{s-1}PU_N \|_2 \nonumber \\
& \leq & \sqrt{N} \cdot \| PM_G \|_2^{s-1} \cdot \|PU_N
\|_2, \label{eq:one-sided} 
\end{eqnarray}
where we used properties of the 1-norm and the 2-norm.

By \eqref{eq:decomposition} and the triangle inequality
\begin{equation}\label{eq:triangle}
\|PM_G\|_2 \leq (1-\lambda(G)) \|PM_K\|_2 + \lambda(G) \|P\Delta\|_2. 
\end{equation}
As for the first term in \eqref{eq:triangle}, consider an arbitrary
column vector $v \in \mathbb{R}^N$. The vector $M_Kv$ is parallel to
$U_N$; more precisely, $M_Kv = (\sum_{i=1}^N v_i) U_N$. It follows
that 
\[ \|PM_Kv\|_2 = \| P (\sum_{i=1}^N v_i) U_N \|_2 \leq \|v\|_1 \cdot
\|PU_N\|_2 \leq \sqrt{N} \|v\|_2 \|PU_N\|_2. \]
Since $PU_N = \frac{1}{N} I_B$, 
\begin{equation}\label{eq:pu}
\|PU_N\|_2 = \frac{\sqrt{|B|}}{N}.
\end{equation}
Thus, 
\[ \|PM_Kv\|_2 \leq \sqrt{N} \cdot \|v\|_2 \cdot
\frac{\sqrt{|B|}}{N} = \sqrt{\mu(B)} \cdot \|v\|_2. \]
Since $v$ is arbitrary this means that 
\[ \|PM_K\|_2 \leq \sqrt{\mu(B)}.\]

As for the second term in \eqref{eq:triangle}, we have that $\|P
\Delta \|_2 \leq \|P\|_2 \cdot \|\Delta\|_2 \leq 1$. Plugging in the
upper bounds for both terms on the right-hand side 
of \eqref{eq:triangle} yields
\begin{equation}\label{eq:pm}
\|PM_G\|_2 \leq (1-\lambda(G)) \sqrt{\mu(B)} + \lambda(G)
= 1 - (1-\lambda(G))(1-\sqrt{\mu(B)}). 
\end{equation}
Using this upper bound and \eqref{eq:pu} in \eqref{eq:one-sided}, we
conclude that
\[ \mu(B') \leq \sqrt{N} \cdot 
\left( 1 - (1-\lambda(G))(1-\sqrt{\mu(B)}) \right)^{s-1} \cdot
\frac{\sqrt{|B|}}{N}, \]
which is equivalent to the bound claimed in the statement.
\end{proof}
The bound given by Lemma \ref{lemma:boosting:one-sided} can be further
improved, namely as follows.
\begin{exercise}\label{ex:one-sided:rand}
Show that $\mu(B')$ in the proof of Lemma
\ref{lemma:boosting:one-sided} can be written as 
$\mu(B') = \| (PM_GP)^{s-1}PU_N \|_1$ and that 
$\|PM_GP\|_2 \leq 1 - (1-\lambda(G))(1-\mu(B))$. Conclude that the
right-hand side of \eqref{eq:bound:one-sided} can be tightened to 
\[ (1-\eta) \big( 1- (1-\lambda(G))\eta \big)^{s-1}. \]
\end{exercise}
We can further simplify the latter upper bound using $1-x \leq
\exp(-x)$ as  follows:
\[ (1-\eta) \big( 1- (1-\lambda(G))\eta \big)^{s-1}
\leq \big( 1- (1-\lambda(G))\eta \big)^s
\leq \exp\big(-(1-\lambda(G))\eta s\big).\]
Thus, it suffices to pick $s =
\frac{\ln(1/\delta)}{(1-\lambda(G))\eta}$ in order to guarantee that
the error of $A'$ is no more than $\delta$. If the expander family has
constant degree and a spectral gap that is at least some positive
constant, it follows that $s=O(\frac{\log(1/\delta)}{\eta})$, and the
number of random bits needed is $r + O(s) = r
+O(\frac{\log(1/\delta)}{\eta})$. 

We can further reduce the number of 
random bits and remove the dependency on $\eta$ by first using
deterministic confidence boosting up to a constant level, and then
applying the random walk approach. This leads to the following
confidence boosting result for decision procedures with one-sided
error.
\begin{theorem}[Expander-Walk Confidence
  Boosting for One-Sided Error]\label{thm:boosting:one-sided} 
Given a randomized decision algorithm $A$ that uses $r$ random bits,
has one-sided error at most $1-\eta$, and runs in time $t$, there
exists a randomized decision algorithm $A'$ for the same problem that
has one-sided error at most $\delta$, uses
$r+O(\log(\frac{1}{\delta}))$ random bits, and runs in time
$\poly(\frac{1}{\eta}) \cdot \log(\frac{1}{\delta}) \cdot (\poly(r)+t)$. 
\end{theorem}
\begin{proof}
We first use Exercise \ref{ex:one-sided:det} to reduce the error rate from
$1-\eta$ down to $\frac{1}{2}$ while maintaining one-sidedness. Let
$\tilde{A}$ denote the resulting decision algorithm. The amount of
random bits of $\tilde{A}$ remains at $r$, and the running time of
$\tilde{A}$ is $\poly(\frac{1}{\eta}) \cdot (\poly(r)+t)$.

Next we apply Lemma \ref{lemma:boosting:one-sided} to $\tilde{A}$ so
as to further reduce the error from $\frac{1}{2}$ down to $\delta$. 
We use the fully explicit family of expanders $G$ given by Theorem
\ref{lect10:thm:torus} from Lecture 10, which has constant degree $d$
and $\lambda(G) \leq \lambda$ for some constant $\lambda < 1$. 
Using the improved analysis from Exercise \ref{ex:one-sided:rand}, the
overall error is at most $\delta$ for
$s = 2 \ln(\frac{1}{\delta}) / (1-\lambda(G))$, which is
$O(\log(\frac{1}{\delta}))$. The resulting algorithm $A'$ needs $r + (s-1)
\log(d)$ random bits, which is $r + O(\log(\frac{1}{\delta}))$.
In order to run $A'(x,\rho')$ we need to compute $s-1$ times a
neighbor of a vertex in the expander $G$ with $N = 2^r$ 
vertices, and to run $\tilde{A}(x,\rho)$ for $s$ choices of
$\rho$. The overall running time of $A'$ is
\[ s \cdot \left( \poly(r)+ \poly(\frac{1}{\eta}) \cdot (\poly(r)+t) \right)
= \poly(\frac{1}{\eta}) \cdot \log(\frac{1}{\delta}) \cdot (\poly(r)+t). \]

The issue that the family given by Theorem \ref{lect10:thm:torus} from
Lecture 10 only contains graphs $G$ with $N=2^r$ vertices for even $r$
can be handled in a similar way as in the proof of Theorem
\ref{thm:boosting:det}.
\end{proof}
 
Compared to the deterministic boosting approach from Exercise
\ref{ex:one-sided:det}, the dependency of the running time on
$\frac{1}{\delta}$ is only logarithmic rather than polynomial.
Figure \ref{fig:one-sided} compares the various {\em randomized}
approaches we have seen for reducing the one-sided error of
an algorithm $A$ from $1-\eta$ down to $\delta$ in terms of (a) 
the number of truly random bits needed and (b) the number of times $A$
is run.
\begin{figure}[h]
\begin{center}
\begin{tabular}{|r|l|c|c|}
\hline
& method & number of random bits & number of runs
\\ \hline
(i) & fully independent runs 
& $O(r \cdot \log(\frac{1}{\delta}) \cdot 
\frac{1}{\eta})$
& $O(\log(\frac{1}{\delta}) \cdot \frac{1}{\eta})$ 
\\ \hline
(ii) & pairwise independent runs 
& $O(r + \log(\frac{1}{\delta}) + \log(\frac{1}{\eta}))$
& $O(\frac{1}{\delta \eta})$ 
  \\ \hline
(iii) & expander walk
& $r + O(\log(\frac{1}{\delta}) \cdot \frac{1}{\eta})$ 
& $O(\frac{1}{\eta} \log(\frac{1}{\delta}))$ 
  \\ \hline
(iv) & Theorem \ref{thm:boosting:one-sided}
& $r + O(\log(\frac{1}{\delta}))$
& $\poly(\frac{1}{\eta}) \cdot \log(\frac{1}{\delta})$ 
  \\ \hline
(v) & optimal
& $r + \Theta(\log(\frac{1}{\delta}))$
& $\Theta(\frac{1}{\eta} \log(\frac{1}{\delta}))$ 
  \\ \hline
\end{tabular}
\end{center}
\caption{Overview of randomized approaches for one-sided confidence
  boosting.} \label{fig:one-sided}
\end{figure}
Lines (i) and (ii) in Figure \ref{fig:one-sided} were analyzed in
Lectures 3 and 5 for two-sided error. Lines (iii) and 
(iv) were analyzed earlier in this lecture. We leave it as an exercise
to prove that (v) can be realized; we refer to \cite[Appendix
C]{Gol11} for matching lower bounds. 
\begin{exercise}
Show how to realize (v) by following the two-phased approach from
Theorem \ref{thm:boosting:one-sided} but using Ramanujan graphs for
the deterministic phase.
\end{exercise}

\subsection{Two-Sided Error}

For randomized decision algorithms with {\em two-sided error} 
we can combine the $s$ runs of the random walk by taking the majority
vote, and for more general randomized algorithms computing a function
by taking the plurality vote. The error analysis given in Lemma
\ref{lemma:boosting:one-sided} extends as follows. 
\begin{lemma}\label{lemma:boosting:two-sided}
Suppose that the randomized algorithm $A$ on input $x$ uses $r$ random
bits and outputs $y$ with probability $\frac{1}{2}+\eta$. Let $G$ be a regular
multigraph on $\zo^r$, and consider a random walk of length $s-1$ in $G$
starting from $\rho'$. Then 
\[ \Pr_{\rho' \leftarrow U_r} [ \mathrm{plurality}_{k \in [s]} A(x,\rho_k) \not=
y] \leq  2^s  \left( (1-\lambda(G)) \sqrt{\frac{1}{2}-\eta} +
  \lambda(G) \right)^{\frac{s}{2}-1}, \]
where $\rho'$ describes a random walk of length $s-1$, and $\rho_k$
denotes the $k$-th vertex on the random walk.
\end{lemma}
\begin{proof}
We follow the same outline as in the proof of Lemma
\ref{lemma:boosting:one-sided} and borrow the notation $B$ for the bad
set of $A$ on input $x$, and $P$ for the projection onto $B$. We have
that $\mu(B)=\frac{1}{2}-\eta$ and want to upper bound $\mu(B')$ where 
$B' \doteq \{ \rho' \, : \, \mathrm{plurality}_{k \in [s]} A(x,\rho_k)
\not= y \}$. 

Similar to Claim \ref{claim:one-sided}, for every $i,j \in [N]$, every
integer $\ell \geq 0$, and every subset $L \subseteq [\ell]$, we can
write the probability that a random walk of length $\ell$ in $G$
starting from $j$ ends in $i$ and has $\rho_k \in B$ for every $k \in
L$ as 
\[ (Q_\ell M_G Q_{\ell-1} M_G \cdots M_G Q_2 M_G Q_1)_{ij}, \]
where 
\[ Q_k = \left\{ \begin{array}{ll}
                P & \textrm{ if } k \in B \\
                I & \textrm{ otherwise.}
               \end{array}
\right.
\]
It follows that 
\begin{eqnarray*}
\mu(B') & \leq & \Pr[ \rho_k \in B \textrm{ for at least } \frac{s}{2}
\textrm{ of } k \in [s] ] \\
& \leq & \sum_{S \subseteq [s], |S| \geq s/2} \Pr[ (\forall k \in S)
\rho_k \in B ] \\
& = & \sum_{S \subseteq [s], |S| \geq s/2} 
 \| (Q_\ell M_G Q_{\ell-1} M_G \cdots M_G Q_2 M_G Q_1) U_N \|_1 \\
& \leq & \sum_{S \subseteq [s], |S| \geq s/2} 
\sqrt{N} \cdot (\prod_{1 < k \leq s} \|Q_k M_G\|_2) \cdot \|Q_1 U_N\|_2 \\
& \leq & \sum_{S \subseteq [s], |S| \geq s/2} 
\sqrt{N}  \|P M_G\|_2^{|S|-1} \cdot \|U_N\|_2 \textrm{ (since
  $\|Q_kM_G\|_2 \leq 1$ and $\|Q_1\|_2 \leq 1$)} \\
& \leq & 2^s \|P M_G\|_2^{\frac{s}{2}-1}.
\end{eqnarray*}
The bound given in the statement then follows by \eqref{eq:pm}.
\end{proof}

Lemma \ref{lemma:boosting:two-sided} leads to the following confidence  
boosting result for decision procedures with two-sided error.
\begin{theorem}[Expander-Walk Confidence
  Boosting for Two-Sided Error]\label{thm:boosting:two-sided} 
Given a randomized decision algorithm $A$ that uses $r$ random bits,
has error at most $\frac{1}{2}-\eta$, and runs in time $t$, there
exists a randomized decision algorithm $A'$ for the same problem that
has error at most $\delta$, uses
$r+O(\log(\frac{1}{\delta}))$ random bits, and runs in time
$\poly(\frac{1}{\eta}) \cdot \log(\frac{1}{\delta}) \cdot (\poly(r)+t)$. 
\end{theorem}
Compared to the deterministic boosting approach from Theorem
\ref{thm:boosting:det}, the dependency of the running time on
$\frac{1}{\delta}$ is only logarithmic rather than polynomial. The
proof of Theorem \ref{thm:boosting:two-sided} follows along the same
lines as the one of Theorem \ref{thm:boosting:one-sided}, using Lemma
\ref{lemma:boosting:two-sided} instead of Lemma
\ref{lemma:boosting:one-sided}. We leave the proof as an exercise. 

To compare the various randomized approaches for reducing the
two-sided error of an algorithm $A$ from $\frac{1}{2}-\eta$ down to
$\delta$, Figure \ref{fig:two-sided} tabulates the number of truly
random bits needed and the number of times $A$ is run.
\begin{figure}[h]
\begin{center}
\begin{tabular}{|r|l|c|c|}
\hline
& method & number of random bits & number of runs
\\ \hline
(i) & fully independent runs 
& $O(r \cdot \log(\frac{1}{\delta}) \cdot 
\frac{1}{\eta^2})$
& $O(\log(\frac{1}{\delta}) \cdot \frac{1}{\eta^2})$ 
\\ \hline
(ii) & pairwise independent runs 
& $O(r + \log(\frac{1}{\delta}) + \log(\frac{1}{\eta}))$
& $O(\frac{1}{\delta \eta^2})$ 
  \\ \hline
(iii) & Theorem \ref{thm:boosting:two-sided}
& $r + O(\log(\frac{1}{\delta}))$
& $\poly(\frac{1}{\eta}) \cdot \log(\frac{1}{\delta})$ 
  \\ \hline
(iv) & optimal
& $r + \Theta(\log(\frac{1}{\delta}))$
& $\Theta(\frac{1}{\eta^2} \log(\frac{1}{\delta}))$ 
  \\ \hline
\end{tabular}
\end{center}
\caption{Overview of randomized approaches for two-sided confidence
  boosting.} \label{fig:two-sided}
\end{figure}

Lines (i) and (ii) in Figure \ref{fig:two-sided} were analyzed in
Lectures 3 and 5. and line (iii) in this lecture. 
We leave it as an exercise to prove that (iv) can be realized; we
refer to \cite{CEG95} for matching lower bounds.
\begin{exercise}
Show how to realize (v) by following the approach of Theorem
\ref{thm:boosting:two-sided} but using Ramanujan graphs for 
the deterministic phase.
\end{exercise}
The essential difference between the tables in Figure for 
\ref{fig:one-sided} for one-sided error and Figure \ref{fig:two-sided}
for two-sided error is the term $\frac{1}{\eta}$ vs $\frac{1}{\eta^2}$. 

\subsection{Chernoff Bound}

Confidence boosting is closely related to Chernoff bounds, which are
strong concentration results for sums of independent random
variables. There are several variants. For background, we state and
prove a simple variant in which the random variables are indicator
variables with the same expectation, and the deviation from the mean
is absolute. This version is attributed to Hoeffding.
\begin{theorem}[Hoeffind Bound]\label{thm:Hoeffding}
Let $X_1, X_2, \ldots, X_s$ denote independent indicator variables
with the same expected value $\mu$. For every $\epsilon \in [0,1]$
\[ \Pr\left[ (\sum_{i=1}^s X_i) - \mu s \geq \epsilon s \right] \leq
\exp\left( -\frac{\epsilon^2 s}{4} \right). \]
\end{theorem}
Theorem \ref{thm:Hoeffding} implies that
\[ \Pr\left[ \left| (\sum_{i=1}^s X_i) - \mu s \right| \geq \epsilon s
\right]  \leq 2\exp\left( -\frac{\epsilon^2 s}{4} \right). \] 
This concentration result is exponentially stronger than the one 
we obtained in Lecture 5 using Chebyshev's inequality, but Chebyshev
only requires pairwise independence, whereas Hoeffding requires full
independence. We proved Chebyshev by transforming each side of the
inequality using the mapping $f(x)=x^2$ and then applying Markov. To
prove Hoeffding, we follow the same outline but use a mapping $f$ that
grows much more quickly and still interacts well with the expectation
we need for applying Markov. Specifically, we use an exponential
transformation of the form $f(x)=\exp(ax)$ for an appropriately 
chosen value of $a$. 
\begin{proof}
Let $a$ be any positive real. Since $f(x) = \exp(ax)$ is an increasing
function, we have that 
\[ \sum_{i=1}^s X_i \geq (\mu + \epsilon) s \Leftrightarrow 
\exp\left( a \sum_{i=1}^s X_i \right)\geq \exp(a(\mu + \epsilon)s). \]
Since $f(x)$ is nonnegative, the random variable 
$\exp\left( a \sum_{i=1}^s X_i \right)$ is nonnegative so we can
apply Markov's inequality. We get that 
\begin{eqnarray}
\Pr\left[ (\sum_{i=1}^s X_i) - \mu s \geq \epsilon s \right] 
& = & \Pr\left[ \sum_{i=1}^s X_i \geq (\mu + \epsilon) s \right] \nonumber \\
& = & \Pr\left[ \exp\left(a \sum_{i=1}^s X_i \right) \geq \exp(a(\mu
  + \epsilon) s) \right] \nonumber \\
& \leq & \frac{\Exp[\exp(a \sum_{i=1}^s X_i)]}{\exp(a(\mu + \epsilon)
  s)}. \label{eq:prob}
\end{eqnarray}
The numerator can be upper bounded as follows.
\begin{eqnarray}
\Exp[\exp(a \sum_{i=1}^s X_i)]
& = & \Exp[ \prod_{i=1}^s \exp(a X_i)] \nonumber \\
& = & \prod_{i=1}^s \Exp(aX_i)  \textrm{ (by full independence)}
\nonumber \\
& = & \prod_{i=1}^s \left( \mu \cdot e^a + (1-\mu) \right)  \textrm{
  (expectation of an indicator variable)} \nonumber \\
& = & \left( 1 + (e^a-1)\mu \right)^s  \textrm{ (by rewriting)}
\nonumber \\
& \leq & \exp((e^a-1)\mu s)  \textrm{ (using $1+x \leq e^x$ for
  $x=(e^a-1)\mu$)} \label{eq:numerator}
\end{eqnarray}
For $a \in [0,\frac{1}{2}]$, we can upper bound $e^a$ by
$e^a \leq 1+a+a^2$. Plugging in this upper bound into
\eqref{eq:numerator} and the latter into \eqref{eq:prob}, we have that
\[ \Pr\left[ (\sum_{i=1}^s X_i) - \mu s \geq \epsilon s \right] 
\leq \exp\left( (a+a^2)\mu s - a(\mu+\epsilon)s \right)
\leq \exp( a(a-\epsilon)s ). \]
The latter expression is minimized for $a = \frac{\epsilon}{2} \in
[0,\frac{1}{2}]$, which gives us the upper bound stated in the
theorem. 
\end{proof}
Line (i) in Figure \ref{fig:two-sided} can be rederived from
Theorem \ref{thm:Hoeffding} by setting $\epsilon = \eta$.

Note the critical role independence plays in the proof of Theorem
\ref{thm:Hoeffding}. Such independence does not hold when the $X_i$
are obtained from a random walk in a low-degree graph. However, if the
underlying graph is an expander, we are close enough to independence
that a similar result still holds. This leads to the so-called
Chernoff bound for expanders. We state a somewhat more general
version than Theorem \ref{thm:Hoeffding}, namely one where the
expected value does not have to be the same for every step. 
\begin{theorem}[Chernoff Bound for
  Expanders]\label{thm:Chernoff:expander} 
There exists a constant $b>0$ such that the following holds  for every
regular graph $G=(V,E)$. For $i \in [s]$, let $B_i \subseteq V$ and
$X_i \doteq I[\rho_i \in B_i]$, where $\rho_1, \rho_2, \ldots, \rho_s$
denotes a random walk of length $s-1$ on $G$. For every $\epsilon \in
[0,1]$ 
\[ \Pr\left[ (\sum_{i=1}^s X_i) - (\sum_{i=1}^s \Exp[X_i]) 
\geq \epsilon s \right] \leq
\exp\left(-b \cdot (1-\lambda(G)) \cdot \epsilon^2 s \right). \]
\end{theorem}
We refer to \cite{Gil98} for a proof, which consists of a combination
of the ingredients of the proof of Theorem \ref{thm:Hoeffding} and the 
linear-algebraic analysis from the previous section.

Note that, modulo the constant $b$, Theorem
\ref{thm:Chernoff:expander} generalizes Theorem \ref{thm:Hoeffding} as
for the complete graph $G$, $\lambda(G)=0$. Line (iii) in Figure
\ref{fig:two-sided} can be rederived using Theorem
\ref{thm:Chernoff:expander}. 

\bibliographystyle{alpha}
\bibliography{references}

\end{document}
