Computability and Computational Complexity

Total Page:16

File Type:pdf, Size:1020Kb

Computability and Computational Complexity Computability and computational complexity Lecture 10: Randomized computation Ion Petre Computer Science, Åbo Akademi University Fall 2015 http://users.abo.fi/ipetre/computability/ December 2, 2015 http://users.abo.fi/ipetre/computability/ 1 Content n Monte Carlo algorithms: examples n Random walk n Randomized complexity classes q RP q ZPP q PP q BPP n Sources of randomness December 2, 2015 http://users.abo.fi/ipetre/computability/ 2 MONTE CARLO ALGORITHMS: EXAMPLES December 2, 2015 http://users.abo.fi/ipetre/computability/ 3 PRIMES n Very important to be able to generate (very) large primes – e.g., in cryptography (RSA) n No practical techniques to yield large prime numbers RSA scheme n Procedure: generate random odd numbers and test –Key generation whether that integer is prime •Choose primes p,q n Testing whether or not an integer n is a prime is a •Compute n=pq difficult problem (“primality is difficult”) •Choose e, 1<e<f(n) with gcd(f(n),e)=1 •Compute dºe-1 mod f(n) q There has been a long standing question in math whether or not primality can be tested in polynomial •Private key is {d,n} deterministic time •Public key is {e,n} q Answer (2002): YES! –Encryption e q Manindra Agrawal, Neeraj Kayal and Nitin Saxena, •C=M mod n “PRIMES is in P”, Ann. of Math. (2), 160:2 (2004) 781-- –Decryption: 793. •Cd mod n = Mde mod n = M 12 q Drawback: high complexity – O((log n) f(log log n)), where f is a polynomial n RSA typically uses primes on 1024-2048 bits 6 q Subsequently improved to O((log n) f(log log n)) December 2, 2015 http://users.abo.fi/ipetre/computability/ 4 Miller-Rabin primality test n Faster methods of testing primality exist – they are all probabilistic q Such an algorithm can give two answers to the question “Is n prime?” n No, it is not n n is probably prime n The probability can be made arbitrarily large q Other types of randomized algorithms may give a precise answer but with low probability they may take a long time to finish n Most popular primality test: Miller- Rabin, based on Fermat’s little theorem December 2, 2015 http://users.abo.fi/ipetre/computability/ 5 Fermat’s little theorem n Fermat’s little theorem: if p is prime and a is positive integer not divisible by p, then ap-1 º 1 mod p n Corollary: For any positive integer a and prime p, ap º a mod p n Comments: q Fermat’s little theorem provides a necessary condition for an integer p to be prime – the condition is not sufficient n We will turn this theorem into a (probabilistic) test for primality December 2, 2015 http://users.abo.fi/ipetre/computability/ 6 Miller-Rabin primality test Fermat’s little theorem: if p is prime and a is positive integer not divisible by p, then ap-1 º 1 mod p •Question: for how many integers a does the test fail? TEST(n) •Failure: n is not prime but the algorithm return 1. n-1=2kq: compute k and q “probably prime” •Answer: for at most (n-1)/4 integers a with 1£a£n-1 2. Select a random integer a, •Thus, the probability of failure is at most ¼ 1<a<n-1 •Practical implementation: 3. If aqmod n=1 then return •Repeatedly invoke TEST(n) using random “probably prime” choices for a •If TEST(n) return at least once “not a prime”, 4. For j=0 to k-1 do then n is not a prime 2jq 5. If a mod n = n-1, then return •If t executions of TEST(n) return “probably “probably prime” prime”, then the probability that n is indeed a 6. Return “not a prime” prime is larger than 1-4-t •t=10 gives probability larger than 0.999999 December 2, 2015 http://users.abo.fi/ipetre/computability/ 7 Miller-Rabin primality test n Fermat’s little theorem: if p is prime and a is positive integer not divisible by p, then ap-1 º 1 mod p n Idea of the Miller-Rabin test: q We need to test if the odd integer n is prime: test the equality in Fermat’s little theorem for n and a random a n A speedup may be done so that we do not have to compute all powers of a – details bellow k q n-1 is even, i.e., of the form n-1=2 q, with k>0, q odd: k and q easy to find q Choose an integer a such that 1<a<n-1 2jq q 2q 2k-1q 2kq q Compute modulo n the values a , 0≤j≤q: a , a ,…, a , a q By Fermat’s theorem, if n is prime, then the last value in the sequence is 1 – the sequence may have some other 1s, consider the first 1 in the sequence n Case 1: the first number in the sequence is 1 – then all other powers are also 1 j j-1 n Case 2: some number a2 q in the sequence is 1 – in this case a2 q = n-1 mod n j j-1 j-1 j-1 j-1 q 0 = (a2 q -1) mod n = (a2 q – 1) (a2 q + 1) mod n, i.e., n divides (a2 q – 1) or (a2 q + 1) j-1 j-1 q Since we took the first 1 in the sequence, it follows that n divides (a2 q + 1): a2 q = n-1 mod n q The test: if either the first element in the sequence is 1, or some element before the last is n-1, then n could be prime. Otherwise n is certainly not prime December 2, 2015 http://users.abo.fi/ipetre/computability/ 8 Monte-Carlo algorithms n Definition: Monte-Carlo algorithms q Polynomial-time randomized algorithms: it finishes in polynomial time for all random choices q No false positives: if the algorithm says “yes”, then the result is certain q There might be false negatives: the algorithm does not answer “no” but rather “probably not” q Probability of false negatives is less than 1 n For random choices we assume the existence of a fair coin that generates perfectly random bits (re-discuss sources of randomness later in this lecture) n Important note: by repeating the algorithm in case of a negative answer we can make the probability of a false negative arbitrarily small q p<1 is the probability of a false negative k q getting a false negative in k consecutive runs of the algorithm is p , which decreases to 0 as k increases q running time remains polynomial even if we repeat the algorithm k times December 2, 2015 http://users.abo.fi/ipetre/computability/ 9 Random walks n A randomized algorithm for SAT q start with an arbitrary truth assignment T and repeat the following r times n if all clauses are satisfied, then reply “satisfiable” and halt n otherwise, take any unsatisfied clause: all of its literals are false under T n pick any of these literals and flip its truth value, updating T q after r iterations, reply “probably unsatisfiable” and halt n This is called a random walk algorithm: random path through the possible truth assignments n If the formula is unsatisfiable, then the algorithm answers well: “probably unsatisfiable” n If the formula is satisfiable: q easy to show that if we allow exponentially many repetitions, then a satisfying truth assignment can be found with high probability q Question: how about if we only try a number of times r that is polynomial in the number of variables? n main problem: the (very) large probability of false negatives q Answer: It does not work well for (some instances of) 3SAT! But it works for 2SAT! December 2, 2015 http://users.abo.fi/ipetre/computability/ 10 Random walks and 2SAT n Theorem. Suppose that the random walk algorithm with r=2n2 is applied to any satisfiable instance of 2SAT with n variables. Then the probability that a satisfying truth assignment will be discovered is at least ½. n Important technical result for the proof of the theorem (even though we skip it here): n Lemma. If x is a random variable taking nonnegative integer values, then for any k>0, P(x³k×E(x))£1/k, where E(x) is the expected value of x. December 2, 2015 http://users.abo.fi/ipetre/computability/ 11 RANDOMIZED COMPLEXITY CLASSES December 2, 2015 http://users.abo.fi/ipetre/computability/ 12 Randomized complexity classes n Several types of randomized algorithms exist q Monte Carlo q Las Vegas q Decision reached by simple majority q Decision reached by strong majority q … n Discuss here several of these concepts and the relationships among them n Also discuss how to implement randomized algorithms in practice December 2, 2015 http://users.abo.fi/ipetre/computability/ 13 Randomized complexity classes: RP n We only consider here polynomial-time bounded nondeterministic TM N standardized as follows: q N is precise (all nondeterministic computations halt after exactly the same number of steps) q there are exactly two nondeterministic choices in each step of N n Definition. Let L be a language. A polynomial Monte Carlo TM for L is a nondeterministic TM standardized as above such that: q each computation on an input of size n halts in exactly p(n) steps p(|x|) q if xÎL, then at least half of the 2 computations halt with “yes” q if xÏL, then all computations halt with “no” q In other words, no false positives and false negatives with a probability not more than ½ n The class of all languages with polynomial Monte Carlo TM is denoted RP (randomized polynomial time) December 2, 2015 http://users.abo.fi/ipetre/computability/ 14 RP n RP q N is precise (all nondeterministic computations halt after exactly the same number of steps) q there are exactly two nondeterministic choices in each step of N q each computation on an input of size n halts in exactly p(n) steps p(|x|) q if xÎL, then at least half of the 2 computations halt with “yes” q if xÏL, then all computations halt with “no” December 2, 2015 http://users.abo.fi/ipetre/computability/ 15 Discussion n The class RP remains the same if we replaced the condition that the probability of acceptance is at least half with a number strictly between 0 and 1 q Argument based on repeating the TM computation enough many times n What is the relationship between RP and P, NP? q clearly somewhere between P and NP n any polynomial Monte Carlo algorithm is by definition a nondeterministic polynomial-time algorithm
Recommended publications
  • Primality Testing for Beginners
    STUDENT MATHEMATICAL LIBRARY Volume 70 Primality Testing for Beginners Lasse Rempe-Gillen Rebecca Waldecker http://dx.doi.org/10.1090/stml/070 Primality Testing for Beginners STUDENT MATHEMATICAL LIBRARY Volume 70 Primality Testing for Beginners Lasse Rempe-Gillen Rebecca Waldecker American Mathematical Society Providence, Rhode Island Editorial Board Satyan L. Devadoss John Stillwell Gerald B. Folland (Chair) Serge Tabachnikov The cover illustration is a variant of the Sieve of Eratosthenes (Sec- tion 1.5), showing the integers from 1 to 2704 colored by the number of their prime factors, including repeats. The illustration was created us- ing MATLAB. The back cover shows a phase plot of the Riemann zeta function (see Appendix A), which appears courtesy of Elias Wegert (www.visual.wegert.com). 2010 Mathematics Subject Classification. Primary 11-01, 11-02, 11Axx, 11Y11, 11Y16. For additional information and updates on this book, visit www.ams.org/bookpages/stml-70 Library of Congress Cataloging-in-Publication Data Rempe-Gillen, Lasse, 1978– author. [Primzahltests f¨ur Einsteiger. English] Primality testing for beginners / Lasse Rempe-Gillen, Rebecca Waldecker. pages cm. — (Student mathematical library ; volume 70) Translation of: Primzahltests f¨ur Einsteiger : Zahlentheorie - Algorithmik - Kryptographie. Includes bibliographical references and index. ISBN 978-0-8218-9883-3 (alk. paper) 1. Number theory. I. Waldecker, Rebecca, 1979– author. II. Title. QA241.R45813 2014 512.72—dc23 2013032423 Copying and reprinting. Individual readers of this publication, and nonprofit libraries acting for them, are permitted to make fair use of the material, such as to copy a chapter for use in teaching or research. Permission is granted to quote brief passages from this publication in reviews, provided the customary acknowledgment of the source is given.
    [Show full text]
  • CS265/CME309: Randomized Algorithms and Probabilistic Analysis Lecture #1:Computational Models, and the Schwartz-Zippel Randomized Polynomial Identity Test
    CS265/CME309: Randomized Algorithms and Probabilistic Analysis Lecture #1:Computational Models, and the Schwartz-Zippel Randomized Polynomial Identity Test Gregory Valiant,∗ updated by Mary Wootters September 7, 2020 1 Introduction Welcome to CS265/CME309!! This course will revolve around two intertwined themes: • Analyzing random structures, including a variety of models of natural randomized processes, including random walks, and random graphs/networks. • Designing random structures and algorithms that solve problems we care about. By the end of this course, you should be able to think precisely about randomness, and also appreciate that it can be a powerful tool. As we will see, there are a number of basic problems for which extremely simple randomized algorithms outperform (both in theory and in practice) the best deterministic algorithms that we currently know. 2 Computational Model During this course, we will discuss algorithms at a high level of abstraction. Nonetheless, it's helpful to begin with a (somewhat) formal model of randomized computation just to make sure we're all on the same page. Definition 2.1 A randomized algorithm is an algorithm that can be computed by a Turing machine (or random access machine), which has access to an infinite string of uniformly random bits. Equivalently, it is an algorithm that can be performed by a Turing machine that has a special instruction “flip-a-coin”, which returns the outcome of an independent flip of a fair coin. ∗©2019, Gregory Valiant. Not to be sold, published, or distributed without the authors' consent. 1 We will never describe algorithms at the level of Turing machine instructions, though if you are ever uncertain whether or not an algorithm you have in mind is \allowed", you can return to this definition.
    [Show full text]
  • Lecture 1: January 21 Instructor: Alistair Sinclair
    CS271 Randomness & Computation Spring 2020 Lecture 1: January 21 Instructor: Alistair Sinclair Disclaimer: These notes have not been subjected to the usual scrutiny accorded to formal publications. They may be distributed outside this class only with the permission of the Instructor. 1.1 Introduction There are two main flavors of research in randomness and computation. The first looks at randomness as a computational resource, like space and time. The second looks at the use of randomness to design algorithms. This course focuses on the second area; for the first area, see other graduate classes such as CS278. The starting point for the course is the observation that, by giving a computer access to a string of random bits, one can frequently obtain algorithms that are far simpler and more elegant than their deterministic counterparts. Sometimes these algorithms can be “derandomized,” although the resulting deterministic algorithms are often rather obscure. In certain restricted models of computation, one can even prove that randomized algorithms are more efficient than the best possible deterministic algorithm. In this course we will look at both randomized algorithms and random structures (random graphs, random boolean formulas etc.). Random structures are of interest both as a means of understanding the behavior of (randomized or deterministic) algorithms on “typical” inputs, and as a mathematically clean framework in which to investigate various probabilistic techniques that are also of use in analyzing randomized algorithms. 1.1.1 Model of Computation We first need to formalize the model of computation we will use. Our machine extends a standard model (e.g., a Turing Machine or random-access machine), with an additional input consisting of a stream of perfectly random bits (fair coin flips).
    [Show full text]
  • Randomized Algorithms 2018/9A Lecture 1 ∗ Min Cut Algorithm, Closest Pairs, (Multi)-Set Equality
    Randomized Algorithms 2018/9A Lecture 1 ∗ Min Cut Algorithm, Closest Pairs, (Multi)-Set Equality Moni Naor The lecture introduces randomized algorithms. Why are they interesting? They may solve problems faster than deterministic ones, they may be essential in some settings, especially when we want to go to the sublinear time complexity realm1, they are essential in distributed algorithms e.g. for breaking symmetry, they yield construction of desirable objects that we do not know how to build explicitly and are essential for cryptography2 and privacy3. Another type of study is to analyze algorithms when assuming some distribution on the input, or some mixture of worst case and then a perturbation of the input (known as smoothed analysis). But our emphasis would be worst case data where the randomness is created independently of it. That is we assume the algorithm or computing device in addition to the inputs gets also a random `tape' (like the other tapes of the Turing Machine, but this one with truly random symbols). One nice feature that some randomized algorithms have is that they are simple. We demonstrated this in three algorithms in three different scenarios. Randomized algorithms existed for a long time, since the dawn of computing (for instance the numerical \Monte Carlo Method"4 from the 1940's or Shannon's work [9], also from that time. Later, when people started arguing rigorously about the running time of programs, the idea of complexity classes of probabilistic machines emerged. We mentioned three such classes: RP , Co − RP and BP P . The common conjecture is that P = BP P and it is known to hold under the assumption that there are sufficiently good pseudo-random generators, that is a function G : f0; 1g∗ 7! f0; 1g∗ that stretches its input significantly and the output cannot be distinguished from random.
    [Show full text]
  • Advanced Algorithm
    Advanced Algorithm Jialin Zhang [email protected] Institute of Computing Technology, Chinese Academy of Sciences March 21, 2019 Jialin Advanced Algorithm A Randomized Algorithm for Min-Cut Problem Contrast Algorithm: 1 Pick an edge uniformly at random; 2 Merge the endpoints of this edge; 3 Remove self-loops; 4 Repeat steps 1-3 until there are only two vertices remain. 5 The remaining edges form a candidate cut. Jialin Advanced Algorithm Min Cut 1 Successful probability: Ω( n2 ). Time complexity: O(n2). Improvement? FastCut algorithm Ref: Randomized Algorithm - Chapter 10:2. Algorithm FastCut runs in O(n2 log n) time and uses O(n2) space. 1 Successful Probability is Ω( log n ). Jialin Advanced Algorithm Homework 1 Prove the successful probability for FastCut algorithm is 1 Ω( log n ). 2 Randomized Algorithm - Exercise 10:9, Page 293. Jialin Advanced Algorithm Homework (optional) We define a k-way cut-set in an undirected graph as a set of edges whose removal breaks the graph into k or more connected components. Show that the randomized min-cut algorithm can be modified to find a minimum k-way cut-set in O(n2(k−1)) time. Hints: 1 When the graph has become small enough, say less than 2k vertices, you can apply a deterministic k-way min-cut algorithm to find the minimum k-way cut-set without any cost. 2 To lower bound the number of edges in the graph, one possible way is to sum over all possible trivial k-way, i.e. k − 1 singletons and the complement, and count how many times an edge is (over)-counted.
    [Show full text]
  • Notes on Primality Testing and Public Key Cryptography Part 1: Randomized Algorithms Miller–Rabin and Solovay–Strassen Tests
    Notes on Primality Testing And Public Key Cryptography Part 1: Randomized Algorithms Miller{Rabin and Solovay{Strassen Tests Jean Gallier and Jocelyn Quaintance Department of Computer and Information Science University of Pennsylvania Philadelphia, PA 19104, USA e-mail: [email protected] c Jean Gallier February 27, 2019 Contents Contents 2 1 Introduction 5 1.1 Prime Numbers and Composite Numbers . 5 1.2 Methods for Primality Testing . 6 1.3 Some Tests for Compositeness . 9 2 Public Key Cryptography 13 2.1 Public Key Cryptography; The RSA System . 13 2.2 Correctness of The RSA System . 18 2.3 Algorithms for Computing Powers and Inverses Modulo m . 22 2.4 Finding Large Primes; Signatures; Safety of RSA . 26 3 Primality Testing Using Randomized Algorithms 33 4 Basic Facts About Groups, and Number Theory 37 4.1 Groups, Subgroups, Cosets . 37 4.2 Cyclic Groups . 50 4.3 Rings and Fields . 60 4.4 Primitive Roots . 67 4.5 Which Groups (Z=nZ)∗ Have Primitive Roots . 75 4.6 The Lucas Theorem, PRIMES is in NP .................... 80 4.7 The Structure of Finite Fields . 90 5 The Miller{Rabin Test 93 5.1 Square Roots of Unity . 94 5.2 The Fermat Test; F -Witnesses and F -Liars . 96 5.3 Carmichael Numbers . 99 5.4 The Miller{Rabin Test; MR-Witnesses and MR-Liars . 103 5.5 The Monier{Rabin Bound on the Size of the Set of MR-Liars . 116 5.6 The Least MR-Witness for n . 121 6 The Solovay{Strassen Test 125 6.1 Quadratic Residues .
    [Show full text]
  • Randomized Algorithms We Already Learned Quite a Few Randomized Algorithms in the Online Algorithm Lectures
    Randomized Algorithms We already learned quite a few randomized algorithms in the online algorithm lectures. For example, the MARKING algorithm for paging was a randomized algorithm; as well as the Randomized Weighted Majority. In designing online algorithms, randomization provides much power against an oblivious adversary. Thus, the worst case analysis (the worst case of the expectation) may become better by using randomization. We also noticed that randomization does not provide as much power against the adaptive adversaries. We’ll study some examples and concepts in randomized algorithms. Much of this section is based on (Motwani and Raghavan, Randomized Algorithm, Chapters 1, 5, 6). Random QuickSort Suppose is an array of numbers. Sorting puts the numbers in ascending order. The quick sort is one of the fastest sorting algorithm. QuickSort: 1. If is short, sort using insertion sort algorithm. 2. Select a “pivot” arbitrarily. 3. Put all members in and others in . 4. QuickSort and , respectively. | | Suppose the choice of is such that | | | | , then the time complexity is ( ) | | | | ( ). By using Master’s theorem, ( ) ( ). This is even true for | | . For worst case analysis, QuickSort may perform badly because may be such that and are awfully imbalanced. So the time complexity becomes ( ). If we don’t like average analysis, which is venerable to a malicious adversary, we can do randomization. RandomQS: In QuickSort, select the pivot uniformly at random from . Theorem 1: The expected number of comparisons in an execution of RandomQS is at most , where is the -th harmonic number. Proof: Clearly any pair of elements are compared at most once during any execution of the algorithm.
    [Show full text]
  • Monte Carlo Algorithm (10C)
    Monte Carlo Algorithm (10C) Young Won Lim 5/31/17 Copyright (c) 2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Please send corrections (or suggestions) to [email protected]. This document was produced by using OpenOffice and Octave. Young Won Lim 5/31/17 Monte Carlo ● Monte Carlo Method (Monte Carlo Simulation) ● Monte Carlo Algorithm Young Won Lim Monte Carlo Algorithm (10C) 3 5/31/17 Monte Carlo Method a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. Their essential idea is using randomness to solve problems that might be deterministic in principle. They are often used in physical and mathematical problems and are most useful when it is difficult or impossible to use other approaches. used in three distinct problem classes: ● optimization, ● numerical integration ● generating draws from a probability distribution. https://en.wikipedia.org/wiki/Monte_Carlo_method Young Won Lim Monte Carlo Algorithm (10C) 4 5/31/17 Patterns of Monte Carlo Methods Monte Carlo methods vary, but tend to follow a particular pattern: ● Define a domain of possible inputs. ● Generate inputs randomly from a probability distribution over the domain. ● Perform a deterministic computation on the inputs. ● Aggregate the results. https://en.wikipedia.org/wiki/Monte_Carlo_method Young Won Lim Monte Carlo Algorithm (10C) 5 5/31/17 Examples of Monte Carlo Methods For example, consider a circle inscribed in a unit square.
    [Show full text]
  • Randomized Algorithms
    Randomized Algorithms 1. Concepts of randomized algorithms 2. Randomize algorithm analysis 3. Randomized complexity classes 4. Pseudorandom number generation 5. Global min-cut problem 6. Maximum 3-SAT 7. Primality test CP412 ADAII Introduction # 1 1. Concepts of randomized algorithms • A randomized algorithm is an algorithm whose working not only depends on the input but also on certain random choices made by the algorithm during the execution – A randomized algorithm depends on random numbers for its operation – Assume that we have a random number generator Random(a, b) that generates for two integers a, b with a < b an integer r with a <=r <= b uniformly at random. In other words. We assume that Random(a, b) runs in O(1) time. Examples randomized quick sort: randomly choose a pivoting element CP412 ADAII Introduction # 2 Deterministic vs Randomized algorithms Boolean equivalence problem: given two boolean functions f1(x1, .., xn) and f2(x1, …, xn), question: f1=f2 ? Deterministic algorithm: for each X in the enumeration of {0, 1}n if f1(X) != f2(X) return false; return true Randomized algorithm (probabilistic algorithms): for k from 1 to N (or while true), randomly choose X from {0, 1}n if f1(X) != f2(X) return false; return true Note that “true” output of the above probabilistic algorithm may not be correct. But the “false” output is an correct answer. CP412 ADAII Introduction # 3 Two types of randomized algorithms • Las Vegas algorithms – use the randomness to reduce the expected running time or memory usage of computing process, but always terminate with a correct result in a bounded amount of time.
    [Show full text]
  • Randomized Algorithms 2
    15-251 Great Theoretical Ideas in Computer Science Lecture 20: Randomized Algorithms November 5th, 2015 So far Formalization of computation/algorithm Computability / Uncomputability Computational complexity Graph theory and graph algorithms NP-completeness. Identifying intractable problems. Making use of intractable problems (in Social choice). Dealing with intractable problems: Approximation algs. Online algs. Next Randomness and the universe Does the universe have true randomness? Newtonian physics suggests that the universe evolves deterministically. Quantum physics says otherwise. Randomness and the universe Does the universe have true randomness? God does not play dice with the world. - Albert Einstein Einstein, don’t tell God what to do. - Niels Bohr Randomness and the universe Does the universe have true randomness? Even if it doesn’t, we can still model our uncertainty about things using probability. Randomness is an essential tool in modeling and analyzing nature. It also plays a key role in computer science. Randomness in computer science Randomized algorithms Does randomness speed up computation? Statistics via sampling e.g. election polls Nash equilibrium in Game Theory Nash equilibrium always exists if players can have probabilistic strategies. Cryptography A secret is only as good as the entropy/uncertainty in it. Randomness in computer science Randomized models for deterministic objects e.g. the www graph Quantum computing Randomness is inherent in quantum mechanics. Machine learning theory Data is generated by some probability
    [Show full text]
  • Lecture 2 — 31 August 2014 1 Overview 2 Food for Thought 3 Probability Background
    CS 388R: Randomized Algorithms Fall 2015 Lecture 2 | 31 August 2014 Prof. Eric Price Scribe: Sid Kapur, Neil Vyas 1 Overview In this lecture we will first introduce some probability machinery: linearity of expectation, the central limit theorem, and the discrete-setting Chernoff bound. We will then apply these tools to some simple problems: repeated Bernoulli trials and the coupon collecting problem. Finally, we will discuss how randomized algorithms fit in to the landscape of complexity theory. 2 Food for Thought 1. Suppose you flip an unbiased coin 1000 times. How surprised would you be if we observed • 500 heads? • 510 heads? • 600 heads? • 1000 heads? 2. Suppose you have a biased coin that lands heads with an unknown probability p. How many flips will it take to learn p to an error of ± with probability 1 − δ? 3 Probability Background Theorem 1. Linearity of expectation. If X1;:::;Xn are random variables, then " n # n X X E Xi = E[Xi] i=1 i=1 Pn Example: Suppose X1;:::;Xn are Bernoulli trials with p = 0:5. Let X = i=1 Ei. Then n X n [X] = [X ] = E E i 2 i=1 Definition 2. The variance of a random variable X, denoted Var[X], is defined as 2 Var[X] = E (X − E[X]) 1 Observation 3. Note that if Y1 and Y2 are independent random variables with E[Y1] = E[Y2] = 0, then 2 Var[Y1 + Y2] = E (Y1 + Y2) 2 2 = E Y1 + Y2 + 2Y1Y2 2 2 = E Y1 + E Y2 + 2 E[Y1] E[Y2] (since Y1 and Y2 are independent) 2 2 = E Y1 + E Y2 = Var[Y1] + Var[Y2] Claim 4.
    [Show full text]
  • Primality Testing∗
    Primality Testing∗ Richard P. Brent MSI & CECS, ANU 24 August 2010 ∗ Copyright c 2010, R. P. Brent. Abstract For many years mathematicians and computer scientists have searched for a fast and reliable primality test. This is especially relevant nowadays, because the popular RSA public-key cryptosystem requires very large primes in order to generate secure keys. I will describe some efficient randomised algorithms that are useful, but have the defect of occasionally giving the wrong answer, or taking a very long time to give an answer. In 2002, Agrawal, Kayal and Saxena (AKS) found a deterministic polynomial-time algorithm1 for primality testing. I will describe the original AKS algorithm and some improvements by Bernstein and Lenstra. As far as theory is concerned, we now know that “PRIMES is in P”, and this appears to be the end of the story. However, I will explain why it is preferable to use randomised algorithms in practice. 1Not mentioned on page 983 of the textbook! 2 First, some notation As usual, we say that f(n) = O(nk) if, for some c and n , for all n n , 0 ≥ 0 f(n) cnk . | | ≤ We say that f(n) = O(nk) if, for some c 0, e ≥ f(n) = O(nk(log n)c) . The “O” notation is useful to avoid terms like log n and loglog n. For example, when referring e to the Sch¨onhage-Strassen algorithm for n-bit integer multiplication, it is easier to write O(n) than the (more precise)e O(n log n log log n) . 3 Complexity Classes (informal) P is the class of decision (“yes”/“no”) problems that have a deterministic polynomial time algorithm, i.e.
    [Show full text]