probability theory overview and analysis of randomized algorithms prepared by john reif, ph.d....

50
Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Upload: theodora-stokes

Post on 13-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probability Theory Overview and Analysis of Randomized

Algorithms

Prepared by

John Reif, Ph.D.

Analysis of Algorithms

Page 2: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probability Theory Topics

a) Random Variables: Binomial and Geometric

b) Useful Probabilistic Bounds and Inequalities

Page 3: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Readings

• Main Reading Selections:– CLR, Chapter 5 and Appendix C

Page 4: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probability Measures

• A probability measure (Prob) is a mapping from a set of events to the reals such that:1) For any event A

0 Prob(A) 12) Prob (all possible events) = 13) If A, B are mutually exclusive

events, thenProb(A B) = Prob (A) + Prob (B)

Page 5: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Conditional Probability

• Define

Prob(A B)Prob(A | B)

Prob(B)

for Prob(B) > 0

Page 6: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Bayes’ Theorem

• If A1, …, An are mutually exclusive and contain all events then

ii n

jj=1

j j j

PProb(A | B)

P

where P = Prob(B | A ) Prob(A )

Page 7: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Random Variable A (Over Real Numbers)

• Density Function

Af (x) = Prob(A=x)

Page 8: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Random Variable A (cont’d)

• Prob Distribution Function

x

A A

-

F (x) = Prob(A x) = f (x) dx

Page 9: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Random Variable A (cont’d)

• If for Random Variables A,B

• Then “A upper bounds B” and “B lower bounds A”

A Bx F (x) F (x)

A

B

F (x) Prob (A x)

F (x) Prob (B x)

Page 10: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Expectation of Random Variable A

• Ā is also called “average of A” and “mean of A” = A

A

-

E(A) = A = x f (x) dx

Page 11: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Variance of Random Variable A

2 2 2 2A

2 2A

-

σ (A A) A (A)

where 2nd momoment A x f (x) dx

Page 12: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Variance of Random Variable A (cont’d)

Page 13: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Discrete Random Variable A

Page 14: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Discrete Random Variable A (cont’d)

Page 15: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Discrete Random Variable A Over Nonnegative Numbers

• Expectation

Ax=0

E(A) = A = x f (x)

Page 16: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Pair-Wise Independent Random Variables

• A,B independent if

Prob(A B) = Prob(A) X Prob(B)

• Equivalent definition of independence

A B A B

A B A B

A B A B

f (x) = f (x) f (x)

M (s) = M (s) M (s)

G (z) = G (z) G (z)

Page 17: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Bounding Numbers of Permutations

• n! = n x (n-1) x 2 x 1= number of permutations of n objects

• Stirling’s formulan! = f(n) x (1+o(1)), where

n -nf(n) = n e 2πn

Page 18: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Bounding Numbers of Permutations (cont’d)

• Note– Tighter bound

= number of permutations of n objects taken k at a time

1 1(12n+1) 12nf(n) e < n! < f(n) e

n!

(n-k)!

Page 19: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Bounding Numbers of Combinations

= number of (unordered)

combinations of n objects

taken k at a time

• Bounds (due to Erdos & Spencer, p. 18)

n n!

k k! (n-k)!

2 3

2

k kk 2n 6nn n e

~ (1 o(1))k k!

3

4for k = o n

Page 20: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Bernoulli Variable

• Ai is 1 with prob P and 0 with prob 1-P

• Binomial Variable• B is sum of n independent Bernoulli

variables Ai each with some probability p

BINOMIAL with parameters n,p

B 0

i=1 n

probability P B B+1

procedure

begin

for to do

with do

output

end

Page 21: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms
Page 22: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

B is Binomial Variable with Parameters n,p

n pmean

2 np (1-p)variance

Page 23: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

B is Binomial Variable with Parameters n,p (cont’d)

x n-xn Prob(B=x) = p (1-p)

xdensity fn

xk n-k

k=0

n Prob(B x) = p (1-p)

kdistribution fn

Page 24: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Poisson Trial

• Ai is 1 with prob Pi and 0 with prob 1-Pi

• Suppose B’ is the

sum of n independent Poisson trials

Ai with probability Pi for i > 1, …, n

Page 25: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Hoeffding’s Theorem

• B’ is upper bounded by a Binomial Variable B

• Parameters n,p where

n

ii=1

Pp=

n

Page 26: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Geometric Variable V• parameter p

xx 0 Prob(V=x) = p(1-p)

GEOMETRIC parameter p

V 0

loop with probability 1-p

exit

procedure

begin

goto

Page 27: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probabilistic Inequalities

• For Random Variable A

2 2 2

A

A (A)

mean

variance

Page 28: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Markov and Chebychev Probabilistic Inequalities

