$\require{mathtools} % %%% GENERIC MATH %%% % % Environments \newcommand{\al}[1]{\begin{align}#1\end{align}} % need this for \tag{} to work \renewcommand{\r}{\mathrm} % % Greek \newcommand{\eps}{\epsilon} \newcommand{\veps}{\varepsilon} \let\fi\phi % because it looks like an f \let\phi\varphi % because it looks like a p % % Miscellaneous shortcuts % .. over and under \newcommand{\ss}[1]{_{\substack{#1}}} \newcommand{\ob}{\overbrace} \newcommand{\ub}{\underbrace} \newcommand{\ol}{\overline} \newcommand{\tld}{\widetilde} \newcommand{\HAT}{\widehat} \newcommand{\f}{\frac} \newcommand{\s}[2]{#1 /\mathopen{}#2} \newcommand{\rt}{\sqrt} % .. relations \newcommand{\sr}{\stackrel} \newcommand{\sse}{\subseteq} \newcommand{\ce}{\coloneqq} \newcommand{\ec}{\eqqcolon} \newcommand{\ap}{\approx} \newcommand{\ls}{\lesssim} \newcommand{\gs}{\greatersim} % .. miscer \newcommand{\q}{\quad} \newcommand{\qq}{\qquad} \newcommand{\heart}{\heartsuit} % % Delimiters % (I needed to create my own because the MathJax version of \DeclarePairedDelimiter doesn't have \mathopen{} and that messes up the spacing) % .. one-part \newcommand{\p}[1]{\mathopen{}\left( #1 \right)} \newcommand{\b}[1]{\mathopen{}\left[ #1 \right]} \newcommand{\set}[1]{\mathopen{}\left\{ #1 \right\}} \newcommand{\abs}[1]{\mathopen{}\left\lvert #1 \right\rvert} \newcommand{\floor}[1]{\mathopen{}\left\lfloor #1 \right\rfloor} \newcommand{\ceil}[1]{\mathopen{}\left\lceil #1 \right\rceil} \newcommand{\inner}[1]{\mathopen{}\left\langle #1 \right\rangle} % .... (use phantom to force at least the standard height of double bars) \newcommand{\norm}[1]{\mathopen{}\left\lVert #1 \vphantom{f} \right\rVert} \newcommand{\frob}[1]{\norm{#1}_\mathrm{F}} %% .. two-part \newcommand{\incond}[2]{#1 \mathop{}\middle|\mathop{} #2} \newcommand{\cond}[2]{ {\left.\incond{#1}{#2}\right.}} \newcommand{\pco}[2]{\p{\incond{#1}{#2}}} \newcommand{\bco}[2]{\b{\incond{#1}{#2}}} \newcommand{\setco}[2]{\set{\incond{#1}{#2}}} \newcommand{\at}[2]{\left.#1\right|_{#2}} % ..... (use phantom to force at least the standard height of double bar) \newcommand{\oldpara}[2]{#1\vphantom{f} \mathop{}\middle\|\mathop{} #2} %\newcommand{\para}[2]{#1\vphantom{f} \mathop{}\middle\|\mathop{} #2} \newcommand{\para}[2]{\mathchoice{\begin{matrix}#1\\\hdashline#2\end{matrix}}{\begin{smallmatrix}#1\\\hdashline#2\end{smallmatrix}}{\begin{smallmatrix}#1\\\hdashline#2\end{smallmatrix}}{\begin{smallmatrix}#1\\\hdashline#2\end{smallmatrix}}} \newcommand{\ppa}[2]{\p{\para{#1}{#2}}} \newcommand{\bpa}[2]{\b{\para{#1}{#2}}} %\newcommand{\bpaco}[4]{\bpa{\incond{#1}{#2}}{\incond{#3}{#4}}} \newcommand{\bpaco}[4]{\bpa{\cond{#1}{#2}}{\cond{#3}{#4}}} % % Levels of closeness \newcommand{\scirc}[1]{\sr{\circ}{#1}} \newcommand{\sdot}[1]{\sr{.}{#1}} \newcommand{\slog}[1]{\sr{\log}{#1}} \newcommand{\createClosenessLevels}[7]{ \newcommand{#2}{\mathrel{(#1)}} \newcommand{#3}{\mathrel{#1}} \newcommand{#4}{\mathrel{#1\!\!#1}} \newcommand{#5}{\mathrel{#1\!\!#1\!\!#1}} \newcommand{#6}{\mathrel{(\sdot{#1})}} \newcommand{#7}{\mathrel{(\slog{#1})}} } \let\lt\undefined \let\gt\undefined % .. vanilla versions (is it within a constant?) \newcommand{\ez}{\scirc=} \newcommand{\eq}{\simeq} \newcommand{\eqq}{\mathrel{\eq\!\!\eq}} \newcommand{\eqqq}{\mathrel{\eq\!\!\eq\!\!\eq}} \newcommand{\lez}{\scirc\le} \newcommand{\lq}{\preceq} \newcommand{\lqq}{\mathrel{\lq\!\!\lq}} \newcommand{\lqqq}{\mathrel{\lq\!\!\lq\!\!\lq}} \newcommand{\gez}{\scirc\ge} \newcommand{\gq}{\succeq} \newcommand{\gqq}{\mathrel{\gq\!\!\gq}} \newcommand{\gqqq}{\mathrel{\gq\!\!\gq\!\!\gq}} \newcommand{\lz}{\scirc<} \newcommand{\lt}{\prec} \newcommand{\ltt}{\mathrel{\lt\!\!\lt}} \newcommand{\lttt}{\mathrel{\lt\!\!\lt\!\!\lt}} \newcommand{\gz}{\scirc>} \newcommand{\gt}{\succ} \newcommand{\gtt}{\mathrel{\gt\!\!\gt}} \newcommand{\gttt}{\mathrel{\gt\!\!\gt\!\!\gt}} % .. dotted versions (is it equal in the limit?) \newcommand{\ed}{\sdot=} \newcommand{\eqd}{\sdot\eq} \newcommand{\eqqd}{\sdot\eqq} \newcommand{\eqqqd}{\sdot\eqqq} \newcommand{\led}{\sdot\le} \newcommand{\lqd}{\sdot\lq} \newcommand{\lqqd}{\sdot\lqq} \newcommand{\lqqqd}{\sdot\lqqq} \newcommand{\ged}{\sdot\ge} \newcommand{\gqd}{\sdot\gq} \newcommand{\gqqd}{\sdot\gqq} \newcommand{\gqqqd}{\sdot\gqqq} \newcommand{\ld}{\sdot<} \newcommand{\ltd}{\sdot\lt} \newcommand{\lttd}{\sdot\ltt} \newcommand{\ltttd}{\sdot\lttt} \newcommand{\gd}{\sdot>} \newcommand{\gtd}{\sdot\gt} \newcommand{\gttd}{\sdot\gtt} \newcommand{\gtttd}{\sdot\gttt} % .. log versions (is it equal up to log?) \newcommand{\elog}{\slog=} \newcommand{\eqlog}{\slog\eq} \newcommand{\eqqlog}{\slog\eqq} \newcommand{\eqqqlog}{\slog\eqqq} \newcommand{\lelog}{\slog\le} \newcommand{\lqlog}{\slog\lq} \newcommand{\lqqlog}{\slog\lqq} \newcommand{\lqqqlog}{\slog\lqqq} \newcommand{\gelog}{\slog\ge} \newcommand{\gqlog}{\slog\gq} \newcommand{\gqqlog}{\slog\gqq} \newcommand{\gqqqlog}{\slog\gqqq} \newcommand{\llog}{\slog<} \newcommand{\ltlog}{\slog\lt} \newcommand{\lttlog}{\slog\ltt} \newcommand{\ltttlog}{\slog\lttt} \newcommand{\glog}{\slog>} \newcommand{\gtlog}{\slog\gt} \newcommand{\gttlog}{\slog\gtt} \newcommand{\gtttlog}{\slog\gttt} % % Miscellaneous \newcommand{\LHS}{\mathrm{LHS}} \newcommand{\RHS}{\mathrm{RHS}} % .. operators \DeclareMathOperator{\poly}{poly} \DeclareMathOperator{\polylog}{polylog} \DeclareMathOperator{\quasipoly}{quasipoly} \DeclareMathOperator{\negl}{negl} \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator*{\argmax}{arg\,max} % .. functions \DeclareMathOperator{\id}{id} \DeclareMathOperator{\sign}{sign} \DeclareMathOperator{\err}{err} \DeclareMathOperator{\ReLU}{ReLU} % .. analysis \let\d\undefined \newcommand{\d}{\operatorname{d}\mathopen{}} \newcommand{\df}[2]{\f{\d #1}{\d #2}} \newcommand{\ds}[2]{\s{\d #1}{\d #2}} \newcommand{\part}{\partial} \newcommand{\partf}[2]{\f{\part #1}{\part #2}} \newcommand{\parts}[2]{\s{\part #1}{\part #2}} \newcommand{\grad}[1]{\mathop{\nabla\!_{#1}}} % .. sets \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\C}{\mathbb{C}} \newcommand{\F}{\mathbb{F}} \newcommand{\zo}{\set{0,1}} \newcommand{\pmo}{\set{\pm 1}} % %%% SPECIALIZED MATH %%% % % Logic \renewcommand{\and}{\wedge} \newcommand{\AND}{\bigwedge} \newcommand{\or}{\vee} \newcommand{\OR}{\bigvee} \newcommand{\xor}{\oplus} \newcommand{\XOR}{\bigoplus} \newcommand{\union}{\cup} \newcommand{\inter}{\cap} \newcommand{\UNION}{\bigcup} \newcommand{\INTER}{\bigcap} \newcommand{\comp}{\overline} \newcommand{\true}{\r{true}} \newcommand{\false}{\r{false}} \newcommand{\tf}{\set{\true,\false}} \DeclareMathOperator{\One}{\mathbb{1}} \DeclareMathOperator{\1}{\mathbb{1}} % % Linear algebra \renewcommand{\span}{\mathrm{span}} \DeclareMathOperator{\rank}{rank} \DeclareMathOperator{\proj}{proj} \DeclareMathOperator{\dom}{dom} \DeclareMathOperator{\Img}{Im} \newcommand{\transp}{\mathsf{T}} \renewcommand{\t}{^\transp} % ... named tensors \newcommand{\namedtensorstrut}{\vphantom{fg}} % milder than \mathstrut \newcommand{\name}[1]{\mathsf{\namedtensorstrut #1}} \newcommand{\nbin}[2]{\mathbin{\underset{\substack{#1}}{\namedtensorstrut #2}}} \newcommand{\ndot}[1]{\nbin{#1}{\odot}} \newcommand{\ncat}[1]{\nbin{#1}{\oplus}} \newcommand{\nsum}[1]{\sum\limits_{\substack{#1}}} \newcommand{\nfun}[2]{\mathop{\underset{\substack{#1}}{\namedtensorstrut\mathrm{#2}}}} \newcommand{\ndef}[2]{\newcommand{#1}{\name{#2}}} \newcommand{\nt}[1]{^{\transp(#1)}} % % Probability \newcommand{\Normal}{\mathcal{N}} \let\Pr\undefined \DeclareMathOperator*{\Pr}{Pr} \DeclareMathOperator*{\G}{\mathbb{G}} \DeclareMathOperator*{\Odds}{Od} \DeclareMathOperator*{\E}{E} \DeclareMathOperator*{\Var}{Var} \DeclareMathOperator*{\Cov}{Cov} \DeclareMathOperator*{\corr}{corr} \DeclareMathOperator*{\median}{median} \newcommand{\dTV}{d_{\mathrm{TV}}} \newcommand{\dHel}{d_{\mathrm{Hel}}} \newcommand{\dJS}{d_{\mathrm{JS}}} % ... information theory \let\H\undefined \DeclareMathOperator*{\H}{H} \DeclareMathOperator*{\I}{I} \DeclareMathOperator*{\D}{D} % %%% SPECIALIZED COMPUTER SCIENCE %%% % % Complexity classes % .. classical \newcommand{\Poly}{\mathsf{P}} \newcommand{\NP}{\mathsf{NP}} \newcommand{\PH}{\mathsf{PH}} \newcommand{\PSPACE}{\mathsf{PSPACE}} \renewcommand{\L}{\mathsf{L}} % .. probabilistic \newcommand{\formost}{\mathsf{Я}} \newcommand{\RP}{\mathsf{RP}} \newcommand{\BPP}{\mathsf{BPP}} \newcommand{\MA}{\mathsf{MA}} \newcommand{\AM}{\mathsf{AM}} \newcommand{\IP}{\mathsf{IP}} \newcommand{\RL}{\mathsf{RL}} % .. circuits \newcommand{\NC}{\mathsf{NC}} \newcommand{\AC}{\mathsf{AC}} \newcommand{\ACC}{\mathsf{ACC}} \newcommand{\TC}{\mathsf{TC}} \newcommand{\Ppoly}{\mathsf{P}/\poly} \newcommand{\Lpoly}{\mathsf{L}/\poly} % .. resources \newcommand{\TIME}{\mathsf{TIME}} \newcommand{\SPACE}{\mathsf{SPACE}} \newcommand{\TISP}{\mathsf{TISP}} \newcommand{\SIZE}{\mathsf{SIZE}} % .. keywords \newcommand{\co}{\mathsf{co}} \newcommand{\Prom}{\mathsf{Promise}} % % Boolean analysis \newcommand{\harpoon}{\!\upharpoonright\!} \newcommand{\rr}[2]{#1\harpoon_{#2}} \newcommand{\Fou}[1]{\widehat{#1}} \DeclareMathOperator{\Ind}{\mathrm{Ind}} \DeclareMathOperator{\Inf}{\mathrm{Inf}} \DeclareMathOperator{\Der}{\mathrm{D}} \DeclareMathOperator{\Stab}{\mathrm{Stab}} \DeclareMathOperator{\T}{T} \DeclareMathOperator{\sens}{\mathrm{s}} \DeclareMathOperator{\bsens}{\mathrm{bs}} \DeclareMathOperator{\fbsens}{\mathrm{fbs}} \DeclareMathOperator{\Cert}{\mathrm{C}} \DeclareMathOperator{\DT}{\mathrm{DT}} \DeclareMathOperator{\CDT}{\mathrm{CDT}} % canonical \DeclareMathOperator{\ECDT}{\mathrm{ECDT}} \DeclareMathOperator{\CDTv}{\mathrm{CDT_{vars}}} \DeclareMathOperator{\ECDTv}{\mathrm{ECDT_{vars}}} \DeclareMathOperator{\CDTt}{\mathrm{CDT_{terms}}} \DeclareMathOperator{\ECDTt}{\mathrm{ECDT_{terms}}} \DeclareMathOperator{\CDTw}{\mathrm{CDT_{weighted}}} \DeclareMathOperator{\ECDTw}{\mathrm{ECDT_{weighted}}} \DeclareMathOperator{\AvgDT}{\mathrm{AvgDT}} \DeclareMathOperator{\PDT}{\mathrm{PDT}} % partial decision tree \DeclareMathOperator{\DTsize}{\mathrm{DT_{size}}} \DeclareMathOperator{\W}{\mathbf{W}} % .. functions (small caps sadly doesn't work) \DeclareMathOperator{\Par}{\mathrm{Par}} \DeclareMathOperator{\Maj}{\mathrm{Maj}} \DeclareMathOperator{\HW}{\mathrm{HW}} \DeclareMathOperator{\Th}{\mathrm{Th}} \DeclareMathOperator{\Tribes}{\mathrm{Tribes}} \DeclareMathOperator{\RotTribes}{\mathrm{RotTribes}} \DeclareMathOperator{\CycleRun}{\mathrm{CycleRun}} \DeclareMathOperator{\SAT}{\mathrm{SAT}} \DeclareMathOperator{\UniqueSAT}{\mathrm{UniqueSAT}} % % Dynamic optimality \newcommand{\OPT}{\mathsf{OPT}} \newcommand{\Alt}{\mathsf{Alt}} \newcommand{\Funnel}{\mathsf{Funnel}} % % Alignment \DeclareMathOperator{\Amp}{\mathrm{Amp}} % %%% TYPESETTING %%% % % In text \renewcommand{\th}{^{\mathrm{th}}} \newcommand{\degree}{^\circ} % % Fonts % .. bold \newcommand{\BA}{\boldsymbol{A}} \newcommand{\BB}{\boldsymbol{B}} \newcommand{\BC}{\boldsymbol{C}} \newcommand{\BD}{\boldsymbol{D}} \newcommand{\BE}{\boldsymbol{E}} \newcommand{\BF}{\boldsymbol{F}} \newcommand{\BG}{\boldsymbol{G}} \newcommand{\BH}{\boldsymbol{H}} \newcommand{\BI}{\boldsymbol{I}} \newcommand{\BJ}{\boldsymbol{J}} \newcommand{\BK}{\boldsymbol{K}} \newcommand{\BL}{\boldsymbol{L}} \newcommand{\BM}{\boldsymbol{M}} \newcommand{\BN}{\boldsymbol{N}} \newcommand{\BO}{\boldsymbol{O}} \newcommand{\BP}{\boldsymbol{P}} \newcommand{\BQ}{\boldsymbol{Q}} \newcommand{\BR}{\boldsymbol{R}} \newcommand{\BS}{\boldsymbol{S}} \newcommand{\BT}{\boldsymbol{T}} \newcommand{\BU}{\boldsymbol{U}} \newcommand{\BV}{\boldsymbol{V}} \newcommand{\BW}{\boldsymbol{W}} \newcommand{\BX}{\boldsymbol{X}} \newcommand{\BY}{\boldsymbol{Y}} \newcommand{\BZ}{\boldsymbol{Z}} \newcommand{\Ba}{\boldsymbol{a}} \newcommand{\Bb}{\boldsymbol{b}} \newcommand{\Bc}{\boldsymbol{c}} \newcommand{\Bd}{\boldsymbol{d}} \newcommand{\Be}{\boldsymbol{e}} \newcommand{\Bf}{\boldsymbol{f}} \newcommand{\Bg}{\boldsymbol{g}} \newcommand{\Bh}{\boldsymbol{h}} \newcommand{\Bi}{\boldsymbol{i}} \newcommand{\Bj}{\boldsymbol{j}} \newcommand{\Bk}{\boldsymbol{k}} \newcommand{\Bp}{\boldsymbol{p}} \newcommand{\Bq}{\boldsymbol{q}} \newcommand{\Br}{\boldsymbol{r}} \newcommand{\Bs}{\boldsymbol{s}} \newcommand{\Bt}{\boldsymbol{t}} \newcommand{\Bu}{\boldsymbol{u}} \newcommand{\Bv}{\boldsymbol{v}} \newcommand{\Bw}{\boldsymbol{w}} \newcommand{\Bx}{\boldsymbol{x}} \newcommand{\By}{\boldsymbol{y}} \newcommand{\Bz}{\boldsymbol{z}} \newcommand{\Balpha}{\boldsymbol{\alpha}} \newcommand{\Bbeta}{\boldsymbol{\beta}} \newcommand{\Bgamma}{\boldsymbol{\gamma}} \newcommand{\Bdelta}{\boldsymbol{\delta}} \newcommand{\Beps}{\boldsymbol{\eps}} \newcommand{\Bveps}{\boldsymbol{\veps}} \newcommand{\Bzeta}{\boldsymbol{\zeta}} \newcommand{\Beta}{\boldsymbol{\eta}} \newcommand{\Btheta}{\boldsymbol{\theta}} \newcommand{\Biota}{\boldsymbol{\iota}} \newcommand{\Bkappa}{\boldsymbol{\kappa}} \newcommand{\Blambda}{\boldsymbol{\lambda}} \newcommand{\Bmu}{\boldsymbol{\mu}} \newcommand{\Bnu}{\boldsymbol{\nu}} \newcommand{\Bxi}{\boldsymbol{\xi}} \newcommand{\Bomicron}{\boldsymbol{\omicron}} \newcommand{\Bpi}{\boldsymbol{\pi}} \newcommand{\Brho}{\boldsymbol{\rho}} \newcommand{\Bsigma}{\boldsymbol{\sigma}} \newcommand{\Btau}{\boldsymbol{\tau}} \newcommand{\Bupsilon}{\boldsymbol{\upsilon}} \newcommand{\Bphi}{\boldsymbol{\phi}} \newcommand{\Bfi}{\boldsymbol{\fi}} \newcommand{\Bchi}{\boldsymbol{\chi}} \newcommand{\Bpsi}{\boldsymbol{\psi}} \newcommand{\Bomega}{\boldsymbol{\omega}} % .. calligraphic \newcommand{\CA}{\mathcal{A}} \newcommand{\CB}{\mathcal{B}} \newcommand{\CC}{\mathcal{C}} \newcommand{\CD}{\mathcal{D}} \newcommand{\CE}{\mathcal{E}} \newcommand{\CF}{\mathcal{F}} \newcommand{\CG}{\mathcal{G}} \newcommand{\CH}{\mathcal{H}} \newcommand{\CI}{\mathcal{I}} \newcommand{\CJ}{\mathcal{J}} \newcommand{\CK}{\mathcal{K}} \newcommand{\CL}{\mathcal{L}} \newcommand{\CM}{\mathcal{M}} \newcommand{\CN}{\mathcal{N}} \newcommand{\CO}{\mathcal{O}} \newcommand{\CP}{\mathcal{P}} \newcommand{\CQ}{\mathcal{Q}} \newcommand{\CR}{\mathcal{R}} \newcommand{\CS}{\mathcal{S}} \newcommand{\CT}{\mathcal{T}} \newcommand{\CU}{\mathcal{U}} \newcommand{\CV}{\mathcal{V}} \newcommand{\CW}{\mathcal{W}} \newcommand{\CX}{\mathcal{X}} \newcommand{\CY}{\mathcal{Y}} \newcommand{\CZ}{\mathcal{Z}} % .. typewriter \newcommand{\TA}{\mathtt{A}} \newcommand{\TB}{\mathtt{B}} \newcommand{\TC}{\mathtt{C}} \newcommand{\TD}{\mathtt{D}} \newcommand{\TE}{\mathtt{E}} \newcommand{\TF}{\mathtt{F}} \newcommand{\TG}{\mathtt{G}} \newcommand{\TH}{\mathtt{H}} \newcommand{\TI}{\mathtt{I}} \newcommand{\TJ}{\mathtt{J}} \newcommand{\TK}{\mathtt{K}} \newcommand{\TL}{\mathtt{L}} \newcommand{\TM}{\mathtt{M}} \newcommand{\TN}{\mathtt{N}} \newcommand{\TO}{\mathtt{O}} \newcommand{\TP}{\mathtt{P}} \newcommand{\TQ}{\mathtt{Q}} \newcommand{\TR}{\mathtt{R}} \newcommand{\TS}{\mathtt{S}} \newcommand{\TT}{\mathtt{T}} \newcommand{\TU}{\mathtt{U}} \newcommand{\TV}{\mathtt{V}} \newcommand{\TW}{\mathtt{W}} \newcommand{\TX}{\mathtt{X}} \newcommand{\TY}{\mathtt{Y}} \newcommand{\TZ}{\mathtt{Z}}$

Miscellaneous facts from Ryan O’Donnell’s “TCS toolkit” class (and some more).

Asymptotic tricks

Harmonic numbers. $H_n \coloneqq \frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n} \sim \ln n$. In fact, $\ln(n+1) \leq H_n = \ln(n) + \gamma - O(\frac{1}{n})$ where $\gamma \approx 0.577$ is the Euler–Mascheroni constant.

