Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 22

Similar documents
Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 21. Some Important Distributions

Discrete Mathematics and Probability Theory Spring 2012 Alistair Sinclair Note 15

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 15

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 19

n outcome is (+1,+1, 1,..., 1). Let the r.v. X denote our position (relative to our starting point 0) after n moves. Thus X = X 1 + X 2 + +X n,

Infinite Sequences and Series

Lecture 2: April 3, 2013

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

An Introduction to Randomized Algorithms

6.3 Testing Series With Positive Terms

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

CS 330 Discussion - Probability

Discrete Mathematics for CS Spring 2008 David Wagner Note 22

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Statistics

2 Definition of Variance and the obvious guess

4.3 Growth Rates of Solutions to Recurrences

Math 155 (Lecture 3)

Frequentist Inference

Problem Set 2 Solutions

Math 525: Lecture 5. January 18, 2018

1 Generating functions for balls in boxes

Let us give one more example of MLE. Example 3. The uniform distribution U[0, θ] on the interval [0, θ] has p.d.f.

Random Models. Tusheng Zhang. February 14, 2013

Random Variables, Sampling and Estimation

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Parameter, Statistic and Random Samples

0, otherwise. EX = E(X 1 + X n ) = EX j = np and. Var(X j ) = np(1 p). Var(X) = Var(X X n ) =

The standard deviation of the mean

Chapter 3. Strong convergence. 3.1 Definition of almost sure convergence

Topic 8: Expected Values

Convergence of random variables. (telegram style notes) P.J.C. Spreij

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

PH 425 Quantum Measurement and Spin Winter SPINS Lab 1

Sequences I. Chapter Introduction

Lecture 12: November 13, 2018

Lecture 4 The Simple Random Walk

Math 113 Exam 3 Practice

7.1 Convergence of sequences of random variables

January 25, 2017 INTRODUCTION TO MATHEMATICAL STATISTICS

Lecture 6: Coupon Collector s problem

STAT Homework 1 - Solutions

The Random Walk For Dummies

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Lecture 16

Bertrand s Postulate

Massachusetts Institute of Technology

Lecture Chapter 6: Convergence of Random Sequences

MA131 - Analysis 1. Workbook 2 Sequences I

Distribution of Random Samples & Limit theorems

Recurrence Relations

Sequences. Notation. Convergence of a Sequence

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

Understanding Samples

Topic 9: Sampling Distributions of Estimators

Expectation and Variance of a random variable

Section 11.8: Power Series

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Chapter 10: Power Series

Lecture 2. The Lovász Local Lemma

Statistics 511 Additional Materials

MAT1026 Calculus II Basic Convergence Tests for Series

f X (12) = Pr(X = 12) = Pr({(6, 6)}) = 1/36

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

Final Review for MATH 3510

4. Partial Sums and the Central Limit Theorem

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Variance of Discrete Random Variables Class 5, Jeremy Orloff and Jonathan Bloom

7.1 Convergence of sequences of random variables

Learning Theory: Lecture Notes

Ma 530 Infinite Series I

It is often useful to approximate complicated functions using simpler ones. We consider the task of approximating a function by a polynomial.

The Binomial Theorem

FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures

Lecture 6 Chi Square Distribution (χ 2 ) and Least Squares Fitting

HOMEWORK 2 SOLUTIONS

If a subset E of R contains no open interval, is it of zero measure? For instance, is the set of irrationals in [0, 1] is of measure zero?

Kinetics of Complex Reactions

Sequences and Series of Functions

Linear Regression Demystified

Lecture 19: Convergence

32 estimating the cumulative distribution function

Mathematical Induction

1 Approximating Integrals using Taylor Polynomials

Chapter 5. Inequalities. 5.1 The Markov and Chebyshev inequalities

Design and Analysis of Algorithms

Chi-Squared Tests Math 6070, Spring 2006

Ma 530 Introduction to Power Series

2.4 Sequences, Sequences of Sets

Math 152. Rumbos Fall Solutions to Review Problems for Exam #2. Number of Heads Frequency

Once we have a sequence of numbers, the next thing to do is to sum them up. Given a sequence (a n ) n=1

MA131 - Analysis 1. Workbook 3 Sequences II

Lecture 7: Properties of Random Samples

CALCULATING FIBONACCI VECTORS

Topic 9: Sampling Distributions of Estimators

Sequences, Series, and All That

Induction: Solutions

Basics of Probability Theory (for Theory of Computation courses)

Notes for Lecture 11

Topic 9: Sampling Distributions of Estimators

Advanced Stochastic Processes.

Lecture 2 February 8, 2016

Transcription:

