TCS: Probability Theory for Computer Science

Probability Theory for Computer Science

Finishing NL = coNL

The first part continues Lecture 9. Since PATH is NL-complete under log-space reductions, it suffices to give an NL algorithm for its complement, NOPATH

Let GG have nn vertices, with source ss, and define

Ri={v:some path from s to v has length at most i}ri=∣Ri∣R_i=\{v:\text{some path from }s\text{ to }v \text{ has length at most }i\} \qquad r_i=|R_i|

We have r0=1r_0=1, and every reachable vertex belongs to Rn−1R_{n-1} because a reachable vertex has a simple path from ss

Certifying a Complete Reachable Set

Suppose the exact count rir_i is already known. Enumerate all vertices uu in a fixed order. For each one, nondeterministically choose whether to count it

Whenever the machine chooses to count uu, require a path certificate from ss to uu of length at most ii. Verify the path while retaining only its current vertex and a step counter

Finally require that exactly rir_i vertices were counted. Every counted vertex is in RiR_i, no vertex is counted twice, and the cardinality is correct. Therefore every surviving branch has enumerated exactly RiR_i

The machine never stores the set itself. The exact count forces the nondeterministic enumeration to be complete

From r_i to r_(i+1)

For a specified vertex vv, repeat that certified enumeration and record whether some counted uu satisfies u=vu=v or (u,v)∈E(u,v)\in E. On any branch that survives the count check, this flag is true exactly when v∈Ri+1v\in R_{i+1}

Perform this procedure for each vv and count the true flags. This computes ri+1r_{i+1}: all surviving branches return the correct number, and at least one sequence of correct guesses survives

Starting from r0r_0, repeat until the count of all reachable vertices is known. A final certified enumeration checks whether tt is absent and accepts exactly in that case

Only a constant number of vertex identifiers, path counters, and cardinalities are retained, each using O(log⁡n)O(\log n) bits. The loops are sequential rather than a recursion stack storing all earlier sets

NOPATH⁡∈NL⟹NL=coNL\operatorname{NOPATH}\in\mathrm{NL}\quad\Longrightarrow\quad\mathrm{NL}=\mathrm{coNL}

Finite Probability Spaces

A finite probability space consists of a set Ω\Omega and nonnegative weights p(ω)p(\omega) summing to one. An event is a subset of Ω\Omega, with probability

Pr⁡[A]=∑ω∈Ap(ω)\Pr[A]=\sum_{\omega\in A}p(\omega)

For nn independent fair coin flips, Ω={0,1}n\Omega=\{0,1\}^n and each outcome has probability 2−n2^{-n}

Union Bound and Conditioning

For any events A1,…,AmA_1,\ldots,A_m,

Pr⁡[⋃j=1mAj]≤∑j=1mPr⁡[Aj]\Pr\left[\bigcup_{j=1}^m A_j\right]\le\sum_{j=1}^m\Pr[A_j]

No independence assumption is needed

For Pr⁡[B]>0\Pr[B]>0, conditional probability is

Pr⁡[A∣B]=Pr⁡[A∩B]Pr⁡[B]\Pr[A\mid B]=\frac{\Pr[A\cap B]}{\Pr[B]}

This gives the product rule and, for a partition B1,…,BkB_1,\ldots,B_k with positive probabilities, the law of total probability

Pr⁡[A]=∑j=1kPr⁡[Bj]Pr⁡[A∣Bj]\Pr[A]=\sum_{j=1}^k\Pr[B_j]\Pr[A\mid B_j]

Bayes’ rule reverses the conditioning

Pr⁡[B∣A]=Pr⁡[A∣B]Pr⁡[B]Pr⁡[A]Pr⁡[A]>0\Pr[B\mid A]=\frac{\Pr[A\mid B]\Pr[B]}{\Pr[A]} \qquad\Pr[A]>0

Independence

Two events are independent when Pr⁡[A∩B]=Pr⁡[A]Pr⁡[B]\Pr[A\cap B]=\Pr[A]\Pr[B]. For several events, mutual independence requires the corresponding product identity for every subset of the events

Pairwise independence alone is weaker. If X,YX,Y are independent fair bits and Z=X⊕YZ=X\oplus Y, any two of X,Y,ZX,Y,Z are independent, but the three satisfy a deterministic parity constraint

Birthday Collisions

Sample mm times independently and uniformly from a set of size NN. For m≤Nm\le N, the exact probability of no repetition is

Pr⁡[no collision]=∏j=0m−1(1−jN)\Pr[\text{no collision}] =\prod_{j=0}^{m-1}\left(1-\frac jN\right)

When mm is on the order of N\sqrt N, logarithmic expansion gives

Pr⁡[collision]≈1−exp⁡(−m(m−1)2N)\Pr[\text{collision}] \approx1-\exp\left(-\frac{m(m-1)}{2N}\right)

