probabilistic algorithms - cs 6
TRANSCRIPT
PROBABILISTIC ALGORITHMS
Pages 368 - 375
1
2
PROBABILISTIC ALGORITHMS
• A probabilistic algorithm is an algorithmdesigned to use the outcome of a randomprocess.
• Example: flip a coin.
• How can making a decision by flipping a coin everbe better than actually calculating, or evenestimating, the best choice in a particularsituation?
3
THE CLASS BPP
• We begin our formal discussion ofprobabilistic computation by defining amodel of a probabilistic Turing machine.
4
5
Definition 10.3 (cont.)
• When a probabilistic Turing machinerecognizes a language = it must accept allstrings in the language and reject all stringsout of the language as usual.
• Except that now we allow the machine a smallprobability of error.For say that M recognizeslanguage A with error probability .
6
• We also consider error probability bounds thatdepend on the input length n. For example,error probability = 2-n indicates anexponentially small probability of error.
Definition 10.3 (cont.)
worst case computation branch on each input
7
= amplification lemma.
• Amplification lemma gives a simple way ofmaking the error probability exponentiallysmall.
• LEMMA 10.5 and proof IDEA. (self stady)PROOF.
8
PRIMALITY• A prime number is an integer greater than 1that is not divisible by positive integers otherthan 1 and itself.
• A nonprime number greater than 1 is calledcomposite.
• One way to determine whether a number isprime is to try all possible integers less thanthat number and see whether any are divisors,also called factors.
• exponential time complexity
9
• For example, if p = 7 and a = 2, the theoremsays that 2 (7-1)mod 7 should be 1 because 7 isprime.
• The simple calculation 2(7-1) = 26 = 64 and 64mod 7 = 1 confirms this result.
• Suppose that we try p = 6 instead.Then 2(6-1) = 25 = 32 and 32 mod 6 = 2
10
Fermat's little theorem
Algorithm Fermat test
11
Self study
12
Note
The probabilistic primality algorithm has one-sidederror.
When the algorithm outputs reject, we know thatthe input must be composite.
When the output is accept, we know only that theinput could be prime or composite.
Thus an incorrect answer can only occur when theinput is a composite number.
The one-sided error feature is common to manyprobabilistic algorithms, so the special complexityclass RP is designated for it.
13