CS 70 Discrete Mathematics for CS Sprig 2007 Luca Trevisa Lecture 22 Aother Importat Distributio The Geometric Distributio Questio: A biased coi with Heads probability p is tossed repeatedly util the first Head appears. What is the expected umber of tosses? As always, our first step i aswerig the questio must be to defie the sample space Ω. A momet s thought tells us that Ω = {H,T H,TTH,T T T H,...}, i.e., Ω cosists of all sequeces over the alphabet {H,T } that ed with H ad cotai o other H s. This is our first example of a ifiite sample space (though it is still discrete). What is the probability of a sample poit, say ω = T T H? Sice successive coi tosses are idepedet (this is implicit i the statemet of the problem), we have Pr[T T H] = ( p) ( p) p = ( p) 2 p. Ad geerally, for ay sequece ω Ω of legth i, we have Pr[ω] = ( p) i p. To be sure everythig is cosistet, we should check that the probabilities of all the sample poits add up to. Sice there is exactly oe sequece of each legth i i Ω, we have as expected. ω Ω Pr[ω] = ( p) i p = p i=0 ( p) i = p [I the secod-last step here, we used the formula =0 xk = valid for all 0 < x <.] x ( p) =, for summig a geometric series, which is Now let the radom variable X deote the umber of tosses i our sequece (i.e., X(ω) is the legth of ω). Our goal is to compute E(X). Despite the fact that X couts somethig, there s o obvious way to write it as a sum of simple r.v. s as we did i may examples i the last lecture. (Try it!) Istead, let s just dive i ad try a direct computatio. Note that the distributio of X is quite simple: So from the defiitio of expectatio we have Pr[X = i] = ( p) i p for i =,2,3,... ( p)+(2 ( p)p)+(3 ( p) 2 p)+ = p i( p) i. CS 70, Sprig 2007, Lecture 22

This series is a bled of a arithmetic series (the i part) ad a geometric series (the ( p) i part). There are several ways to sum it. Here is oe way, usig a auxiliary trick (give i the followig Theorem) that is ofte very useful. Theorem 22.: Let X be a radom variable that takes o oly o-egative iteger values. The Pr[X i]. Proof: For otatioal coveiece, let s write p i = Pr[X = i], for i = 0,,2,... From the defiitio of expectatio, we have (0 p 0 )+( p )+(2 p 2 )+(3 p 3 )+(4 p 4 )+ = p +(p 2 + p 2 )+(p 3 + p 3 + p 3 )+(p 4 + p 4 + p 4 + p 4 )+ = (p + p 2 + p 3 + p 4 + )+(p 2 + p 3 + p 4 + )+(p 3 + p 4 + )+(p 4 + )+ = Pr[X ]+Pr[X 2]+Pr[X 3]+Pr[X 4]+. I the third lie, we have regrouped the terms ito coveiet ifiite sums. You should check that you uderstad how the fourth lie follows from the third. [Note that our... otatio here is a little iformal, but the meaig should be clear. We could give a more rigorous, but less clear proof usig iductio.] Usig Theorem 2., it is easy to compute E(X). The key observatio is that, for our coi-tossig r.v. X, Pr[X i] = ( p) i. () Why is this? Well, the evet X i meas that at least i tosses are required. This is exactly equivalet to sayig that the first i tosses are all Tails. Ad the probability of this evet is precisely ( p) i. Now, pluggig equatio () ito Theorem 2., we get Pr[X i] = ( p) i = ( p) = p. So, the expected umber of tosses of a biased coi util the first Head appears is p. For a fair coi, the expected umber of tosses is 2. What about the variace? If we wat to compute the variace uig the equatio Var(X) = E(X 2 ) (E(X)) 2, ow that we kow E(X) it remais to fid E(X 2 ). X 2 is a radom variable that takes the value k 2 with probability ( p) k p, ad so we have E(X 2 ) = p k 2 ( p) k To estimate this sum we will use the followig trick. For real umbers 0 < x <, defie the fuctio f(x) = k=0 x k (2) CS 70, Sprig 2007, Lecture 22 2