Math of small things. For $0 \le \epsilon \le \f12$,1

  • $e^\epsilon, \frac{1}{1-\epsilon} = 1 + \epsilon + O(\epsilon^2)$ and $\leq 1+2\epsilon$;
  • $e^{-\epsilon}, \frac{1}{1+\epsilon} = 1 - \epsilon + O(\epsilon^2)$ and $\leq 1-\frac{\epsilon}{2}$;
  • $\ln(1+\epsilon) = \epsilon - O(\epsilon^2)$ and $\geq \frac{\epsilon}{2}$;
  • $\ln\p{\frac{1}{1-\epsilon}} = \epsilon + O(\epsilon^2)$ and $\leq 2\epsilon$;
  • $\sqrt{1+\epsilon} = 1 + \frac{\epsilon}{2} - O(\epsilon^2)$ and $\geq 1 + \frac{\epsilon}{3}$.

Sandwiching logs. For $t > 0$, $1-\f1t \le \log t \le t-1$.

Inverting $n \log n$. If $y = x\ln x$, then $x \sim \frac{y}{\ln y}$.

Birthday paradox. Let $p_{n,m}$ be the probability that $m$ balls thrown into $n$ bins don’t collide. Then

\[p_{n,m} = \exp\p{-\frac{n^2}{m}} \underbrace{\p{1+O\p{\frac{n}{m}}}}_\text{when $m \ll \sqrt{n}$} \underbrace{\p{1-O\p{\frac{n^3}{m^2}}}}_\text{when $m \gg \sqrt{n}$}.\]

