randomized computation i
play

Randomized Computation (I) Guan-Shieng Huang Dec. 6, 2006 0-0 - PowerPoint PPT Presentation

Randomized Computation (I) Guan-Shieng Huang Dec. 6, 2006 0-0 Outline Basic Concept Examples Complexity Classes Basic Techniques 1 Randomized Computation 1. Can random numbers help us solve


  1. Randomized Computation (I) Guan-Shieng Huang Dec. 6, 2006 0-0

  2. ✬ ✩ Outline • Basic Concept • Examples • Complexity Classes • Basic Techniques ✫ ✪ 1

  3. ✬ ✩ Randomized Computation 1. Can random numbers help us solve computational problems? 2. In a randomized algorithm, we may make the following statement: (a) Given anu number n > 2, we can decide whether n is prime with high probability. ✫ ✪ 2

  4. ✬ ✩ Types of Errors • positive: when answer “yes” negative: when answer “no” • true positive; true negative: The answer coincides with the fact • false positive; false negative The answer is wrong Example 1. Given n = 5, suppose we want to decide whether n > 4. If we answer “no”, then this answer is a false negative; if we answer “yes”, then this answer is a true positive. 2. Suppose we want to decide whether n is even. Answer “yes” = ⇒ false positive; answer “no” = ⇒ true negative. ✫ ✪ 3

  5. ✬ ✩ Monte Carlo Algorithm A randomized algorithm that never appears false positive. • If it answers “yes”, the answer must be correct. • If it answers “no”, the answer may be wrong. • With high probability that it can answer “yes” if it is really this case. Remark Monte Carlo method or Monte Carlo simulation is a rather general term referring to a procedure that involves randomness. ✫ ✪ 4

  6. ✬ ✩ Examples • Symbolic Determinants • Random Walks for 2SAT • Compositeness ✫ ✪ 5

  7. ✬ ✩ Symbolic Determinants • Let A be an n × n matrix with each entry a multi-variate polynomial. ( x 3 y + 3 y 5 z ) We want to determine whether the determinant of A is not a zero polynomial. • det A = � π σ ( π ) � n i =1 a i,π ( i ) where A = ( a i,j ) n × n ; σ ( π ) = 1 if π is an even permutation, − 1 if π is odd. ✫ ✪ 6

  8. ✬ ✩ n � � det A = σ ( π ) a i,π ( i ) π i =1   a 1 , 1 a 1 , 2 a 1 , 3     det a 2 , 1 a 2 , 2 a 2 , 3   a 3 , 1 a 3 , 2 a 3 , 3 = a 1 , 1 a 2 , 2 a 3 , 3 + a 2 , 1 a 3 , 2 a 1 , 3 + a 3 , 1 a 1 , 2 a 2 , 3 − a 1 , 1 a 2 , 3 a 3 , 2 − a 1 , 2 a 2 , 1 a 3 , 3 − a 1 , 3 a 2 , 2 a 3 , 1 • π = [3 , 2 , 1] is an odd permutation. a 1 ,π (1) a 2 ,π (2) a 3 ,π (3) = a 1 , 3 a 2 , 2 a 3 , 1 • π = [2 , 3 , 1] is an even permutation. a 1 ,π (1) a 2 ,π (2) a 3 ,π (3) = a 1 , 2 a 2 , 3 a 3 , 1 ✫ ✪ 7

  9. ✬ ✩ • Gaussian elimination can solve “numerical determinants” in polynomial time. • No body knows how to solve the symbolic determinants in polynomial time. ✫ ✪ 8

  10. ✬ ✩ Randomized Algorithm for Symbolic Determinants Assume there are m variables in A and the highest degree if each variable in the expansion is at most d . 1. Choose m random integers i 1 , . . . , i m between 0 and M = 2 md . 2. Compute the determinant det A ( i 1 , . . . , i m ) by Gaussian elimination. 3. If the result � = 0, reply “yes”. 4. If the result= 0, reply “probably equal to 0”. ✫ ✪ 9

  11. ✬ ✩ Lemma 11.1 Let p ( x 1 , . . . , x m ) be a polynomial, not identically zero, in m variables each of degree at most d in it, and let M > 0 be an integer. Then the number of m -tuples ( x 1 , . . . , x m ) ∈ Z m M such that p ( x 1 , . . . , x m ) = 0 is at most mdM m − 1 . Proof. 1. By induction on m . When m = 1 the lemma says that no polynomial of degree ≤ d can have more than d roots. 2. Suppose the result is true for m − 1 variables. Let the degree of x m is t ≤ d . We can rewrite p ( x 1 , . . . , x m ) as q ( x 1 , . . . , x m − 1 ) x t m + r ( x 1 , . . . , x m ). Consider x 1 , . . . , x m − 1 according to whether they can make q ( x 1 , . . . , x m − 1 ) = 0. #roots ≤ ( m − 1) dM m − 2 · M + M m − 1 t ≤ mdM m − 1 . ✫ ✪ 10

  12. ✬ ✩ Random Walks for 2 SAT 2SAT: Satisfiability problem with each clause containing at most two literals. Algorithm 1. Start with any truth assignment T . 2. Repeat the following steps r times. (a) If there is no unsatisfied clause, reply “Formula is satisfiable” and halt. Otherwise, pick any unsatisfied clause, flip the value of any one literal inside it. 3. Reply “Formula is probably unsatisfiable”. ✫ ✪ 11

  13. ✬ ✩ Let r = 2 n 2 . Then this algorithm can find a satisfiable Theorem truth assignment with probability at least 1 2 when the 2SAT formula is satisfiable. Proof. 1. � T : a satisfying truth assignment for this formula T : current assignment 2. t ( i ): the expectation for the number of flipping if T differs from � T in exactly i values 3. t (0) = 0 t ( i ) ≤ 1 2 ( t ( i − 1) + t ( i + 1)) + 1 t ( n ) = t ( n − 1) + 1 ✫ ✪ 12

  14. ✬ ✩ 4. Let x (0) = 0 x ( i ) = 1 2 ( x ( i − 1) + x ( i + 1)) + 1 x ( n ) = x ( n − 1) + 1 Then t ( i ) ≤ x ( i ) = 2 in − i 2 ≤ n 2 . 5. Let r = 2 n 2 . Then Prob [ r ≥ 2 n 2 ] ≤ 1 2 . Lemma 11.2 (Markov Inequality) If x is a non-negative random variable, then for any k > 0, Prob [ x ≥ kµ x ] ≤ 1 k where µ x is the expectation of x . Proof. (discrete case) � � � µ x = ip i = ip i + ip i ≥ kµ x Prob [ x ≥ kµ x ] . i i<kµ x i ≥ kµ x ∴ Prob [ x ≥ kµ x ] ≤ 1 k . ✫ ✪ 13

  15. ✬ ✩ Fermat Test 1. If n is prime, then a n − 1 ≡ 1 (mod n ) for all a not divided by n . 2. Hypothesis: n is not prime = ⇒ at least half of nonzero residues a can make a n − 1 �≡ 1 (mod n ). 3. If it is true, we would have a polynomial Monte Carlo algorithm for testing whether n is composite. Unfortunately, this statement is false. ✫ ✪ 14

  16. ✬ ✩ Square Roots Modulo a Prime Consider x 2 ≡ a (mod p ) where p ≥ 3. Then exactly half of the nonzero residues have square roots. Proof. • Consider the squares of 1 , 2 , 3 , . . . , p − 1. • They are exactly those numbers that have square roots. • k and p − k collapse after squaring. • However, x 2 ≡ a has at most two roots, and in fact, either zero or two distinct roots. ✫ ✪ 15

  17. ✬ ✩ ≡ 1 (mod p ), then x 2 ≡ a has two roots. p − 1 Lemma 11.3 If a 2 p − 1 Otherwise, a ≡ − 1 (mod p ) and it has no roots. 2 Proof. Let r be a primitive root for p . Then each nonzero residue a ≡ r k for some k ≥ 0. = ( r p − 1 ) j ≡ 1, and the square roots p − 1 p − 1 ≡ ( r 2 j ) 1. k = 2 j : a 2 2 for a are r j and r j + p − 1 2 . p − 1 p − 1 = r j ( p − 1)+ p − 1 p − 1 = ( r 2 j +1 ) 2. k = 2 j + 1: a ≡ r ≡ − 1 2 2 2 2 (mod p ), and it has no square roots. ✫ ✪ 16

  18. ✬ ✩ Legendre Symbol   1 if a has square roots in p � a �   = 0 if p divides a p    − 1 if a has no seuqre root in p for prime numbers p > 2. � � p − 1 a Theorem = a mod p . 2 p � � � � � � ab a b Corollary = . p p p ✫ ✪ 17

  19. ✬ ✩ Gauss’s Lemma � � = ( − 1) m where m = |{ i : 1 ≤ i ≤ p − 1 2 , qi mod p > p − 1 a 2 }| and p p > 2. Proof. Consider q, 2 q, 3 q, . . . , p − 1 · q 2 and − p − 1 , . . . , − 1 , 0 , 1 , . . . , p − 1 . 2 2 Either k or − k (1 ≤ k ≤ p − 1 2 ) can be mapped by one number qi , but not both: qi ≡ − qj (mod p ) ⇒ q ( i + j ) ≡ 0 (mod p ) ⇒ p | ( i + j ) . And no two numbers qi and qj can be the same: qi ≡ qj (mod p ) ⇒ p | i − j. ✫ ✪ 18

  20. ✬ ✩ � qi = ( p − 1 ≡ ( − 1) m ( p − 1 p − 1 )! · q )! 2 2 2 1 ≤ i ≤ p − 1 2 � q � ∴ ( − 1) m ≡ q p − 1 ≡ (mod p ) . 2 p ✫ ✪ 19

  21. ✬ ✩ Legendre’s Law of Reciprocity � q � � p � p − 1 q − 1 = ( − 1) if gcd( p, q ) = 1. 2 2 p q Proof. 1. � qi � p − 1 � 2 1 + 2 + 3 + · · · + p − 1 ≡ ( qi − p ) + mp (mod 2) . 2 p i =1 ∵ 0 ≤ a ≤ p − 1 ⇒ p − a = a + p − 2 a ≡ a + p ≡ a + 1 (mod 2) . 2 2. � qi � p − 1 p − 1 � � � 2 2 p − 1 i ≡ q i − p + mp (mod 2) ∴ 2 p i =1 i =1 i =1 ✫ ✪ 20

  22. ✬ ✩ 3. ∵ q ≡ q ≡ 1 (mod 2) , p − 1 � qi � � 2 ∴ m ≡ (mod 2) p i =1 4. No grid lies inside (0 , 0)—( p, q ). Hence, p − 1 � qi � q − 1 � pj � � � 2 2 ≡ p − 1 · q − 1 m + m ′ ≡ + (mod 2) . 2 2 p q i =1 j =1 5. � q � � p � = ( − 1) m · ( − 1) m ′ = ( − 1) p − 1 q − 1 2 . 2 ∴ p q ✫ ✪ 21

  23. ✬ ✩ Jacob’s Symbol � M � � M � � M � � M � = · · · N p 1 p 2 p n if N = p 1 p 2 . . . p n where p i ’s are odd primes (which may be the same). Lemma 11.6 � M 1 M 2 � � M 1 � � M 2 � 1. = N N N � M + N � � M � 2. = N N � N � � M � M − 1 N − 1 3. = ( − 1) if gcd( M, N ) = 1 and M, N are odd. 2 2 M N Proof. � � � � � � � � M 1 M 2 � � M 1 � � M 2 � = � = � M 1 M 2 M 1 M 2 1. = ✫ ✪ i i j N p i p 1 p j N N 22

  24. ✬ ✩ � � � M + N � = � Mp i = � M � = � M + N 2. i N p i N � � � � �� � � �� � M � � N � = � · � = � q j q j p i p i 3. i,j i,j i,j N M p i q j p i q j � � qj − 1 qj − 1 pi − 1 pi − 1 · 2 . = ( − 1) = ( − 1) i,j 2 2 2 i,j And � = � � q j − 1 q j − 1 p i − 1 p i − 1 , and a − 1 + b − 1 ≡ ab − 1 i,j 2 2 i 2 j 2 2 2 2 (mod 2). � q j − 1 ≡ M − 1 (mod 2) , ∴ 2 2 j � p i − 1 ≡ N − 1 and (mod 2) . 2 2 i ✫ ✪ 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend