% Template based on:
% https://www.cs.columbia.edu/~djhsu/coms4774-s21/scribe.html

\documentclass[12pt]{article}

\usepackage{amscd}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{bbold}
\usepackage{bm}
\usepackage{colonequals}
\usepackage[dvips,letterpaper,margin=1in]{geometry}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{xcolor}

\usepackage{csquotes}
\MakeOuterQuote{"}

\definecolor{cblack}{rgb}{0,0,0}
\definecolor{cblue}{rgb}{0.121569,0.466667,0.705882}
\definecolor{corange}{rgb}{1.000000,0.498039,0.054902}
\definecolor{cgreen}{rgb}{0.172549,0.627451,0.172549}
\definecolor{cred}{rgb}{0.839216,0.152941,0.156863}
\definecolor{cpurple}{rgb}{0.580392,0.403922,0.741176}
\definecolor{cbrown}{rgb}{0.549020,0.337255,0.294118}
\definecolor{cpink}{rgb}{0.890196,0.466667,0.760784}
\definecolor{cgray}{rgb}{0.498039,0.498039,0.498039}

\usepackage{hyperref}
\hypersetup{
  linkcolor  = cblue,
  citecolor  = cgreen,
  urlcolor   = corange,
  colorlinks = true,
}

% Lecture information
\newcommand\coursename{CPSC 664, Spring 2023}
\newcommand\scribe{Tim Kunisky}
\newcommand\lecturer{Tim Kunisky}
\newcommand\lecturedate{January 17, 2023}
\newcommand\lecturetitle{Lecture 1: Phase transition in random integer partitioning}

% Define theorem environments here.
\newtheorem{claim}{Claim}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{remark}[theorem]{Remark}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{question}[theorem]{Question}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{conjecture}[theorem]{Conjecture}

% Some of my macros
\renewcommand{\AA}{\mathbb{A}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\DD}{\mathbb{D}}
\newcommand{\EE}{\mathbb{E}}
\newcommand{\FF}{\mathbb{F}}
\newcommand{\HH}{\mathbb{H}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\renewcommand{\SS}{\mathbb{S}}
\newcommand{\ZZ}{\mathbb{Z}}
\DeclareSymbolFont{bbold}{U}{bbold}{m}{n}
\DeclareSymbolFontAlphabet{\mathbbold}{bbold}
\newcommand{\One}{\mathbbold{1}}

\newcommand{\ba}{\bm a}
\newcommand{\bb}{\bm b}
\newcommand{\bc}{\bm c}
\newcommand{\bd}{\bm d}
\newcommand{\be}{\bm e}
\newcommand{\bg}{\bm g}
\newcommand{\bh}{\bm h}
\newcommand{\bi}{\bm i}
\newcommand{\bj}{\bm j}
\newcommand{\bk}{\bm k}
\newcommand{\bbm}{\bm m}
\newcommand{\bp}{\bm p}
\newcommand{\bq}{\bm q}
\newcommand{\br}{\bm r}
\newcommand{\bs}{\bm s}
\newcommand{\bt}{\bm t}
\newcommand{\bu}{\bm u}
\newcommand{\bv}{\bm v}
\newcommand{\bw}{\bm w}
\newcommand{\bx}{\bm x}
\newcommand{\by}{\bm y}
\newcommand{\bz}{\bm z}

\newcommand{\bA}{\bm A}
\newcommand{\bB}{\bm B}
\newcommand{\bC}{\bm C}
\newcommand{\bD}{\bm D}
\newcommand{\bE}{\bm E}
\newcommand{\bF}{\bm F}
\newcommand{\bG}{\bm G}
\newcommand{\bH}{\bm H}
\newcommand{\bI}{\bm I}
\newcommand{\bL}{\bm L}
\newcommand{\bM}{\bm M}
\newcommand{\bN}{\bm N}
\newcommand{\bP}{\bm P}
\newcommand{\bQ}{\bm Q}
\newcommand{\bR}{\bm R}
\newcommand{\bS}{\bm S}
\newcommand{\bT}{\bm T}
\newcommand{\bU}{\bm U}
\newcommand{\bV}{\bm V}
\newcommand{\bW}{\bm W}
\newcommand{\bX}{\bm X}
\newcommand{\bY}{\bm Y}
\newcommand{\bZ}{\bm Z}

\newcommand{\zero}{\bm{0}}
\newcommand{\one}{\bm{1}}

\newcommand{\sA}{\mathcal{A}}
\newcommand{\sB}{\mathcal{B}}
\newcommand{\sC}{\mathcal{C}}
\newcommand{\sD}{\mathcal{D}}
\newcommand{\sE}{\mathcal{E}}
\newcommand{\sF}{\mathcal{F}}
\newcommand{\sG}{\mathcal{G}}
\newcommand{\sH}{\mathcal{H}}
\newcommand{\sI}{\mathcal{I}}
\newcommand{\sJ}{\mathcal{J}}
\newcommand{\sK}{\mathcal{K}}
\newcommand{\sL}{\mathcal{L}}
\newcommand{\sM}{\mathcal{M}}
\newcommand{\sN}{\mathcal{N}}
\newcommand{\sO}{\mathcal{O}}
\newcommand{\sP}{\mathcal{P}}
\newcommand{\sQ}{\mathcal{Q}}
\newcommand{\sR}{\mathcal{R}}
\newcommand{\sS}{\mathcal{S}}
\newcommand{\sT}{\mathcal{T}}
\newcommand{\sU}{\mathcal{U}}
\newcommand{\sV}{\mathcal{V}}
\newcommand{\sX}{\mathcal{X}}
\newcommand{\sY}{\mathcal{Y}}

\newcommand{\fB}{\mathscr{B}}
\newcommand{\fC}{\mathscr{C}}
\newcommand{\fE}{\mathscr{E}}
\newcommand{\fH}{\mathscr{H}}
\newcommand{\fI}{\mathscr{I}}
\newcommand{\fP}{\mathscr{P}}
\newcommand{\fV}{\mathscr{V}}

\DeclareSymbolFont{sfoperators}{OT1}{cmss}{m}{n}
% don't waste a math group
\DeclareSymbolFontAlphabet{\mathsf}{sfoperators}
% tell LaTeX to use sfoperators for names of operators
\makeatletter
\renewcommand{\operator@font}{\mathgroup\symsfoperators}
\makeatother

\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator{\GOE}{GOE}
\DeclareMathOperator{\sym}{sym}
\DeclareMathOperator{\Part}{Part}
\DeclareMathOperator{\poly}{poly}
\DeclareMathOperator{\Unif}{Unif}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\obj}{obj}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\sgn}{sgn}