If $m = \sqrt{2 \ln 2}\sqrt{n} \pm O(1)$, then $p_{n,m} = \frac{1}{2} \pm O\p{\frac{1}{\sqrt{m}}}$.

Factorials and binomial coefficients

Stirling’s formula. $n! = \sqrt{2\pi n}\p{\frac{n}{e}}^n\p{1\pm O\p{\frac{1}{n}}}$.

Small $k$. If $k = o(\sqrt{n})$, then $\binom{n}{k} \sim \frac{n^k}{k!} \sim \frac{\p{\frac{en}{k}}^k}{\sqrt{2\pi k}}$.

General. For $1 \leq k \leq n$, $\p{\frac{n}{k}}^k \leq \binom{n}{k} \leq \frac{n^k}{k!} \leq \p{\frac{en}{k}}^k$.

Logarithm. Thus $\ln\binom{n}{k} \sim k \ln\p{\frac{n}{k}}$. For example, $\ln\binom{n}{n^{.99}} = \Theta(n^{.99}\log n)$, but $\ln\binom{n}{.01n} = \Theta(n)$.

Constant fraction. More precisely, $\binom{n}{pn} \sim \frac{1}{\sqrt{2\pi pq}}\frac{1}{\sqrt{n}}\b{\p{\frac{1}{p}}^p \p{\frac{1}{q}}^q}^n = \frac{1}{\sqrt{2\pi pq}}\frac{1}{\sqrt{n}}2^{H_2(p)n}$, where $H_2(p) \coloneqq -p\log_2p - q \log_2q$ is the “binary entropy”. In particular,

  • the probability that exactly $\frac{n}{2}$ of $n$ unbiased coins turn up heads is $\binom{n}{n/2}2^{-n} \sim \sqrt{\frac{2}{\pi}} \frac{1}{\sqrt{n}}$;
  • when $p$ is small (but still constant in $n$), $H_2(p) = p \log_2 (2/p) - O(p^2)$.

