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 have vertices, with source , and define
We have , and every reachable vertex belongs to because a reachable vertex has a simple path from
Certifying a Complete Reachable Set
Suppose the exact count is already known. Enumerate all vertices in a fixed order. For each one, nondeterministically choose whether to count it
Whenever the machine chooses to count , require a path certificate from to of length at most . Verify the path while retaining only its current vertex and a step counter
Finally require that exactly vertices were counted. Every counted vertex is in , no vertex is counted twice, and the cardinality is correct. Therefore every surviving branch has enumerated exactly
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 , repeat that certified enumeration and record whether some counted satisfies or . On any branch that survives the count check, this flag is true exactly when
Perform this procedure for each and count the true flags. This computes : all surviving branches return the correct number, and at least one sequence of correct guesses survives
Starting from , repeat until the count of all reachable vertices is known. A final certified enumeration checks whether is absent and accepts exactly in that case
Only a constant number of vertex identifiers, path counters, and cardinalities are retained, each using bits. The loops are sequential rather than a recursion stack storing all earlier sets
Finite Probability Spaces
A finite probability space consists of a set and nonnegative weights summing to one. An event is a subset of , with probability
For independent fair coin flips, and each outcome has probability
Union Bound and Conditioning
For any events ,
No independence assumption is needed
For , conditional probability is
This gives the product rule and, for a partition with positive probabilities, the law of total probability
Bayes’ rule reverses the conditioning
Independence
Two events are independent when . For several events, mutual independence requires the corresponding product identity for every subset of the events
Pairwise independence alone is weaker. If are independent fair bits and , any two of are independent, but the three satisfy a deterministic parity constraint
Birthday Collisions
Sample times independently and uniformly from a set of size . For , the exact probability of no repetition is
When is on the order of , logarithmic expansion gives
There are roughly candidate pairs, so a collision becomes likely after about 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 output bits, this corresponds to a generic collision-search scale of evaluations. Finding a preimage of one specified digest is a different task, with generic search scale
Random Variables and Expectation
A random variable is a function . Its expectation is
Linearity holds without independence
An indicator satisfies
This is useful when a complicated quantity is a count. For example, the number of colliding pairs among uniform samples has expectation
For independent random variables with finite expectations of the relevant products,
Variance
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
Useful Distributions
| Distribution | Meaning | Mean | Variance |
|---|---|---|---|
| Indicator of success | |||
| Successes in independent trials | |||
| Trials up to and including first success |
For the geometric distribution, for and . Counting only failures before the first success gives a different convention and mean
The standard Gaussian has density
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 coupon types uniformly. Let be the number of draws required to see every type
When types have been seen, the probability of obtaining a new type is . The waiting time for the next new type is geometric, so
Linearity of expectation gives
For a tail estimate, a fixed type is missing after draws with probability . Taking a union bound over all types gives
Thus is sufficient to collect everything with probability at least
Concentration Inequalities
Markov
For a nonnegative random variable and ,
The pointwise inequality proves the result after taking expectations
Chebyshev
Apply Markov to the squared deviation , where
For a sum of pairwise independent fair bits, the variance is , so
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
For a sum of independent variables, the exponential moment factors into a product. Bounding the individual factors and optimizing gives the tail bound
For independent fair bits , put . Since
the sum satisfies
Taking and applying symmetry yields
More generally, Hoeffding’s inequality for independent gives
For independent , with and , useful multiplicative forms are
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 , estimate by . Hoeffding gives
To obtain error at most with failure probability at most , it suffices that
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 red or blue with equal probability. A fixed set of vertices forms a monochromatic clique with probability
The union bound over all -vertex subsets gives
If the right-hand side is below one, a coloring without a monochromatic exists. Writing for the least size forcing one in every coloring, we conclude
Choosing on the scale of gives an exponential lower bound. The existence argument does not by itself give an efficient deterministic method for finding the coloring