Randomized Algorithms
南京大学 尹一通
Randomized Algorithms Course Info yitong.yin@gmail.com - - PowerPoint PPT Presentation
Randomized Algorithms Course Info yitong.yin@gmail.com yinyt@nju.edu.cn office hour: 804, Thursday 2-4pm course homepage: http://tcs.nju.edu.cn/wiki Textbooks Rajeev Motwani and Prabhakar
南京大学 尹一通
Rajeev Motwani and Prabhakar Raghavan. Randomized Algorithms. Cambridge University Press, 1995. Michael Mitzenmacher and Eli Upfal. Probability and Computing:
Randomized Algorithms and Probabilistic Analysis.
Cambridge University Press, 2005.
Feller
An Introduction to Probability Theory and Its Applications
Aldous and Fill
Reversible Markov Chains and Random Walks on Graphs
Alon and Spencer
The Probabilistic Method
Turing Machine random coin
O(n2.373)
O(nω) O(n2.373)
Freivald’s Algorithm pick a uniform random r ∈{0,1}n; check whether A(Br) = Cr ;
O(n2.373)
Freivald’s Algorithm pick a uniform random r ∈{0,1}n; check whether A(Br) = Cr ;
Pr[ABr = Cr] = Pr[Dr = 0] D = AB C = 0n×n
(Dr)i =
n
Dikrk =0 rj = − 1 Dij
n
Dikrk 2n 2n−1 = 1 2 Dij = 0
≤
Freivald’s Algorithm pick a uniform random r ∈{0,1}n; check whether A(Br) = Cr ;
If AB ⇥= C, for a uniformly random r {0, 1}n, Pr[ABr = Cr] ≤ 1 2. Theorem (Freivald, 1979)
if AB ≠ C, error probability ≤
2−100
f ≡ g?
f ∈ F[x] f ≡ 0?
f ∈ F[x] f(x) =
d
X
i=0
aixi
ai ∈ F
for
Fundamental Theorem of Algebra:
Randomized Algorithm pick a uniform random r ; check whether f(r) = 0 ;
∈S
S ⊆ F
f ∈ F[x] f ≡ 0?
Fundamental Theorem of Algebra:
Randomized Algorithm pick a uniform random r ; check whether f(r) = 0 ;
∈S
S ⊆ F f 0
Pr[f(r) = 0] ≤ |S| d |S| = 2d = 1 2
Li Lei Han Meimei
EQ : {0, 1}n × {0, 1}n → {0, 1}
# of bits communicated
f(a, b)
EQ(a, b) =
a = b a ̸= b
There is no deterministic communication protocol solving EQ with less than n bits in the worst-case.
Theorem (Yao, 1979)
Li Lei Han Meimei
f =
n−1
aixi
pick uniform random r ∈[2n]
r, g(r) f(r)=g(r) ?
2
g =
n−1
X
i=0
bixi
Li Lei Han Meimei
f =
n−1
aixi
pick uniform random r ∈[p]
r, g(r) f(r)=g(r) ?
k = log2(2n)
p ∈ [2k, 2k+1]
f, g ∈ Zp[x]
g =
n−1
X
i=0
bixi
O(log n) bits
f ≡ g?
f, g ∈ F[x1, x2, . . . , xn] F[x1, x2, . . . , xn] : ring of n-variate polynomials over field F f(x1, x2, . . . , xn) = X
i1,i2,...,in≥0
ai1,i2,...,inxi1
1 xi2 2 · · · xin n
degree of f : maximum i1 + i2 + · · · + in ai1,i2,...,in 6= 0 with f ∈ F[x1, x2, . . . , xn] :
f ≡ g?
f, g ∈ F[x1, x2, . . . , xn] f(x1, x2, . . . , xn) = X
i1,i2,...,in≥0 i1+i2+···+in≤d
ai1,i2,...,inxi1
1 xi2 2 · · · xin n
f ≡ 0?
f ∈ F[x1, x2, . . . , xn]
f ≡ g?
f, g ∈ F[x1, x2, . . . , xn]
f ≡ 0?
f ∈ F[x1, x2, . . . , xn]
f is given as block-box: given any ~ x = (x1, x2, . . . , xn) returns f(~ x)
Vandermonde determinant
M = 1 x1 x2
1
. . . xn−1
1
1 x2 x2
2
. . . xn−1
2
. . . . . . . . . ... . . . 1 xn x2
n
. . . xn−1
n
f(~ x) = det(M) = Y
j<i
(xi − xj)
f ≡ 0?
f ∈ F[x1, x2, . . . , xn] f is given as block-box or product from
f ≡ 0?
f ∈ F[x1, x2, . . . , xn] pick random r1, r2, ... , rn ∈S
uniformly and independently at random;
check whether f(r1, r2, ... , rn) = 0 ;
f ≡ 0 f(r1, r2, . . . , rn) = 0
Fundamental Theorem of Algebra:
pick a uniform random r ∈S; check whether f(r) = 0 ;
f ∈ F[x] f ≡ 0?
f ≡ 0 f(r) = 0 f 6⌘ 0 Pr[f(r) = 0] ≤ d |S|
f ≡ 0?
f ∈ F[x1, x2, . . . , xn] pick random r1, r2, ... , rn ∈S
uniformly and independently at random;
check whether f(r1, r2, ... , rn) = 0 ;
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0 f ≡ 0 f(r1, r2, . . . , rn) = 0
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0 f(x1, x2, . . . , xn) =
d
X
i=0
xi
nfi(x1, x2, . . . , xn−1)
= gx1,x2,...,xn−1(xn) f can be treated as a single-variate polynomial of xn:
Pr[f(r1, r2, . . . , rn) = 0] = Pr[gr1,r2,...,rn−1(rn) = 0] gr1,r2,...,rn−1 6⌘ 0? f(x1, x2, . . . , xn) = X
i1,i2,...,in≥0 i1+i2+···+in≤d
ai1,i2,...,inxi1
1 xi2 2 · · · xin n
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0
single-variate case, proved by the fundamental Theorem of algebra
Schwartz-Zippel Thm is true for all smaller n
f(x1, x2, . . . , xn) =
k
X
i=0
xi
nfi(x1, x2, . . . , xn−1)
fk 6⌘ 0
degree of fk ≤ d − k
n = xk
nfk(x1, x2, . . . , xn−1) + ¯
f(x1, x2, . . . , xn) ¯ f(x1, x2, . . . , xn) =
k−1
X
i=0
xi
nfi(x1, x2, . . . , xn−1)
where highest power of xn in ¯ f < k
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0
highest power of xn in ¯ f < k fk 6⌘ 0
degree of fk ≤ d − k
= xk
nfk(x1, x2, . . . , xn−1) + ¯
f(x1, x2, . . . , xn)
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0
f(x1, x2, . . . , xn)
n law of total probability: Pr[f(r1, r2, . . . , rn) = 0]
= Pr[f(~ r) = 0 | fk(r1, . . . , rn−1) = 0] · Pr[fk(r1, . . . , rn−1) = 0] + Pr[f(~ r) = 0 | fk(r1, . . . , rn−1) 6= 0] · Pr[fk(r1, . . . , rn−1) 6= 0]
≤ d − k |S|
≤ k |S|
gx1,...,xn−1(xn) = f(x1, . . . , xn)
where
= Pr[gr1,...,rn−1(rn) = 0 | fk(r1, . . . , rn−1) 6= 0]
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0 Pr[f(r1, r2, . . . , rn) = 0] ≤ d − k |S| + k |S| = d |S|
f ≡ 0?
f ∈ F[x1, x2, . . . , xn] pick random r1, r2, ... , rn ∈S
uniformly and independently at random;
check whether f(r1, r2, ... , rn) = 0 ;
Schwartz-Zippel Theorem
Pr[f(r1, r2, . . . , rn) = 0] ≤ d |S| f 6⌘ 0 f ≡ 0 f(r1, r2, . . . , rn) = 0