Академический Документы
Профессиональный Документы
Культура Документы
南京大学
尹一通
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 Raghavan.
Randomized Algorithms.
Cambridge University Press, 1995.
Feller
An Introduction to Probability
Theory and Its Applications
Turing
Machine random
coin
Why?
• Simpler.
• Faster.
• Can do impossibles.
• Can give us clever deterministic algorithms.
• Random input.
• Deterministic problem with random nature.
• ... ...
Checking Matrix Multiplication
three n×n matrices A, B, C:
?
A × B = C
?
A × B
O(n )
= C
?
A × B = C
Freivald’s Algorithm
pick a uniform random r ∈{0,1}n;
check whether A(Br) = Cr ;
if AB = C, always correct
if AB ≠ C, let D = AB C = 0n n
say Dij = 0
n 1
2 1
Pr[ABr = Cr] = Pr[Dr = 0] =
2n 2
n
(Dr)i = Dik rk =0
D r k=1
1
n
i rj = Dik rk
Dij
k=j
Freivald’s Algorithm
pick a uniform random r ∈{0,1}n;
check whether A(Br) = Cr ;
if AB = C, always correct
f is given as black-box
Input: a polynomial f F[x] of degree d
Output: f 0?
Randomized Algorithm
pick a uniform random r ∈S ; S F
check whether f(r) = 0 ;
Randomized Algorithm
pick a uniform random r ∈S ; S F
check whether f(r) = 0 ; |S| = 2d
if f 0
d 1
Pr[f (r) = 0] =
|S| 2
database 1
Are they
identical?
南京
database 2
Communication Complexity
(Yao 1979)
f (a, b)
# of bits
communicated
a b
pick uniform
by PIT: random r ∈[2n]
1
one-sided error
2
# of bit communicated: too large!
Communication Complexity
n 1 n
X1
i f(r)=g(r) ? i
f= ai x g= bi x
i=0 i=0
r, g(r) n
a ∈{0, 1} n b ∈{0, 1}
O(log n) bits
Han Meimei Li Lei
pick uniform
random r ∈[p]
k = log2 (2n)
choose a prime p k
[2 , 2 k+1
] let f, g Zp [x]
Polynomial Identity Testing
(PIT)
Input: f, g 2 F[x1 , x2 , . . . , xn ] of degree d
Output: f g?
f 2 F[x1 , x2 , . . . , xn ] :
X
i1 i2 in
f (x1 , x2 , . . . , xn ) = ai1 ,i2 ,...,in x1 x2 · · · xn
i1 ,i2 ,...,in 0
equivalently:
X
i1 i2 in
f (x1 , x2 , . . . , xn ) = ai1 ,i2 ,...,in x1 x2 · · · xn
i1 ,i2 ,...,in 0
i1 +i2 +···+in d
Input: f, g 2 F[x1 , x2 , . . . , xn ] of degree d
Output: f g?
equivalently:
fix an arbitrary S ✓ F
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
Input: a polynomial f F[x] of degree d
Output: f 0?
fix an arbitrary S ✓ F
pick a uniform random r ∈S;
check whether f(r) = 0 ;
f ⌘0 f (r) = 0
d
f 6⌘ 0 Pr[f (r) = 0]
|S|
Input: f 2 F[x1 , x2 , . . . , xn ] of degree d
Output: f 0?
fix an arbitrary S ✓ F
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
Schwartz-Zippel Theorem
d
f 6⌘ 0 Pr[f (r1 , r2 , . . . , rn ) = 0]
|S|
Schwartz-Zippel Theorem
d
f 6⌘ 0 Pr[f (r1 , r2 , . . . , rn ) = 0]
|S|
X
i1 i2 in
f (x1 , x2 , . . . , xn ) = ai1 ,i2 ,...,in x1 x2 · · · xn
i1 ,i2 ,...,in 0
i1 +i2 +···+in d
induction on n :
induction step:
n
fk 6⌘ 0
k: highest power of xn in f
degree of fk d k
k
X
f (x1 , x2 , . . . , xn ) = xin fi (x1 , x2 , . . . , xn 1)
i=0
= k
xn fk (x1 , x2 , . . . , xn 1 ) + f¯(x1 , x2 , . . . , xn )
k
X1
where f¯(x1 , x2 , . . . , xn ) = i
xn fi (x1 , x2 , . . . , xn 1 )
i=0
d k k d
Pr[f (r1 , r2 , . . . , rn ) = 0] + =
|S| |S| |S|
Input: f 2 F[x1 , x2 , . . . , xn ] of degree d
Output: f 0?
fix an arbitrary S ✓ F
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
Schwartz-Zippel Theorem
d
f 6⌘ 0 Pr[f (r1 , r2 , . . . , rn ) = 0]
|S|