Lecture 14: Randomized Computation (cont.)

Similar documents
Lecture 2: Uncomputability and the Haling Problem

Polynomial identity testing and global minimum cut

Lecture 12: November 13, 2018

Notes on the Combinatorial Nullstellensatz

Lecture 9: Pseudo-random generators against space bounded computation,

ACO Comprehensive Exam 9 October 2007 Student code A. 1. Graph Theory

Notes for Lecture 11

Lecture 11: Pseudorandom functions

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary

Lecture 2. The Lovász Local Lemma

Lecture 2: Concentration Bounds

Lecture 2 Clustering Part II

Primality Test. Rong-Jaye Chen

Trial division, Pollard s p 1, Pollard s ρ, and Fermat s method. Christopher Koch 1. April 8, 2014

Lecture 16: Monotone Formula Lower Bounds via Graph Entropy. 2 Monotone Formula Lower Bounds via Graph Entropy

Lecture 9: Expanders Part 2, Extractors

Davenport-Schinzel Sequences and their Geometric Applications

Lecture 9: Hierarchy Theorems

Lecture 5: April 17, 2013

Math 609/597: Cryptography 1

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Random assignment with integer costs

An Introduction to Randomized Algorithms

Quantum Computing Lecture 7. Quantum Factoring

Design and Analysis of Algorithms

SRC Technical Note June 17, Tight Thresholds for The Pure Literal Rule. Michael Mitzenmacher. d i g i t a l

Intensive Algorithms Lecture 11. DFT and DP. Lecturer: Daniel A. Spielman February 20, f(n) O(g(n) log c g(n)).

Math 216A Notes, Week 5

Problem Set 2 Solutions

ECE 6980 An Algorithmic and Information-Theoretic Toolbox for Massive Data

Sequences and Series of Functions

w (1) ˆx w (1) x (1) /ρ and w (2) ˆx w (2) x (2) /ρ.

Lecture 11: Hash Functions and Random Oracle Model

On Algorithm for the Minimum Spanning Trees Problem with Diameter Bounded Below

Math778P Homework 2 Solution

A Simple Derivation for the Frobenius Pseudoprime Test

Last time, we talked about how Equation (1) can simulate Equation (2). We asserted that Equation (2) can also simulate Equation (1).

Solutions for the Exam 9 January 2012

Ma/CS 6b Class 19: Extremal Graph Theory

Fundamenta Informaticae XXI (2001) IOS Press

MA131 - Analysis 1. Workbook 3 Sequences II

CS / MCS 401 Homework 3 grader solutions

COMP760, SUMMARY OF LECTURE 16.

Some special clique problems

The Discrete Fourier Transform

M A T H F A L L CORRECTION. Algebra I 1 4 / 1 0 / U N I V E R S I T Y O F T O R O N T O

Approximate Sorting. Institute for Theoretical Computer Science, ETH Zürich, CH-8092 Zürich

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

Infinite Sequences and Series

MA131 - Analysis 1. Workbook 2 Sequences I

2 High-level Complexity vs. Concrete Complexity

Test One (Answer Key)

n outcome is (+1,+1, 1,..., 1). Let the r.v. X denote our position (relative to our starting point 0) after n moves. Thus X = X 1 + X 2 + +X n,

Lecture 19: Convergence

MAT1026 Calculus II Basic Convergence Tests for Series

Element sampling: Part 2

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

Lecture 2: April 3, 2013

Frequentist Inference

Hashing and Amortization

The multiplicative structure of finite field and a construction of LRC

1. By using truth tables prove that, for all statements P and Q, the statement

How to walk home drunk. Some Great Theoretical Ideas in Computer Science for. Probability Refresher. Probability Refresher.

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

Model of Computation and Runtime Analysis

# fixed points of g. Tree to string. Repeatedly select the leaf with the smallest label, write down the label of its neighbour and remove the leaf.

Square-Congruence Modulo n

1 Last time: similar and diagonalizable matrices

Some remarks for codes and lattices over imaginary quadratic

Math 4400/6400 Homework #7 solutions

Solutions to Math 347 Practice Problems for the final

Lecture 4: April 10, 2013

7.1 Convergence of sequences of random variables

Lecture 2: Monte Carlo Simulation

Lecture 11: Channel Coding Theorem: Converse Part

ORIE 633 Network Flows September 27, Lecture 8

2.1. The Algebraic and Order Properties of R Definition. A binary operation on a set F is a function B : F F! F.

Mathematical Foundation. CSE 6331 Algorithms Steve Lai

HOMEWORK 2 SOLUTIONS

Solution. 1 Solutions of Homework 1. Sangchul Lee. October 27, Problem 1.1

Lecture 1. January 8, 2018

If a subset E of R contains no open interval, is it of zero measure? For instance, is the set of irrationals in [0, 1] is of measure zero?

ALG 2.2 Search Algorithms

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 22

1 Approximating Integrals using Taylor Polynomials

Monte Carlo Integration

1 Review and Overview

Commutativity in Permutation Groups