#to-write explain how it’s part of the more general fact about KL and histograms

Hamming volume. Let $V(n,k) \coloneqq \binom{n}{0} + \cdots + \binom{n}{k}$ be the size of a Hamming ball of radius $k$. If $k = (1/2-\Omega(1))n$, then $V(n,k) = \Theta\p{\binom{n}{k}}$. In general, if $k\le \f n 2$ then $V(n,k) \le 2^{n H(k/n)}$.

Add $w$ dummies. $\sum_{i=0}^w \binom{n}{k-i} \leq \binom{n+w}{k}$.

Go down. $\frac{\binom{n+w}{k}}{\binom{n}{k}} \leq \p{\frac{n}{n-k}}^w$.

Go right. $\frac{\binom{n}{k+w}}{\binom{n}{k}} \leq \p{\frac{n-k-w}{k}}^w \leq \p{\frac{n}{k}}^w$.

Generating functions. $\sum_{k=0}^n \binom{n}{k}x^k = (1+x)^n$, and $\sum_{n=k}^\infty \binom{n}{k}y^n = \frac{y^k}{(1-y)^{k+1}}$.

Gaussians and CLT

Let $Z \sim \Normal(0,1)$.

Density. The pdf of $Z$ is $\fi(u) \coloneqq \frac{1}{\sqrt{2\pi}}e^{-u^2/2}$.