\renewcommand\Re{\operatorname{Re}}
\renewcommand\Im{\operatorname{Im}}
% These put symbols below.
\newcommand{\Px}{\mathop{\mathbb{P}}}
\newcommand{\Ex}{\mathop{\mathbb{E}}}
\newcommand{\Varx}{\mathop{\mathsf{Var}}}

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}

%
% Put your custom macros here if you want.
%

\begin{filecontents}{2023-01-17.bib}
@book{MM-2011-NatureOfComputation,
  title={The nature of computation},
  author={Moore, Cristopher and Mertens, Stephan},
  year={2011},
  publisher={OUP Oxford}
}

@book{Durrett-2019-ProbabilityTheoryExamples,
  title={Probability: theory and examples},
  author={Durrett, Rick},
  volume={49},
  year={2019},
  publisher={Cambridge University Press}
}
\end{filecontents}

\begin{document}

% This creates the header for scribe notes.
\noindent \coursename \hfill Scribe: \scribe \\
\lecturedate \hfill Lecturer: \lecturer
\vspace{1em}

\hrule

\vspace{1.5em}
\begin{center}
  {\Large\lecturetitle}
\end{center}

\section{Problem statement}

The first average-case problem we will study, to start getting used to using moment methods to extract information about optimization landscapes, is the \emph{integer partitioning} problem.
In general, the problem statement is as follows.

\begin{itemize}
\item \textbf{Input:} $a_1, \dots, a_n \in \NN$.\footnote{For us, $\NN = \ZZ_{\geq 0} = \{0, 1, 2, \dots\}$.}
\item \textbf{Problem:} Find a set $A \subseteq [n] \colonequals \{1, \dots, n\}$ so that $\sum_{j \in A} a_j = \sum_{j \notin A}$. Or, a little more generally, solve the optimization problem
    \begin{equation}
        \label{eq:int-part-opt}
        \begin{array}{ll} \text{minimize} & |\sum_{j \in A} a_j - \sum_{j \notin A} a_j| \\
          \text{subject to} & A \subseteq [n]. \end{array}
    \end{equation}
\end{itemize}

This is a classical computational problem (similar to things like \emph{knapsack problems} that you may be more familiar with) that is NP-hard in the worst case.
Here, we will ask about the \emph{average-case} computational complexity of this problem.
That means we will take the $a_j$ to be \emph{random} and try to determine whether there are efficient algorithms that typically solve integer partitioning effectively over a particular distribution of inputs.
We will fix some $B \in \NN$, and consider the distribution
\begin{equation}
    a_1, \dots, a_n \stackrel{\text{iid}}{\sim} \Unif(\{0, 1, \dots, B - 1\}).
