\documentclass[12pt,letterpaper]{article}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{upquote}
\usepackage[margin=1.4in]{geometry}

\newcommand{\eps}{\epsilon}
\newcommand{\wh}{\widehat}
\newcommand{\R}{\mathbb{R}}
\newcommand{\norm}[1]{\|#1\|}
\newcommand{\abs}[1]{|#1|}
\DeclareMathOperator*{\E}{\mathbb{E}}
\DeclareMathOperator{\poly}{poly}
\DeclareMathOperator*{\mean}{mean}
\DeclareMathOperator*{\median}{median}

\title{Problem Set 10}
\author{Randomized Algorithms}
\date{Due Friday, November 15}
\begin{document}
\maketitle

\begin{enumerate}
  % Streaming algorithms?  Bloom filters?
\item Recall the Bloom filter for approximate set membership: to store
  a set of $n$ items, you create a bit array of length $m$, and each
  item sets $k$ random locations to $1$.  We showed in class that if
  $k \approx \frac{m}{n}\ln 2$ and
  $m \approx \frac{1}{\ln 2} n \log_2 (1/\delta)$ then this has no
  false negatives and a $\delta$ chance of a false positive.

  Now suppose there are \emph{two} sets of size $n$, $A$ and $B$, that
  are stored in Bloom filters with the same hash function $h$.  Let
  $x_A$ and $x_B$ be the corresponding bit arrays, and consider the
  bitwise AND of the two Bloom filters, $y = x_A \& x_B$.

  % XXX rework to be more false-discovery--like
  \begin{enumerate}
  \item Explain how to use $y$ to estimate membership of $A \cap B$.
    What are the false positive and false negative rates, in terms of
    $n, m, k$, and $\abs{A \cap B}$, for elements (1) in $A \cap B$,
    (2) in $A \setminus B$, and (3) outside of $A \cup B$?
  \item Now optimize $k$ to make the error rates on elements outside
    of $A \cup B$ as small as possible, for a fixed $n$ and $m$ (and
    for the worst case $\abs{A \cap B}$).  [Feel free to ignore issues
    of integrality and lower order terms.]
  \item What is the resulting $m$ in terms of $n$ and $\delta$?
    Compare this to regular Bloom filters.
  \item What is the expected number of $1$s in $x_A$ and $y$, with the
    parameters you have produced?  Compare this to the standard Bloom
    filter parameter setting.
  \item Go through the same argument for using the bitwise OR
    $x_A | x_B$ to estimate $A \cup B$.
  \end{enumerate}

  
  % maybe defer this one till next week:
% \item You are given a set of vectors $V = v_1, \dotsc, v_m \in \R^n$,
%   with all coordinates nonnegative.  The goal of this problem is to
%   ``sparsify'' these vectors: construct $w_1, \dotsc, w_k \in \R$ and
%   $u_1, \dotsc, u_k \in V$ such that
%   \[
%   \overline{u} := \sum_{i=1}^k w_i u_i
%   \]
%   and
%   \[
%   \overline{v} := \sum_{i=1}^m v_i
%   \]
%   satisfy
%   \begin{align}
%     \overline{u}_j = (1 \pm \eps)\overline{v}_j \qquad\qquad\forall j.\label{eq:1}
%   \end{align}

%   We would like to solve this using the random sampling techniques
%   developed in class: choose a probability distribution $p_1, \dotsc,
%   p_m \in \R$, and draw $k$ independent samples $(w, u) = (\frac{1}{kp_j},
%   v_j)$ for $j \sim p$.
%   \begin{enumerate}
%   \item For any particular choice of $V$ and $p$, apply the Chernoff
%     bound to get a bound for the $k$ required for~\eqref{eq:1}.  The
%     bound will depend on $V$ and $p$.
%   \item Now try to optimize $p$.  Show for all $V$ and constant
%     $\eps$, there exists a setting of $p$ such that $k = O(n \log n)$
%     suffices.  What is the dependence on $\eps$?
%   \item For many inputs $V$, your result should work with many fewer
%     samples (e.g., $k \ll n$).  When does this happen?  Give a
%     data-dependent bound for the necessary $k$ as a function of $V$.
%   \item (Optional) Show a different, deterministic, algorithm that
%     uses $k = n$ for all $V$.
%   \end{enumerate}
\end{enumerate}

\end{document}