Cumulative. For $u \geq 0$, $\p{\frac{1}{u}-\frac{1}{u^3}}\fi(u) \leq \Pr[Z \geq u] \leq \frac{1}{u}\fi(u)$. Also, $\Pr[|Z| \geq u] \leq e^{-u^2/2}$ (better for small $u$).

Berry-Esseen theorem. Let $X_1,\ldots,X_n$ be independent with $\E[X_i]=0$ and $\sum_i\Var[X_i] = 1$. Then

\[\bigl|\Pr[X_1 + \cdots + X_n \geq u] - \Pr[Z \geq u]\bigr| \leq \sum_i \E\b{|X_i|^3}.\]

In particular, if $X_1,\ldots,X_n$ are i.i.d. with mean $0$ and variance $1$ each, then2

\[ \abs{\Pr\b{X_1 + \cdots + X_n \geq u\sqrt{n}} - \Pr[Z \geq u]} \leq O\p{\frac{1}{\sqrt{n}}}. \]

Above $u \approx \sqrt{\log n}$, $\Pr[Z \geq u]$ falls below $1/\sqrt{n}$, so you should start using Hoeffding instead.

Large-deviation bounds

Markov. If $X \geq 0$, then $\Pr[X \geq k\E[X]] \leq 1/k$.

Markov’s converse. If $0 \leq X \leq 1$, then $\Pr[X \leq \epsilon/2] \leq \epsilon/2$.