\end{equation}

The question we are most interested in is the \emph{algorithmic} question of whether the optimizer $A^{\star}$ of \eqref{eq:int-part-opt} is easy to find or approximate.
But, we will start out thinking about the simpler \emph{combinatorial} (or, thinking of this problem as an optimization landscape over the $n$-dimensional hypercube identified with subsets $A \subseteq [n]$, more on which below, \emph{geometric}) question of when there exist \emph{perfect} partitions with $\sum_{j \in A} a_j = \sum_{j \notin A} a_j$, and more generally of what the value (just some random integer) of the optimization problem \eqref{eq:int-part-opt} typically is.

\section{First moment method}

Let us first focus on the most specific problem of determining for which sequences of the parameters $(n, B)$ perfect partitions exist or do not exist with high probability.\footnote{A sequence of events happens \emph{with high probability} if their probability tends to 1.}
Intuitively, it should be clear that it becomes less likely for perfect partitions to exist as $B$ gets larger, since this requires an increasingly ``special'' cancellation to happen among the $a_j$ (think about, for example, comparing $B = 2$ and $B = 100$).
So, we will view $B = B(n)$, and will try to identify the \emph{critical scaling} of $B$ as a function of $n$ around which we switch from typically having perfect partitions to typically not having them.

As a side note, to prepare for our calculations, let us identify $A \subseteq [n]$ with $\bx \in \{\pm 1\}^n$ so that $x_j = 1$ if $j \in A$ and $x_j = -1$ if $j \notin A$.
Then, our question is the same as whether there exists $\bx \in \{ \pm 1\}^n$ such that
\begin{equation}
    \langle \bx, \ba \rangle = \sum_{j = 1}^n x_j a_j = 0.
\end{equation}

A basic idea for starting to do this is to \emph{count} the number of perfect partitions:
\begin{equation}
    Z \colonequals \#\bigg\{ \bx \in \{\pm 1\}^n: \langle \bx, \ba \rangle = 0 \bigg\}.
\end{equation}
This is a random variable, inheriting its randomness from the randomness in the $a_j$.
We are interested in whether $Z = 0$ with high probability or $Z \geq 1$ with high probability.
It turns out that we can sometimes establish the former just by calculating the \emph{expectation} of $Z$, which is usually much easier than establishing the entire distribution of $Z$.
\begin{proposition}[Basic first moment method]
    \label{prop:1mm}
    Suppose $Z_n \in \NN$ is a sequence of random variables, and $\EE Z_n \to 0$.
    Then, $Z_n = 0$ with high probability (i.e., $\PP[Z_n = 0] \to 1$).
\end{proposition}
\begin{proof}
    Using Markov's inequality,
    \begin{equation}
        \PP[Z_n \neq 0] = \PP[Z_n \geq 1] \leq \frac{\EE Z_n}{1} = \EE Z_n \to 0
    \end{equation}
    by the assumption.
\end{proof}
\noindent
We will see that it is \emph{not} always reasonable to hope for the converse, that if $\EE Z$ is large enough then $Z \geq 1$ with high probability.
But, let us proceed optimistically and see what a heuristic calculation of our $\EE Z$ leads us to predict.

\section{Heuristic threshold derivation}
\label{sec:heuristic-threshold}

We start with a standard manipulation of such expectations:
\begin{align*}
  \EE Z
  &= \EE \sum_{\bx \in \{\pm 1\}^n} \One\{ \langle \bx, \ba \rangle = 0 \} \\
  &= \sum_{\bx \in \{\pm 1\}^n} \EE [\One\{ \langle \bx, \ba \rangle = 0 \}] \\
  &= \sum_{\bx \in \{\pm 1\}^n} \PP [\langle \bx, \ba \rangle = 0]. \numberthis
\end{align*}

We will see more precise ways to calculate these probabilities later, but for now let us give a heuristic derivation (taken from Section 14.5 of \cite{MM-2011-NatureOfComputation}, along with lots of our discussion here).
Let
\begin{equation}
    b \colonequals \log_2 B,
\end{equation}
the number of bits needed to specify a number in $\{0, 1, \dots, B - 1\}$.
Now, consider writing out each $a_j$ in binary.
Then, our random model of the $a_j$ is realized by taking each of $b$ bits in each $a_j$ to be drawn from $\Unif(\{0, 1\})$.
Consider now calculating $\langle \bx, \ba \rangle = \sum_{j = 1}^n x_j a_j$ in binary.
The number of bits in the output will be roughly
\begin{equation}
    \log_2\big(|\langle \bx, \ba \rangle| \big) \approx \log_2\left(B \cdot \left|\sum_{j = 1}^n x_j \right|\right) = b + \log_2\left(\left|\sum_{j = 1}^n x_j \right|\right).