We kow that we also have f(x) = x Let us kow take the first derivative of f(x). By equatio (2) we have f (x) = kx k, ad by equatio (3) we have f (x) = ( x) 2. Thus, we have foud out that, for 0 < x <, we have kx k = ( x) 2. Note that, after the substitutio x p ad after multiplyig both sides by p, the above equatio gives us a alterative way of provig /p. There is, of course, o reaso to stop at the first derivative. We ca compute the secod derivative of f(x) accordig to the two defiitios, ad fid f (x) = k=2 k (k ) x k 2 ad f (x) = 2 ( x) 3, thus k(k )x k 2 = 2 ( x) 3. [Note that it makes o differece if we start summig from or from 2 o the left-had side.] Now we are ready to compute E(X 2 ): (3) Fially, we have E(X 2 ) = p = p = p( p) k 2 ( p) k (k(k )+k) ( p) k = p( p) 2 p 3 + p = 2 p p 2 + p = 2 p 2 p. k(k )( p) k 2 + p k( p) k Var(X) = E(X 2 ) (E(X)) 2 = 2 p 2 p p 2 = p 2 p. For example, if p = %, the 00, ad Var(X) = 9, 900, so that the stadard deviatio of X is about 99.5. CS 70, Sprig 2007, Lecture 22 3

The geometric distributio The distributio of the radom variable X that couts the umber of coi tosses util the first Head appears has a special ame: it is called the geometric distributio with parameter p (where p is the probability that the coi comes up Heads o each toss). Defiitio 22. (geometric distributio): A radom variable X for which Pr[X = i] = ( p) i p for i =,2,3,... is said to have the geometric distributio with parameter p. If we plot the distributio of X (i.e., the values Pr[X = i] agaist i) we get a curve that decreases mootoically by a factor of p at each step. For posterity, let s record two importat facts we ve leared about the geometric distributio: Theorem 22.2: For a radom variable X havig the geometric distributio with parameter p,. Pr[X i] = ( p) i for i =,2,...; 2. p ; ad 3. Var(X) = p p 2. The geometric distributio occurs very ofte i applicatios because frequetly we are iterested i how log we have to wait before a certai evet happes: how may rus before the system fails, how may shots before oe is o target, how may poll samples before we fid a Democrat, etc. The ext sectio discusses a rather more ivolved applicatio, which is importat i its ow right. The Coupo Collector s Problem Questio: We are tryig to collect a set of differet baseball cards. We get the cards by buyig boxes of cereal: each box cotais exactly oe card, ad it is equally likely to be ay of the cards. How may boxes do we eed to buy util we have collected at least oe copy of every card? The sample space here is similar i flavor to that for our previous coi-tossig example, though rather more complicated. It cosists of all sequeces ω over the alphabet {, 2,..., }, such that. ω cotais each symbol,2,..., at least oce; ad 2. the fial symbol i ω occurs oly oce. [Check that you uderstad this!] For ay such ω, the probability is just Pr[ω] = i, where i is the legth of ω (why?). However, it is very hard to figure out how may sample poits ω are of legth i (try it for the case = 3). So we will have a hard time figurig out the distributio of the radom variable X, which is the legth of the sequece (i.e., the umber of boxes bought). Fortuately, we ca compute the expectatio E(X) very easily, usig (guess what?) liearity of expectatio, plus the fact we have just leared about the expectatio of the geometric distributio. As usual, we would like to write X = X + X 2 +...+ X (4) CS 70, Sprig 2007, Lecture 22 4

for suitable simple radom variables X i. But what should the X i be? A atural thig to try is to make X i equal to the umber of boxes we buy while tryig to get the ith ew card (startig immediately after we ve got the (i )st ew card). With this defiitio, make sure you believe equatio (4) before proceedig. What does the distributio of X i look like? Well, X is trivial: o matter what happes, we always get a ew card i the first box (sice we have oe to start with). So Pr[X = ] =, ad thus E(X ) =. How about X 2? Each time we buy a box, we ll get the same old card with probability, ad a ew card with probability. So we ca thik of buyig boxes as flippig a biased coi with Heads probability p = ; the X is just the umber of tosses util the first Head appears. So X has the geometric distributio with parameter p =, ad E(X 2 ) =. How about X 3? This is very similar to X 2 except that ow we oly get a ew card with probability 2 (sice there are ow two old oes). So X 3 has the geometric distributio with parameter p = 2, ad E(X 3 ) = 2. Arguig i the same way, we see that, for i =,2,...,, X i has the geometric distributio with parameter p = i+, ad hece that E(X i ) = i+. Fially, applyig liearity of expectatio to equatio (4), we get E(X i ) = + + + 2 + = i. (5) This is a exact expressio for E(X). We ca obtai a tidier form by otig that the sum i it actually has a very good approximatio, amely: i l+γ, where γ = 0.5772... is Euler s costat. Thus the expected umber of cereal boxes eeded to collect cards is about (l + γ). This is a excellet approximatio to the exact formula (5) eve for quite small values of. So for example, for = 00, we expect to buy about 58 boxes. This is aother of the little tricks you might like to carry aroud i your toolbox. CS 70, Sprig 2007, Lecture 22 5