Slide 1Slide 2Super-simple and powerful ideaDrawing balls at randomSlide 5even simpler idea…Repeated experimentsthe following (trivial) questionRepresenting numbersSlide 10Finally, remember this bit of algebraThe Fundamental theorem of AlgebraHow to check your work…Checking Our WorkIdea: Evaluate on Random InputsEquality checking by random evaluationSlide 17Slide 18Slide 19Slide 20“Random Fingerprinting”Earth has huge file X that she transferred to Moon. Moon gets Y.How do you pick a random 1000-bit prime?Picking A Random PrimeHow many retries until we succeed?Slide 26Slide 27Their estimatesSlide 29The Prime Density TheoremSlide 31Slide 32So, for this algo…the facts are these:Moral of the storySlide 36Are X and Y the same N-bit numbers?Why is this any good?Slide 39Almost there…Slide 41Boosting the success probabilityExponentially smaller error probabilitySlide 44Primality Testing: Trial Division On Input nSlide 46Slide 47Slide 48Slide 49Slide 50Slide 51simple idea #2ProofRandomized Primality TestIs Goodn non-empty for all primes n?The saving graceSlide 57Slide 58Slide 59Slide 60Slide 6115-251Great Theoretical Ideas in Computer ScienceRandomness and ComputationLecture 16 (October 16, 2008)Super-simple and powerful ideaDrawing balls at randomYou have a bucket with n ballsthere are n/100 green balls (good)the remaining are red (bad)What is the probability of drawing a good ballif you draw a random ball from the bucket?Now if you draw balls from the bucket at random(with replacement), how many draws until you draw a good ball?Drawing balls at randomYou have a bucket with n ballsthere are k green balls (good)the remaining are red (bad)Probability of getting a good ball= k/n.Expected number of draws until a good ball= n/k.even simpler idea…Repeated experimentsSuppose you run a random experiment that fails with probability ¼ independent of the past.What is the probability that you succeed in k steps?= 1 – probability you fail in all k steps= 1 – (¼)kIf probability of failure was at most ±, thenprobability of success at least once in k steps is at least 1 - ±kthe following (trivial) questionRepresenting numbersQuestion:Given two numbers a and b, both ¼ n,how long does it take to add them together?a) ¼ nb) ¼ nc) ¼ log nd) ¼ 2nRepresenting the number n takes ¼ log n bitsRepresenting numbersSuppose I want to sell you (for $1M) an algorithm that takes as input a number n, and factors them in ≈ n time, should you accept my offer?Factoring fast breaking RSA!Finally, remember this bit of algebraThe Fundamental theorem of AlgebraA root of a polynomial p(x) is a value r, such that p(r) = 0.If p(x) is a polynomial of degree d, how many roots can it have?At most d.How to check your work…Checking Our WorkSuppose 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-1If the polynomials have degree n, 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?Idea: Evaluate on Random InputsLet f(x) = p(x) q(x) – r(x). Is f zero everywhere?Idea: Evaluate f on a random input z.If we get nonzero f(z), clearly f is not zero.If we get f(z) = 0, this is (weak) 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 evaluation1. Say S = {1, 2, …, 4n}2. Select value z uniformly at random from S.3. Evaluate f(z) = p(z) q(z) – r(z)4. If f(z) = 0, output “possibly equal” otherwise output “not equal”Equality checking by random evaluationWhat 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 evaluationWhat is the probability the algorithm outputs “maybe equal” when in fact f 0?Let A = {z | z is a root of f}. Recall that |A| degree of f ≤ 2n.Therefore: P(picked a root) 2n/4n = 1/2Equality checking by random evaluationBy repeating this procedure k times, we are “fooled” by the event f(z1) = f(z2) = … = f(zk) = 0 when actually f(x) 0with probability no bigger than P(picked root k times) (½)^2This idea can be used for testing equality of lots of different types of “functions”!“Random Fingerprinting”Find a small random “fingerprint” of a large object: e.g., the value f(z) of a polynomial at a point z.This fingerprint captures the essential information about the larger object: if two large objects are different, their fingerprints are usually different!Earth has huge file X that she transferred to Moon. Moon gets Y.Earth: XEarth: X Moon: YDid you get that file ok? Was Did you get that file ok? Was the transmission accurate?the transmission accurate?Uh, yeah….How do we quickly check for accuracy? More soon… I guess….How do you pick a random 1000-bit prime?Picking A Random Prime“Pick a random 1000-bit prime.”Strategy:1) Generate random 1000-bit number2) Test each one for primality [more on this later in the lecture]3) Repeat until you find a prime.How many retries until we succeed?Recall the balls-from-bucket experiment?If n = number of 1000-bit numbers = 21000and k = number of primes in 0 … 21000-1 then E[number of rounds] = n/k.Question:How many primes are there between 1 and n?(approximately…)GaussLet (n) be the number of primes between 1 and n. I wonder how fast (n) grows? Conjecture [1790s]: ( )lim 1/ lnnnn np��=LegendreTheir estimatesx pi(x) Gauss' Li Legendre x/(log x - 1)1000 168 178 172 16910000 1229 1246 1231 1218100000 9592 9630 9588 95121000000 78498 78628 78534 7803010000000 664579 664918 665138 661459100000000 5761455 5762209 5769341 57403041000000000 50847534 50849235 50917519 5070154210000000000455052511455055614 455743004 454011971J-S HadamardTwo independent proofs of the Prime Density Theorem [1896]:( )lim 1/ lnnnn np��=De la Vallée PoussinThe Prime Density TheoremThis 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!RiemannThe Riemann Hypothesis [1859]: still unproven!( ) / lnlim 0nn n nnp��-=( )lim 1/ lnnnn np��=The Prime Density TheoremSlightly easier to show (n)/n ≥ 1/(2 logn).In other words, at least (1/2B) of all B-bit
View Full Document