Chebyshev. Let $\mu \ce \E[X]$ and $\sigma^2 \ce \Var[X]$, then $\Pr[|X-\mu| \geq t\sigma] \leq 1/t^2$.

Hoeffding (additive). Let $X_1,\ldots,X_m$ be independent with $0 \leq X_i \leq 1$. Let $X \ce X_1+\cdots + X_n$ and $\mu \ce \E[X]$. Then

\[ \Pr\b{|X-\mu| \geq u\sqrt{n}} \leq 2\cdot \exp\p{-2u^2}, \]

or equivalently,

\[\Pr\b{\abs{X-\mu} \geq \eps n} \leq 2\cdot \exp(-2\eps^2n).\]

In particular, the sample mean of a Bernoulli is accurate to $\pm \eps$ except with that probability. (If your variables have very different ranges/variances then the version in Hoeffding bound might be more suitable?)

Chernoff (multiplicative). Under the same assumptions

  • When $\eps \in [0,1]$, $\Pr[X \not\in (1\pm\epsilon)\mu] \leq 2\cdot \exp\p{-\frac{\epsilon^2\mu}{3}}$.
  • when $\eps>1$, $\Pr[X \geq (1+\eps)\mu] \leq \exp\p{-\frac{\eps\mu}{3}}$.3