\end{equation}

Note that the least significant $b$ of these bits are distributed i.i.d.\ as $\Unif(\{0, 1\})$, as they are just $\mathsf{XOR}$'s of $n$ bits distributed i.i.d.\ as $\Unif(\{0, 1\})$, possibly further $\mathsf{XOR}$'d with bits carried from less significant ``columns'' of the summation.
Once we consider bits beyond the $b$th place, this will no longer hold, since now we are just adding carried bits from the less significant places of the summation.
(It may help to consult Figure~\ref{fig:binary-sum}.)

\begin{figure}
    \label{fig:binary-sum}
\begin{center}
\begin{tabular}{llllclllclll}
  & & & & 1 & 0 & 0 & 1 & $\cdots$ & 0 & 1 & $\cdot \,\,\,\,\, x_1$ \\
  & & & & 0 & 0 & 1 & 0 & $\cdots$ & 1 & 1 & $\cdot \,\,\,\,\, x_2$ \\
  & & & & $\vdots$ & & & & $\vdots$ & & & $\,\,\,\,\,\,\,\,\,\vdots$ \\
  & & & & 0 & 0 & 1 & 0 & $\cdots$ & 1 & 1 & $\cdot \,\,\,\,\, x_n$ \\[0.5em]
  \hline \\[-0.5em]
  1 & 0 & 0 & $\cdots$ & 0 & 1 & 0 & 0 & $\cdots$ & 0 & 0 & $= \,\,\,\, \sum_{j = 1}^n x_ja_j$
\end{tabular}
\end{center}
\vspace{-1em}
\caption{A schematic illustration of the calculation of $\sum_{j = 1}^n x_ja_j$ in binary that is  discussed in Section~\ref{sec:heuristic-threshold}.}
\end{figure}

But, let us make the heuristic leap that \emph{all} of the bits in $\sum_{j = 1}^n x_ja_j$ may be viewed as i.i.d.\ random variables drawn from $\Unif(\{0, 1\})$.
Then, we would predict:
\begin{align*}
  \PP[\langle \bx, \ba \rangle = 0]
  &\approx \left(\frac{1}{2}\right)^{b + \log_2(|\sum_{j = 1}^n x_j|)} \\
  &= \frac{1}{B|\sum_{j = 1}^n x_j|}.
\end{align*}
Finally, recall that for most $\bx \in \{\pm 1\}^n$, say, all but any small fraction, we have $|\sum_{j = 1}^n x_j| = \Theta(\sqrt{n})$.
This may be viewed as a standard observation about the magnitude of simple random walks on the integers after $n$ steps, or as the special case of the central limit theorem sometimes called the de Moivre--Laplace theorem.
You should ideally be familiar with these ideas already, but in case not, Section 3.1 of \cite{Durrett-2019-ProbabilityTheoryExamples}, which you can find online, gives a good treatment.

Combining our calculations, we are led to the following prediction.
\begin{conjecture}
    \label{conj:EZ}
    $\EE Z = \Theta(2^n / B \sqrt{n}) = \Theta(2^{n - \log_2n / 2 - b})$.
\end{conjecture}

Using the first moment method and trusting that its converse might hold as well, we can also conjecture the following.
\begin{conjecture}
    \label{conj:threshold}
    Suppose $B = B(n)$.
    Let us write
    \begin{equation}
        B^* = B^*(n) = \frac{2^n}{\sqrt{n}}.
    \end{equation}
    Then:
    \begin{itemize}
    \item If $B / B^* \to \infty$, then with high probability there do \emph{not} exist perfect partitions of $a_1, \dots, a_n$.
    \item If $B / B^* \to 0$, then with high probability there exist perfect partitions of $a_1, \dots, a_n$.
    \end{itemize}
\end{conjecture}
\noindent
Note that the first claim would follow from Conjecture~\ref{conj:EZ} together with Proposition~\ref{prop:1mm}, while we do not yet have tools from which the second claim would follow.

Perhaps surprisingly, one can do numerical experiments and confirm that this conjecture appears to be true, despite our quite sloppy reasoning above!
In particular, even the $\sqrt{n}$ term which came from maybe the most questionable one of our sequence of approximations appears to be the correct scaling.
In the next lecture, we will perform a first moment calculation more carefully to verify Conjecture~\ref{conj:EZ}, and will introduce the \emph{second moment method} for proving the second claim of Conjecture~\ref{conj:threshold}.

\bibliographystyle{alpha}
\bibliography{2023-01-17}

\end{document}
