Great Theoretical Ideas In Computer Science Steven Rudich Anupam Gupta CS 15 251 Lecture 21 Carnegie Mellon University March 29 2005 15 251 Classics Spring 2005 Today we will learn about a formidable tool in probability that will allow us to solve problems that seem really really messy If I randomly put 100 letters into 100 addressed envelopes on average how many letters will end up in their correct envelopes Hmm k k Pr exactly k letters end up in correct envelopes k k aargh On average in class of size m how many pairs of people will have the same birthday k k Pr exactly k collisions k k aargh The new tool is called Linearity of Expectation Expectatus Linearitus HMU Random Variable To use this new tool we will also need to understand the concept of a Random Variable Today s goal not too much material but to understand it well Probability Distribution A finite probability distribution D a finite set S of elements samples each x2S has weight or probability p x 2 0 1 0 05 0 3 weights must sum to 1 0 2 0 05 0 S 0 1 0 3 Sample space Flip penny and nickel unbiased S HH TT TH HT Flip penny and nickel biased heads probability p S HH p2 TT 1 p 2 TH p 1 p HT p 1 p Probability Distribution S 0 05 0 05 0 0 1 0 3 0 2 0 3 An event is a subset S A 0 05 0 05 0 0 1 0 3 0 2 0 3 Pr A x 2 A p x 0 55 Running Example I throw a white die and a black die Sample space S 1 1 1 2 2 1 2 2 3 1 3 2 4 1 4 2 5 1 5 2 6 1 6 2 1 3 2 3 3 3 4 3 5 3 6 3 1 4 2 4 3 4 4 4 5 4 6 4 1 5 1 6 2 5 2 6 3 5 3 6 4 5 4 6 5 5 5 6 6 5 6 6 Pr x 1 36 8x2S E event that sum 3 Pr E E S proportion of E in S 3 36 New concept Random Variables Random Variables Random Variable a real valued function on S Toss a white die and a black die Examples Sample space S 1 1 1 2 1 3 X value of white die 1 6 2 2 2 3 X 3 4 3 X 1 6 1 etc 2 1 3 1 3 2 3 3 Y sum of values of the two dice 4 1 4 2 4 3 5 1 5 2 5 3 Y 3 4 7 Y 1 6 7 etc 6 1 6 2 6 3 W value of white die value of black die W 3 4 34 Y 1 6 16 Z 1 if two dice are equal 0 otherwise Z 4 4 1 Z 1 6 0 etc 1 4 2 4 3 4 4 4 5 4 6 4 1 5 2 5 3 5 4 5 5 5 6 5 2 6 3 6 4 6 5 6 6 6 E g tossing a fair coin n times S all sequences of H T n D uniform distribution on S D x n for all x 2 S Random Variables say n 10 X of heads X HHHTTHTHTT 5 Y 1 if heads tails 0 otherwise Y HHHTTHTHTT 1 Y THHHHTTTTT 0 Notational conventions Use letters like A B E for events Use letters like X Y f g for R V s R V random variable Two views of random variables Think of a R V as a function from S to the reals or think of the induced distribution on Two coins tossed X TT TH HT HH 0 1 2 counts the number of heads S HH TT 2 0 TH HT 1 Two views of random variables Think of a R V as a function from S to the reals or think of the induced distribution on Two coins tossed X TT TH HT HH 0 1 2 counts the number of heads S HH 2 TT TH HT 0 1 Distribution on the reals Two views of random variables Think of a R V as a function from S to the reals or think of the induced distribution on Two dice I throw a white die and a black die Sample space S 1 1 1 2 1 3 1 4 1 5 1 6 2 1 2 2 2 3 2 4 2 5 2 6 3 1 3 2 3 3 3 4 3 5 3 6 4 1 4 2 4 3 4 4 4 5 4 6 5 1 5 2 5 3 5 4 5 5 5 6 X 6 1 sum of both dice 6 2 6 3 6 4 6 5 6 6 function with X 1 1 2 X 1 2 X 2 1 3 X 6 6 12 It s a floor wax and a dessert topping It s a function on the sample space S It s a variable with a probability distribution on its values You should be comfortable with both views From Random Variables to Events For any random variable X and value a we can define the event A that X a Pr A Pr X a Pr x 2 S X x a Two coins tossed X TT TH HT HH 0 1 2 counts the number of heads S Pr X 1 X HH TT TH HT Pr X a Pr x S X x a 2 0 1 Distribution on X Pr x 2 S X x 1 Pr TH HT Two dice I throw a white die and a black die X sum Sample space S 1 1 1 2 2 1 2 2 3 1 3 2 4 1 4 2 5 1 5 2 6 1 6 2 1 3 2 3 3 3 4 3 5 3 6 3 1 4 2 4 3 4 4 4 5 4 6 4 1 5 1 6 2 5 2 6 3 5 3 6 4 5 4 6 5 5 5 6 6 5 6 6 Pr X 6 Pr x S X x 6 5 36 Pr X a Pr x S X x a From Random Variables to Events For any random variable X and value a we can define the event A that X a Pr A Pr X a Pr x 2 S X x a X has a distribution on its values X is a function on the sample space S From Events to Random Variables For any event A can define the indicator random variable for A XA x 1 0 05 0 05 0 0 3 0 2 0 1 0 3 if x 2 A 0 if x A 1 0 55 0 0 45 Definition expectation The expectation or expected value of a random variable X is written as …
View Full Document
Unlocking...