Chernoff when you don’t know the mean. Say all you know is $\mu \leq \mu_\mathrm{U}$, then surprisingly you can still say $\Pr[X \geq (1+\epsilon)\mu_\mathrm{U}] \leq \exp\p{-\frac{\epsilon^2\mu_\mathrm{U}}{3}}$.

Note: If your variables are “negatively correlated”, or if the aggregate function isn’t a sum but another function with nice Lipschitzness, then Chernoff-like bounds exist too.

Sampling theorem. Let $0 \leq X \leq 1$ with $\E[X]=\mu$, and let $\hat{\mu}$ be the average of $m$ i.i.d. copies of $X$. Then for any $0 < \epsilon,\delta < 1$, if $m \geq \frac{3\ln(1/\delta)}{\epsilon^2}$, then $\Pr[|\hat{\mu}- \mu| > \epsilon] \leq \delta$.

Fields and polynomials

Finite fields. The size of a finite field is either a prime (e.g. $\Z_p$) or a power of primes (e.g. quotients of $\Z_p[X]$), and they’re all the same up to isomorphism. One can construct and work in $\F_q$ in $\polylog(q)$ time.

Note: For more details on how to find them, see Lectures 10b and 10c.

Prime number theorem. The fraction of $n$-bit numbers that are prime is $\sim \frac{1}{\ln n}$ (see Density of primes for cute but untight arguments).

