Probability and Randomized Algorithms
Probability and Randomized Algorithms
x.
Independent Variables
Random variables are independent if their
probabilities dont depend on each others values: DEF: X and Y are independent if Pr[x,y] = Pr[x]Pr[y] for all x, y. LEMMA: Equivalently, X and Y are independent if (excluding 0-prob. y)
x X, y Y, Pr[x|y] = Pr[x]
4
Bayes Theorem
Assume X a random variable on {0,1} and Repeat experiment n times. I.e., take n
Bernoullis Thm:
n
DEF: The product of random variables X, Y is the random variable XY dened on XY with distribution Pr[(x,y)] = Pr[x]Pr[y]. let p = Pr[X=1], q = Pr[X=0]
Binomial Rand.Var.
independent copies: X1 X2 Xn
Expectation
The average value taken on by a function f
on probability distribution X DEF: The expectation of f is dened by:
E( f ) =
THM:
E( f + g) = E( f ) + E(g)
xX
! f (x) px
COR: For n repetitions of a Binomial random variable X consider sum S which counts the number outcomes = 1. Then E(S) = np
7
Chernoff Bound
Estimates probability that sum of Binomial
THM: experiment deviate from expected sum np
Pr S (1 + !)pn e
!2 3 pn
Note: probability that sum too big falls off exponentially with n
Randomized Algorithms
Equivalent formulations: Turing machine with coin ips at every step of computation Non-deterministic Turing machine with probability distribution over computation branches Nomenclature (varies from author to author): Monte-Carlo: Colloquially any randomized algorithm Complexity theory: NOs always right Las-Vegas: always correct, but may fail BPP: answers correct most of the time
Repeat algorithm to make arbitrarily small Gives class ZPP Zero-Prob-of-error-Poly ZPP = RP co-RP
11
Class BPP
13
-bias Detector
2 ( 1 !)!2 2 x = output of length n from f c = number of 1s in x return (c > n/2) // YES if 1-bias, NO if 0-bias
priori to have some built-in bias in an unknown direction. Decide: Which direction the bias is in.