There are roughly m2/2m^2/2 candidate pairs, so a collision becomes likely after about N\sqrt N samples. With the usual uniform 365-day birthday model, 23 people already give collision probability slightly above one half

For an ideal hash function with bb output bits, this corresponds to a generic collision-search scale of 2b/22^{b/2} evaluations. Finding a preimage of one specified digest is a different task, with generic search scale 2b2^b

Random Variables and Expectation

A random variable is a function X:Ω→RX:\Omega\to\mathbb R. Its expectation is

E[X]=∑ω∈Ωp(ω)X(ω)\mathbb E[X]=\sum_{\omega\in\Omega}p(\omega)X(\omega)

Linearity holds without independence

E[∑iaiXi]=∑iaiE[Xi]\mathbb E\left[\sum_i a_iX_i\right]=\sum_i a_i\mathbb E[X_i]

An indicator 1A\mathbf1_A satisfies E[1A]=Pr⁡[A]\mathbb E[\mathbf1_A]=\Pr[A]

This is useful when a complicated quantity is a count. For example, the number of colliding pairs among mm uniform samples has expectation

∑i<jE[1Xi=Xj]=(m2)1N\sum_{i<j}\mathbb E[\mathbf1_{X_i=X_j}] =\binom m2\frac1N

For independent random variables with finite expectations of the relevant products, E[∏iXi]=∏iE[Xi]\mathbb E[\prod_iX_i]=\prod_i\mathbb E[X_i]

Variance

Var⁡(X)=E[(X−E[X])2]=E[X2]−E[X]2\operatorname{Var}(X) =\mathbb E[(X-\mathbb E[X])^2] =\mathbb E[X^2]-\mathbb E[X]^2

Its square root is the standard deviation. The variance of a sum includes covariances; for pairwise independent variables with finite second moments, those covariance terms vanish

Var⁡(∑iXi)=∑iVar⁡(Xi)\operatorname{Var}\left(\sum_iX_i\right) =\sum_i\operatorname{Var}(X_i)

Useful Distributions

Distribution Meaning Mean Variance
Bernoulli⁡(p)\operatorname{Bernoulli}(p) Indicator of success pp p(1−p)p(1-p)
Binomial⁡(n,p)\operatorname{Binomial}(n,p) Successes in nn independent trials npnp np(1−p)np(1-p)
Geometric⁡(p)\operatorname{Geometric}(p) Trials up to and including first success 1/p1/p (1−p)/p2(1-p)/p^2

For the geometric distribution, Pr⁡[X=k]=(1−p)k−1p\Pr[X=k]=(1-p)^{k-1}p for k≥1k\ge1 and 0<p≤10<p\le1. Counting only failures before the first success gives a different convention and mean

The standard Gaussian has density

ϕ(x)=12πe−x2/2\phi(x)=\frac1{\sqrt{2\pi}}e^{-x^2/2}

A vector of independent standard Gaussians has a density depending only on its Euclidean norm, so its distribution is invariant under orthogonal transformations. Sums of independent Gaussian variables are Gaussian, with means and variances adding

Coupon Collector

Suppose each independent draw returns one of nn coupon types uniformly. Let TT be the number of draws required to see every type

When i−1i-1 types have been seen, the probability of obtaining a new type is (n−i+1)/n(n-i+1)/n. The waiting time TiT_i for the next new type is geometric, so

E[Ti]=nn−i+1\mathbb E[T_i]=\frac n{n-i+1}

Linearity of expectation gives

E[T]=∑i=1nE[Ti]=n∑j=1n1j=nHn=Θ(nlog⁡n)\mathbb E[T]=\sum_{i=1}^n\mathbb E[T_i] =n\sum_{j=1}^n\frac1j =nH_n=\Theta(n\log n)

For a tail estimate, a fixed type is missing after mm draws with probability (1−1/n)m≤e−m/n(1-1/n)^m\le e^{-m/n}. Taking a union bound over all types gives

Pr⁡[T>m]≤ne−m/n\Pr[T>m]\le ne^{-m/n}

Thus m≥n(ln⁡n+ln⁡(1/δ))m\ge n(\ln n+\ln(1/\delta)) is sufficient to collect everything with probability at least 1−δ1-\delta

Concentration Inequalities

Markov

For a nonnegative random variable XX and t>0t>0,

Pr⁡[X≥t]≤E[X]t\Pr[X\ge t]\le\frac{\mathbb E[X]}t

The pointwise inequality X≥t1X≥tX\ge t\mathbf1_{X\ge t} proves the result after taking expectations

Chebyshev

Apply Markov to the squared deviation (X−μ)2(X-\mu)^2, where μ=E[X]\mu=\mathbb E[X]

Pr⁡[∣X−μ∣≥t]≤Var⁡(X)t2\Pr[|X-\mu|\ge t] \le\frac{\operatorname{Var}(X)}{t^2}

