Great Theoretical Ideas In Computer Science Anupam Gupta Lecture 17 CS 15 251 Oct 24 2006 Fall 2006 Carnegie Mellon University Randomness and Computation Some Prime Examples Checking Our Work Suppose we want to check p x q x r x where p q and r are three polynomials x 1 x3 x2 x 1 x4 1 If the polynomials are long this requires n2 mults by elementary school algorithms or can do faster with fancy techniques like the Fast Fourier transform Can we check if p x q x r x more efficiently Great Idea Evaluating on Random Inputs Let f x p x q x r x Is f zero Idea Evaluate f on a random input z If we get f z 0 this is evidence that f is zero everywhere If f x is a degree 2n polynomial it can only have 2n roots We re unlikely to guess one of these by chance Equality checking by random evaluation 1 Fix a sample space S z1 z2 zm with arbitrary points zi for m 2n 2 Select random z from S with probability 1 m 3 Evaluate f z p z q z r z 4 If f z 0 output equal otherwise output not equal Equality checking by random evaluation What is the probability the algorithm outputs not equal when in fact f 0 Zero If p x q x r x always correct Equality checking by random evaluation What is the probability the algorithm outputs equal when in fact f 0 Let A z z is a root of f Recall that A degree of f 2n Therefore P A 2n m We can choose to be small Equality checking by random evaluation By repeating this procedure k times we are fooled by the event f z1 f z2 f zk 0 when actually f x 0 with probability no bigger than P A 2n m k k Wow That idea could be used for testing equality of lots of different types of functions Yes E g a matrix is just a special kind of function Suppose we do a matrix multiplication of two nxn matrices AB C The idea of random evaluation can be used to efficiently check the What does evaluate mean Just evaluate the function C on a random bit vector r by taking the matrix vector product C r 1 0 3 4 8 1 0 7 0 0 2 9 0 9 13 5 6 0 7 1 1 6 21 9 0 1 0 7 31 So to test if AB C we compute x Br y Ax Abr and z Cr If y z we take this as evidence that the calculation was correct The amount of work is only O n2 Claim If AB C and r is a random n bit vector then Pr ABr Cr Claim If AB C and r is a random n bit vector then Pr ABr Cr So if a complicated fancy algorithm is used to compute AB in time O n it can be efficiently checked with only O n2 extra work using randomness Random Fingerprinting Find a small random fingerprint of a large object the value f z of a polynomial at a point z the value Cr at a random bit vector r This fingerprint captures the essential information about the larger object if two large objects are different their fingerprints usually are different Earth has huge file X that she transferred to Moon Moon gets Y Did you get that file ok Was the transmission accurate Uh yeah Earth X Moon Y Let n be the number of primes between 1 and n Legendre I wonder how fast n grows Conjecture 1790s p n lim n Gauss n ln n 1 Their estimates x pi x Gauss Li Legendre x log x 1 1000 168 178 172 169 10000 1229 1246 1231 1218 100000 9592 9630 9588 9512 1000000 78498 78628 78534 78030 10000000 664579 664918 665138 661459 100000000 5761455 5762209 5769341 5740304 1000000000 50847534 50849235 50917519 50701542 10000000000 45505251 1 455055614 455743004 454011971 De la Vall e Poussin J S Hadamard Two independent proofs of the Prime Density Theorem 1896 p n lim 1 n n ln n The Prime Density Theorem This theorem remains one of the celebrated achievements of number theory In fact an even sharper conjecture remains one of the great open problems of mathematics The Riemann Hypothesis 1859 p n n ln n lim 0 n n Riemann Slightly easier to show n n 1 2 logn Random logn bit number is a random number from 1 n n n 1 2logn means that a random logn bit number has at least a 1 2logn chance of being prime Random k bit number is a random number from 1 2k 2k 2k 1 2k means that a random k bit number has at least a 1 2k chance of being prime Really useful fact A random k bit number has at least a 1 2k chance of being prime So if we pick 2k random k bit numbers the expected number of primes on the list is at least 1 Picking A Random Prime Many modern cryptosystems e g RSA include the instructions Pick a random n bit prime How can this be done efficiently Picking A Random Prime Pick a random n bit prime Strategy 1 Generate random n bit numbers 2 Test each one for primality more on this later in the lecture Picking A Random Prime Pick a random n bit prime 1 Generate kn random n bit numbers Each trial has a 1 2n chance of being prime Pr all kn trials kn yield composites 2n k 2 1 1 2n 1 1 2n 1 ek 2 Picking A Random Prime Pick a random n bit prime Strategy 1 Generate random n bit numbers 2 Test each one for primality For 1000 bit primes if we try out 10000 random 1000 bit numbers chance of failing e 5 Moral of the story Picking a random prime is almost as easy as picking a random number Provided we can check for primality More on this later Earth has huge file X that she transferred to Moon Moon gets Y Did you get that file ok Was the transmission accurate Uh yeah Earth X Moon Y Are X and Y the same n bit numbers p random 2logn bit prime Send p X mod p Answer to X Y mod p Earth X Moon Y Why is this any good Easy case If X Y then X Y mod p Why is this any good Harder case What if X Y We mess up if p X Y Define Z X Y To mess up p must divide Z Z is an n bit number Z is at most 2n But each prime 2 Hence Z has at most n prime divisors Almost there Z has at most n prime divisors How many 2logn bit primes A random k bit number has at least a 1 2k chance of being prime at least 22logn 2 2logn n2 4logn 2n …
View Full Document
Unlocking...