Bertrand s Postulate

Lecture Chapter 6: Convergence of Random Sequences

Seunghee Ye Ma 8: Week 5 Oct 28

Polynomial reduction. Outline Lecture. Non deterministic polynomial time. Example 1 : discrete log. Lecture: Polynomial reduction.

TEACHER CERTIFICATION STUDY GUIDE

Homework 3. = k 1. Let S be a set of n elements, and let a, b, c be distinct elements of S. The number of k-subsets of S is

SOME TRIBONACCI IDENTITIES

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3

On Random Line Segments in the Unit Square

Sequences III. Chapter Roots

ITEC 360 Data Structures and Analysis of Algorithms Spring for n 1

Homework 2 January 19, 2006 Math 522. Direction: This homework is due on January 26, In order to receive full credit, answer

Transcription:

CSE 200 Computability ad Complexity Wedesday, May 15, 2013 Lecture 14: Radomized Computatio (cot.) Istructor: Professor Shachar Lovett Scribe: Dogcai She 1 Radmized Algorithm Examples 1.1 The k-th Elemet Defiitio 1 (The k-th elemet) Iput: A def = {a 1, a 2,, a } ad k. Goal: Fid the k-th elemet (i the ordered set). (whe k = 2, it s fidig the media). The algorithm with low time complexity was iveted i 1973. But the algorithm was a little ucovetioal: it s a radomized algorithm. Algorithm 1 Elemet(A, k) [3] 1: Choose radom a i A (called pivot). 2: Partitio A to S {a j : a j a i }, ad H {a j : a j > a i }. 3: If S k, retur Elemet(S, k). If S < k, retur Elemet(H, k S ). Claim 2 The expected ruig time of Algorithm 1 is O(). Corollary 3 W.h.p., Algorithm 1 s ruig time is O(). Defiitio 4 (Expected ruig time) Let T (A, k) be the expected ruig time o iputs A ad k. A() def = max A = k [] T (A, k) Proof of Claim 2: {1,, }. We will prove T () c. Let l be the idex of a i i the order. l is uiform i T (A, k) + 1 max(t (l), T ( l)) l=1 + 2 T (l) l= 2 +1 By iductio o, T () + 2 = + 2c = + 2c l= 2 +1 cl [( ) ( + 1 2 + 1 )] 2 2 [ ( + 1) 2 ( 2 + 1) ] 2 2 14-1

= + 2c [ ] 3 2 8 + O() = + 3 c + O(c) 4 c Proof of Corollary 3: E [T ()] c. By Markov s iequality: Pr [T () > 10c] < 1 10. 1.2 Primality testig Defiitio 5 (PRIMALITY) Iput: a iteger. Goal: Is prime or composite? Theorem 6 (Fermat) If is a prime, the 1 a 1, a 1 1 (mod ) Algorithm 2 Miller-Rabi [5, 6] 1: Choose a radom a {1,, 1}. 2: If a 1 1 (mod ), retur NOT PRIME. Let S 1. 3: As log as a 1 1 (mod ), ad S is eve: S S 2. 4: If a S ±1 (mod ), retur PRIME, else retur NOT PRIME. We kow If is prime, Miller-Rabi returs PRIME always. If is composite, Miller-Rabi returs NOT PRIME w.p. 3 4. Before the AKS Algorithm, people foud some determiistic algorithms for PRIMALITY assumig some umber-theoretic cojectures (e.g., Geeralized Riema Hypothesis). The stadard trick to compute powers efficietly. Suppose we wat to compute a b mod. Cosider b s biary represetatio b log b b 1 b 0. Namely, b = b 0 + 2b 1 + 4b 2 + 8b 3 + where b l {0, 1} for ay l [log b]. The, a b = a b0 (a 2 ) b1 (a 4 ) b2. Compute a 2 mod, a 4 mod, a 8 mod,..., i order, ad the compute the multiplicatio, reducig modulo after each step. 1.3 Coectivity i Udirected Graphs Defiitio 7 (UCONN) Iput: a udirected graph G, vertices s, t. Goal: Is s, t i the same compoet? Algorithm 3 Radom walks o udirected graphs 1: Start a radom walk at s. At each step, choose eighbors with equal probability. 2: Stop util t is reached, or the radom walk made too may steps. Oe ca show that if s, t are coected the the expected ruig time of Algorithm 3 is O( 3 ). Hece, we ca set the algorithm to halt ad retur NO after O( 3 ) steps. The beefit of radom walks is it uses little space (O(log )). For example, it s very appealig for samplig pages o the Iteret. Google s Web 14-2