For a sum of pairwise independent fair bits, the variance is n/4n/4, so

Pr⁡[∣X−n/2∣≥εn]≤14ε2n\Pr[|X-n/2|\ge\varepsilon n] \le\frac1{4\varepsilon^2n}

This already proves concentration using only pairwise independence. Full independence allows a much stronger exponential tail

Chernoff and Hoeffding

The exponential-moment method applies Markov after exponentiating

Pr⁡[X−μ≥t]≤e−λtE[eλ(X−μ)]λ>0\Pr[X-\mu\ge t] \le e^{-\lambda t}\mathbb E[e^{\lambda(X-\mu)}] \qquad\lambda>0

For a sum of independent variables, the exponential moment factors into a product. Bounding the individual factors and optimizing λ\lambda gives the tail bound

For independent fair bits XiX_i, put Yi=2Xi−1Y_i=2X_i-1. Since

E[eλYi]=eλ+e−λ2=cosh⁡λ≤eλ2/2\mathbb E[e^{\lambda Y_i}] =\frac{e^\lambda+e^{-\lambda}}2 =\cosh\lambda\le e^{\lambda^2/2}

the sum S=∑iXiS=\sum_iX_i satisfies

Pr⁡[S−n/2≥t]≤exp⁡(nλ2/2−2λt)\Pr[S-n/2\ge t] \le\exp(n\lambda^2/2-2\lambda t)

Taking λ=2t/n\lambda=2t/n and applying symmetry yields

Pr⁡[∣S−n/2∣≥t]≤2e−2t2/n\Pr[|S-n/2|\ge t]\le2e^{-2t^2/n}

More generally, Hoeffding’s inequality for independent Xi∈[ai,bi]X_i\in[a_i,b_i] gives

Pr⁡[∣∑iXi−E∑iXi∣≥t]≤2exp⁡(−2t2∑i(bi−ai)2)\Pr\left[\left|\sum_iX_i-\mathbb E\sum_iX_i\right|\ge t\right] \le2\exp\left(-\frac{2t^2}{\sum_i(b_i-a_i)^2}\right)

For independent Xi∈[0,1]X_i\in[0,1], with X=∑iXiX=\sum_iX_i and μ=E[X]\mu=\mathbb E[X], useful multiplicative forms are

Pr⁡[X≤(1−ε)μ]≤e−ε2μ/2(0<ε<1)Pr⁡[X≥(1+ε)μ]≤e−ε2μ/(2+ε)(ε>0)\begin{aligned} \Pr[X\le(1-\varepsilon)\mu] &\le e^{-\varepsilon^2\mu/2} && (0<\varepsilon<1)\\ \Pr[X\ge(1+\varepsilon)\mu] &\le e^{-\varepsilon^2\mu/(2+\varepsilon)} && (\varepsilon>0) \end{aligned}

Each bound has hypotheses: Markov requires nonnegativity, Chebyshev uses a finite variance, and these Chernoff bounds require the stated independence and range restrictions

Sampling and Randomized Computation

For independent Bernoulli samples of mean pp, estimate pp by p^=∑iXi/n\widehat p=\sum_iX_i/n. Hoeffding gives

Pr⁡[∣p^−p∣≥ε]≤2e−2nε2\Pr[|\widehat p-p|\ge\varepsilon] \le2e^{-2n\varepsilon^2}

To obtain error at most ε\varepsilon with failure probability at most δ\delta, it suffices that

n≥12ε2ln⁡2δn\ge\frac1{2\varepsilon^2}\ln\frac2\delta

The dependence is quadratic in inverse accuracy and logarithmic in inverse failure probability. This is the tool behind majority-vote error reduction for randomized algorithms in Lecture B

The Probabilistic Method

To prove that an object with a property exists, sample a random object and show that the property has positive probability

For a Ramsey example, independently color each edge of KnK_n red or blue with equal probability. A fixed set of kk vertices forms a monochromatic clique with probability

2⋅2−(k2)=21−(k2)2\cdot2^{-\binom k2}=2^{1-\binom k2}

The union bound over all kk-vertex subsets gives

Pr⁡[some monochromatic Kk]≤(nk)21−(k2)\Pr[\text{some monochromatic }K_k] \le\binom nk2^{1-\binom k2}

If the right-hand side is below one, a coloring without a monochromatic KkK_k exists. Writing R(k,k)R(k,k) for the least size forcing one in every coloring, we conclude

(nk)21−(k2)<1⟹R(k,k)>n\binom nk2^{1-\binom k2}<1 \quad\Longrightarrow\quad R(k,k)>n

Choosing nn on the scale of 2k/22^{k/2} gives an exponential lower bound. The existence argument does not by itself give an efficient deterministic method for finding the coloring


© 2024 本网站由 renxiaodaifu 使用 Stellar主题 创建
总访问 次 | 本页访问 次
共发表 103 篇 Blog(s) · 总计 254.1k 字