Finding irreducibles. If $P \in \F_q[X]$ is a uniformly random polynomial of degree $d$, then <div>[\Pr[\text{$P$ is irreducible}] \in \b{\frac{1}{2d}, \frac{1}{d}}.]</div> Reduced polynomials. For any $x \in \F_q$, $x^q = x$. Accordingly, we say a multivariate polynomial is reduced if no variable is taken to a power greater than $q-1$.4 Reduced polynomials uniquely represent functions $f : \F_q^n \to \F_q$.

Schwartz-Zippel. Let $P \in \F_q[X_1,\ldots,X_n]$ be a nonzero reduced polynomial with total degree $\leq d$, and let $\alpha_1, \ldots, \alpha_n$ be drawn uniformly and independently from $S \subseteq \F_q$. Then $\Pr[P(\alpha_1, \ldots, \alpha_n) = 0] \leq \frac{d}{|S|}$. Also, if $q=2$ and $S=\F_2$, $\Pr[P(\alpha_1, \ldots, \alpha_n) = 0] \leq 1-1/2^d$.

Note: An expression for general $q$ and $d$ (e.g. $q=3$) is given in Lecture 10e.

Inequalities

$p$-distances and $p$-means. For $0<p<q$, $\norm{x}_p \geq \norm{x}_q$ but $\norm{x}_p \leq n^{\frac{1}{p}-\frac{1}{q}} \norm{x}_q$. (See p-norms.)

Bonferroni inequalities. In inclusion-exclusion, when you stop at intersections of $k$ sets, if $k$ is odd it’s an upper bound ($k=1$ is the union bound), and if $k$ is even it’s a lower bound. Equivalently, $\sum_{i=0}^k (-1)^i\binom{n}{i} \leq 0$ for $k$ odd and $\geq 0$ for $k$ even.

  1. This condition is only needed for the inequalities; the asymptotic expressions work for any value of $\eps$ that doesn’t go out of the domain of corresponding functions. 

  2. the constant in the $O(\cdot)$ is $\E[|X_1|^3]$ 

  3. Actually I think this is not asymptotically tight, should be $\exp(-\Omega(\eps\log(1+\eps)\mu))$ instead, see Chernoff bound

  4. The degree can go up to $n(q-1)$, though.