• Markov Inequality (uses only mean)

• Chebychev Inequality (uses mean and variance)

Prob (A x)x

2

2Prob ( A )

Page 29: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Example of use of Markov and Chebychev Probabilistic Inequalities

• If B is a Binomial with parameters n,p

2

npThen Prob (B x)

xnp (1-p)

Prob ( B np )

Page 30: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Gaussian Density Function

2x-

21

(x) = e2π

Page 31: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Normal Distribution

• Bounds x > 0 (Feller, p. 175)

x

-

(X) = (Y) dY

3

1 1 Ψ(x)(x) 1 (x)

x x x

x [0,1]

x 1 xx (1) (x) - (0) =

22πe 2π

Page 32: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Sums of Independently Distributed Variables

• Let Sn be the sum of n independently distributed variables A1, …, An

• Each with mean and variance

• So Sn has mean and variance 2

n

2

n

Page 33: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Strong Law of Large Numbers: Limiting to Normal Distribution• The probability density function of

to normal distribution (x)

• Hence

Prob

nn

(S - )T = as nlimits

n( S - x) (x) as n

Page 34: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Strong Law of Large Numbers (cont’d)

• So

Prob

(since 1- (x) (x)/x)

n( S - x) 2(1 (x))

2 (x)/x

Page 35: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Moment Generating Functions and Chernoff Bounds

Advanced Material

Page 36: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Moments of Random Variable A (cont’d)

• n’th Moments of Random Variable A

• Moment generating function

n nA

-

A x f (x) dx

sxA A

-

sA

M (s) e f (x) dx

= E(e )

Page 37: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Moments of Random Variable A (cont’d)

• NoteS is a formal parameter

n

0

nAAn

d M (s)

dss

Page 38: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Moments of Discrete Random Variable A

• n’th moment

n nA

x=0

A x f (x)

Page 39: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probability Generating Function of Discrete Random Variable A

2 " ' ' 2Avariance σ (1) (1) ( (1))A A AG G G

x AA A

x=0

G (z) = z f (x) E(z )

" 2A2nd derivative G (1) = A A

A1st derivative G ' (1) = A

Page 40: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

• If A1, …, An independent with same distribution

1

1 1

1 2 n

n

B A

n n

B A B A

Then if B = A A ... A

f (x) = f (x)

M (s) = M (s) , G (z) = G (z)

1 iA Af (x) = f (x) for i = 1, ... n

Moments of AND of Independent Random Variables

Page 41: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Generating Function of Binomial Variable B with Parameters n,p

• Interesting fact

xn k k n-k

k=0

nG(z) = (1-p+pz) = z p (1-p)

k

1Prob(B= ) =

n

Page 42: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Generating Function of Geometric Variable with parameter p

k k

k=0

pG(Z) = Z (p(1-p) ) =

1-(1-p)Z

Page 43: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Chernoff Bound of Random Variable A

• Uses all moments• Uses moment generating function

By setting x = ’ (s) 1st derivative minimizes bounds

-sxA

γ(s) - sxA

γ(s) - s γ'(s)

Prob (A x) e M (s) for s 0

= e where γ(s) = ln (M (s))

e

Page 44: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Chernoff Bound of Discrete Random Variable A

• Choose z = z0 to minimize above bound

• Need Probability Generating function

-xAProb (A x) z G (z) for z 1

x AA A

x 0

G (z) = z f (x) = E(z )

Page 45: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Chernoff Bounds for Binomial B with parameters n,p

• Above mean x

n-x x

x xx-μ 1

-x - μ 2

Prob (B x)

n-

n-x x

1 e since 1 e

x x

e for x μe

Page 46: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Chernoff Bounds for Binomial B with parameters n,p (cont’d)

• Below mean x

n-x x

Prob (B x)

n-

n-x x

Page 47: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Anguin-Valiant’s Bounds for Binomial B with Parameters n,p

• Just above mean

• Just below mean

2 μ-ε

2

= np for 0 < < 1

Prob (B (1+ ) ) e

2 μ-ε

3

for 0 < < 1

Prob (B (1- ) ) e

Page 48: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Anguin-Valiant’s Bounds for Binomial B with Parameters n,p (cont’d)

Tails are bounded by Normal distributions

Page 49: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Binomial Variable B with Parameters p,N and Expectation = pN• By Chernoff

Bound for p < ½

• Raghavan-Spencer bound for any > 0

nN 2

NProb (B ) 2 p

2

μ

(1+ )Prob (B (1+ ) )

(1+ )

e

Page 50: Probability Theory Overview and Analysis of Randomized Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms

Probability Theory

Prepared by

John Reif, Ph.D.

Analysis of Algorithms