Lecture 2 — 31 August 2014 1 Overview 2 Food for Thought 3 Probability Background

Total Page:16

File Type:pdf, Size:1020Kb

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. We claim (without proof) that if Y1 and Y2 are independent, then Var[Y1 + Y2] = Var[Y1] + Var[Y2] (i.e. E[Y1] and E[Y2] need not be zero). Pn Example: Suppose X1;:::;Xn are independent Bernoulli trials with p = 0:5. Let X = i=1 Ei. Then n X Var[X] = Var[Xi] (by Claim ??) i=1 " # 1 12 1 12 = n + 2 2 2 2 n = 4 If n = 1000, then Var[X] = 250 and the standard deviation of X = pVar[X] ≈ 16. Theorem 5. The central limit theorem Suppose X1;:::;Xn are independent identically dis- tributed random variables with expected value µ and variance σ2. X1+···+Xn Then as n ! 1, the sample average Sn = n converges to the Gaussian σ2 N µ, n Some statements of the central limit theorem give bounds on convergence, but unfortunately these bounds are not tight enough to be useful in this example. By the central limit theorem, as the number of coin tosses goes to infinity, our binomial distribution 2 n 2 n of coin tosses converges to a Gaussian N(µ, σ ) where µ = 2 and σ = 4 , as we calculated above. 4 Bounding the Sum of Bernoulli Trials Let's return to our coin-tossing problem. Can we find an upper bound on the probability that the number of coin tosses exceeds a certain number? 2 Claim 6. If Z is drawn from a Gaussian with mean µ and variance σ2, then 2 − t P[Z ≥ µ + t] ≤ e 2σ2 8t ≥ 0 2 − t P[Z ≤ µ − t] ≤ e 2σ2 8t ≥ 0 (We omit the proof.) If our distribution were Gaussian (or if we were willing to invoke the central limit theorem), we could use the bound from Claim ??: 2 − t P[X ≥ 500 + σt] ≤ e 2 2 − t ) P[X ≥ 500 + 16t] ≤ e 2 −18 ) P[X ≥ 600] ≤ e But unfortunately, we have a binomial distribution, not a Gaussian, and we don't want to use the central limit theorem. What should we do? Pn Definition 7. Chernoff bound (for the discrete setting) Let X = i=1 Xi, where the Xi take on values in [0; 1] and are independent. (The Xi can take on any value between 0 and 1. Also, the Xi need not be identical.) Then 2 − 2t P[X ≥ E[X] + t] ≤ e n 2 − 2t P[X ≤ E[X] − t] ≤ e n If we use the Chernoff bound, we get: 2 2 − 2t σ P[X ≥ 500 + σt] ≤ e n 2t2(n=4) − 2 n = e n (since σ = ) 4 2 − t = e 2 Note that this is the same bound that we got from the Gaussian! So the Chernoff bound is basically tight in this case. 4.1 Evaluating the Chernoff Bound There are a few limitations of the Chernoff bound in this situation. The main limitation is that it does not depend on the variance of the Xi. Suppose each Xi has a very low probability, say, 1 [X ] = p P i 10 n Then p 1 n [X] = p · n = E 10 n 10 3 Then the Chernoff bound would give us 1 − δ confidence interval of 2 − 2t δ [X ≥ [X] + t] ≤ e n = P E 2 r n log(2/δ) ) t = 2 q n log(2/δ) So the Chernoff bound gives us X 2 E[X] ± 2 with probability 1 − δ. p If we pick δ = 0:10, then the bound is X 2 E[X] ± 10n. Note that the width of our confidence interval is about 60 times the expected value! We know that the bound can be made much tighter here because the variance of the Xi is small. The Chernoff bound doesn't take variance into account. Later in this class, we will encounter Bernstein-type inequalities, which do account for the variance. Also, note that the Chernoff bound can be less than 0 or greater than n, which does not make sense in this problem. 4.2 Second Food for Thought 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 − δ? We need to find n such that δ [X ≥ (p + )n] ≤ P 2 By the Chernoff bound, 2 − 2(n) P[X ≥ (p + )n] ≤ e n 2 = e−2 n So we must pick n such that 2 δ e−2 n ≤ 2 i.e. 1 2 n ≥ log 22 δ 5 The Coupon Collecting Problem Suppose there exist n types of coupons, with an infinite supply of each. If you collect coupons uniformly at random, what is the expected number of coupons you must collect to hold at least one of each type? T0 must be 1, since the next coupon we receive is the first coupon, so it must be a new type. 1 Tn−1 must be n, since for each coupon we receive, there is a n probability that it is the coupon that we haven't received yet. 4 n In general, Tn−k = k because there are k coupon types remaining, so at each step the probability k that we receive a new coupon is n . So n X X n T = T = = nH ≤ n(log n + 1) i k k i=1 Pn 1 where Hn = i=1 i is the nth harmonic number. 6 Background on Complexity Theory Let's begin our whirlwind tour of complexity theory. We'll explore, to varying degrees, P, NP, ZPP, RP, coRP, and BPP. We use as supplemental material section 1.5 from Randomized Algorithms by Motwani and Ragha- van [?]. Note that formally, complexity classes are sets of languages, but we'll be looser and also speak in terms of algorithms inhabiting these classes. 6.1 P: Polynomial-time deterministic algorithms These can be described by Turing machines and languages.A language is a set ` ⊆ f0; 1gn. Given an input string x 2 f0; 1gn, a Turing machine either accepts the string, rejects the string, or loops. The language of a Turing machine is the set of strings that the Turing machine accepts. It is possible to phrase many non-decision problems as decision problems. For example, suppose the original problem is to find an integer n that has some property. The corresponding decision problem would be: Given an input x, is x less than or equal to n? In this setting, we can use binary search to find x. Definition 8. The class P consists of all languages ` that have a polynomial-time algorithm A such that for any input x, If x 2 `, A accepts If x 62 `, A rejects 6.2 NP: P with a good \advice" string \Advice" given to a Turing machine is an additional input string allowed to depend on the length of the input, n, but not the input itself. Definition 9. A language l is in NP if there exists a polynomial-time algorithm A such that for any input x, If x 2 `, there exists an advice string y such that A accepts the input (x; y) If x 62 `, then for all strings y, A rejects the input (x; y) 5 For our purposes, the advice string may be arbitrarily long, but the algorithm can only inspect a polynomial-in-the-length-of-the-input amount of it. Note the resemblance between advice strings and random bits. We will come back to this later. 6.3 RP and coRP: One-sided error Definition 10. An algorithm A is in RP if it has polynomial worst-case runtime and, for all inputs x, 1 If x 2 `, then [A accepts x] ≥ P 2 If x 62 `, then P[A accepts x] = 0 Definition 11. An algorithm A is in coRP if it has polynomial worst-case runtime and, for all inputs x, If x 2 `, then P[A accepts x] = 1 1 If x 62 `, then [A accepts x] < P 2 Note that an RP algorithm corresponds to a Monte Carlo algorithm that can err only when x 2 `, and, similarly, an algorithm in coRP corresponds to a Monte Carlo algorithm that can err only when x2 = ` [?].
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]
  • 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]
  • Model Counting for Logical Theories Wednesday
    Model Counting for Logical Theories Wednesday Dmitry Chistikov Rayna Dimitrova Department of Computer Science University of Oxford, UK Max Planck Institute for Software Systems (MPI-SWS) Kaiserslautern and Saarbr¨ucken, Germany ESSLLI 2016 SAT SMT satisfiability satisfiability modulo theories #SMT #SAT model counting model counting modulo theories 2/54 Agenda Tuesday computational complexity, probability theory Wednesday randomized algorithms, Monte Carlo methods Thursday hashing-based approach to model counting Friday from discrete to continuous model counting 3/54 Outline 1. Randomized algorithms Complexity classes RP and BPP 2. Monte Carlo methods 3. Markov chain Monte Carlo 4/54 Decision problems and algorithms Decision problem: L ⊆ f0; 1g∗ (encodings of yes-instances) Algorithm for L: says \yes" on every x 2 L, \no" on every x 2 f0; 1g∗ n L 5/54 Complexity classes: brief summary P: polynomial time (efficiently solvable) NP: nondeterministic polynomial time (with efficiently verifiable solutions) #P: counting polynomial time 6/54 Examples of randomized algorithms I Primality testing I Polynomial identity testing I Undirected reachability I Volume estimation 7/54 Randomized algorithms: our model The algorithm can toss fair coins: 1. Syntactically, a randomized algorithm is an algorithm that has access to a source of randomness, but acts deterministically if the random input is fixed. 2. It has on-demand access to arbitrary many independent 1 random variables that have Bernoulli( 2 ) distribution. 3. Each request takes 1 computational step. 8/54 Deterministic and randomized time complexity Recall deterministic time complexity: I of algorithm A on input x Randomized time complexity: Maximum (worst-case) over all possible sequences of random bits Then take maximum (worst-case) over all inputs of length n.
    [Show full text]