page crawler actually performs radom walks followig liks from a page to aother page. However, radom walks does ot solve the reachability problem i directed graphs i geeral. Cosider Figure 1, it takes the radom walk startig at ode 1 expected O(2 ) steps to reach ode. The reaso is that at each ode i, the walk goes back to its startig poit w. prob. 1 2. This makes the probability of reachig ode after 1 steps 2 ( 1), a expoetially small probability. 1 2 3 4 Figure 1: Radom walks do ot work o directed graphs 1.4 Polyomial idetity testig ad perfect matchig testig Defiitio 8 (Polyomial Idetity Testig) Iput: A real polyomial p(x 1,, x ) of a low degree; efficiet way to evaluate p o iputs. Goal: Is p 0 or ot? A simple method: evaluate the polyomial o a radom assigmet, retur whether it s 0 or ot. Lemma 9 (Schwartz-Zippel) If p(x 1,, x ) is a ozero degree D polyomial, S R, S > D. If choose a 1,, a S are chose uiformly ad idepedetly the Pr [p(a 1,, a ) = 0] D a 1,,a S S Lemma 9 was rediscovered may times i history. It s left as a problem i homework. The iequality is tight meaig that we ca actually costruct a polyomial by iterpolatio ad have correspodig poits to make it equality. A applicatio example for the above polyomial idetity testig is to fid the perfect matchig of a bipartite graph. Cosider a bipartite graph G = (V 1 V 2, E), V 1 = V 2 =. Defiitio 10 (Perfect matchig) A perfectio matchig is a permutatio π S s.t. (1, π(1)), (2, π(2)),, (, π()) E. Idea: Build a matrix A, A i,j def = { x i,j (i, j) E 0 (i, j) E Claim 11 G has a perfect matchig iff det(a) is a ozero polyomial. Proof det(a) = ( 1) sig(π) π S i=1 A i,π(i) = ( 1) sig(π) perfect matchig π i=1 We do t kow a determiistic way to do it. x i,π(i) 14-3

Questio 12 Ca we deradomize polyomial idetity testig? 2 Radomized Complexity Classes Defiitio 13 (Two-sided error algorithm) x L Pr [M(x) = 1] 2/3. x L Pr [M(x) = 1] 1/3. Defiitio 14 (Oe-sided error algorithm) x L Pr [M(x) = 1] 2/3. x L Pr [M(x) = 1] = 0. May atural radomized algorithms are oe-sided. For example, the primality testig ad polyomial idetity testig described above. Defiitio 15 (BPP, RP, co-rp) BPP def = Two-sided error polyomial time. RP def = Oe-sided error polyomial time (x L o error). co-rp def = Same as RP except for o error for x L. ZPP def = Algorithms ruig i expected polyomial time, but always retur correct aswers. Deradomizatio is itimately related to provig lowerbouds (e.g., [4]). Claim 16 ZPP = RP co-rp. Theorem 17 (Adelma [1]) BPP P/poly. Theorem 18 (Sipser-Gács [7]) BPP Σ 2 Π 2. It suffices to prove that BPP Σ 2 for the Sipser-Gács Theorem, sice BPP is closed uder complemet. Proof of Claim 16 (also see [2] Page 141, Exercise 7.6): ( ) Suppose L ZPP, there exists M s.t. M(x) = L(x). Ruig time i expectatio is c. Defie M (x): Ru M(x) for 3 c steps; If it did t halt, retur 0. If x L the M (x) returs 1 with probability 2/3. If x / L the M (x) returs 0 always. Hece L RP. Replacig 0 with 1 would show that also L co-rp. ( ) Suppose L RP co-rp, that is Machie M 1, x L, Pr [M 1 (x) = 1] 2 3 ad x L, Pr [M 1(x) = 0] = 1. Machie M 2, x L, Pr [M 2 (x) = 1] = 1 ad x L, Pr [M 2 (x) = 0] 2 3. Defie M (x) If M 1 (x) = 1, the retur x L. If M 2 (x) = 0, the retur x L. Retry. Say M 1, M 2 ru i c time, x, retur i first 2 lies of code w.p. 2 3. Pr [retry] 1 def 3. Let T = expected ruig time. The, T 2 c + 1 3 T. Hece, T O(c ). We will prove Theorem 17 ad Theorem 18 i the ext class. 14-4

Refereces [1] Leoard M. Adlema. Two theorems o radom polyomial time. I FOCS, pages 75 83, 1978. [2] Sajeev Arora ad Boaz Barak. Computatioal Complexity - A Moder Approach. Cambridge Uiversity Press, 2009. [3] Mauel Blum, Robert W. Floyd, Vaugha R. Pratt, Roald L. Rivest, ad Robert Edre Tarja. Time bouds for selectio. J. Comput. Syst. Sci., 7(4):448 461, 1973. [4] Russell Impagliazzo ad Avi Wigderso. P = BPP if e requires expoetial circuits: Deradomizig the xor lemma. I STOC, pages 220 229, 1997. [5] Gary L. Miller. Riema s hypothesis ad tests for primality. I Proceedigs of seveth aual ACM symposium o Theory of computig, STOC 75, pages 234 239, New York, NY, USA, 1975. ACM. [6] Michael O Rabi. Probabilistic algorithm for testig primality. Joural of Number Theory, 12(1):128 138, 1980. [7] Michael Sipser. A complexity theoretic approach to radomess. I STOC, pages 330 335, 1983. 14-5