Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
1-3: Random Variables and Expected Values Prakash Balachandran Department of Mathematics Duke University January 19, 2010 • Lab manuals from last semester: ok to use! 1. Examples 2. Homework 1 Examples • (Averages) What exactly do we mean by an average? Suppose there are 10 students in the class, and their results on an exam (out of 100) are: 50, 60, 57, 77, 88, 90, 94, 70, 70, 81. (1) What is the average test score? Well, you’d compute the sum 50 + 60 + 57 + 77 + 88 + 90 + 94 + 70 + 70 + 81 = 73.7 10 and say, “on average, a person got a (2) 73.7 ”. 100 But what does that mean? It means, if I chose a random person from the class, his score would be roughly around 73.7, or that the scores are “clumped” around 73.7. I’m going to suggestively rewrite the computation in (2) as: 73.7 = 50 · 1 1 1 1 1 1 1 1 1 1 + 60 · + 57 · + 77 · + 88 · + 90 · + 94 · + 70 · + 70 · + 81 · 10 10 10 10 10 10 10 10 10 10 = 50 · 1 1 1 1 1 1 1 2 1 + 60 · + 57 · + 77 · + 88 · + 90 · + 94 · + 70 · + 81 · 10 10 10 10 10 10 10 10 10 (3) Let’s make that previous statement a little more precise. I’m going to conduct an experiment: I’m going to choose a student in the class uniformly at random, and look at his/her exam score. The sample space is Ω = {A, B, C, D, E, F, G, H, I, J} which I’m using to list the students in the class, which are going to correspond to the list of scores in (1), respectively, Let X be the outcome of this experiment. It’s values are obviously in (1), but what is the probability that, 1 say, X = 50? Obviously, it corresponds to my choosing A which occurs with probability 10 . But, while an 1 1 outcome could consist of X = 50, that outcome occurs much less frequently [w/ probability 10 ] than say 2 an outcome with X = 70 [which occurs with probability 10 ], so by itself, 50 gives me a poor idea of how the scores are clumping w.r.t. each other. I get a better idea of this clustering by considering the weighted some of outcomes, denoted by E [X]. Performing the computation, I get: E [X] = 50 · 1 1 1 1 1 1 1 1 1 1 + 60 · + 57 · + 77 · + 88 · + 90 · + 94 · + 77 · + 77 · + 81 · = 73.7 10 10 10 10 10 10 10 10 10 10 which is exactly (3), which is the average. • Definition: A random variable X is a function on the sample space which takes on real numbers. Its mass density p(x) is defined by p(x) = P [X = x] and P its average, or expected value, is its weighted sum w.r.t. the probabilities defined on the sample space, x|p(x)≥0 x · p(x). • In the previous example, X was the random variable and its expected value was the usual notion of an average we’re used to. The probability mass function of X was (1 x 6= 70 10 p(x) = P [X = x] = 2 x = 70. 10 Notice that while drawing a student at random is not a random variable, choosing a student at random and looking at his/her exam score is. • (Waiting time for a desired card without replacement) Suppose I have a deck of 52 cards, and I take out cards one at a time. If I’m waiting for a particular card, which draw will it come out on, on average? Obviously, the sample space Ω is the set of all 52 cards. The random variable here, X, is the draw upon which I pull my card. If the cards are taken out independently of one another, then the mass density of X is given by p(1) = 1 51 1 1 51 50 1 1 1 , p(2) = · = , p(3) = · · = , . . . , p(52) = . 52 52 51 52 52 51 50 52 52 The expected value of X is then, 52 1 1 1 X 52 · 53 1 1 +2· + · · · + 52 · = i= · = 26.5. E[X] = 52 52 52 52 i=1 2 52 recall n X i=1 n(n + 1) i= 2 ! • (Expected number of heads in 3 tosses) Consider flipping a fair coin three times independently. The sample space is Ω = {HHH, HHT, HT H, HT T, T HH, T HT, T T H, T T T }. How many heads can I expect? Since everything is occurring independently, the probability of each occurrence in Ω is 18 . If X denotes the random variable for the number of heads in a given three tosses: X(T T T ) = 0, X(HT T ) = X(T HT ) = (T T H) = 1, X(HHT ) = X(HT H) = X(T HH) = 2, X(HHH) = 3 each of which occurs with probability 18 , 38 , 3 8 and 1 8 respectively. So: 1 3 3 1 3 E [X] = 0 +1 +2 +3 = 8 8 8 8 2 which agrees with our intuition for the expected number of heads. 2 • (Sum of two dice) I roll two, fair, six-sided dice. What is the expected sum of the rolls? The sample space Ω consists of all 62 possible outcomes. Let X be the random variable for the sum of the two numbers. Then, X takes values in 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. Its mass density is given by, 1 2 3 4 5 , P [X = 3] = , P [X = 4] = , P [X = 5] = , P [X = 6] = , 36 36 36 36 36 6 5 4 3 2 1 P [X = 7] = , P [X = 8] = , P [X = 9] = , P [X = 9] = , P [X = 11] = , P [X = 12] = . 36 36 36 36 36 36 P [X = 2] = So that, E [X] = 2 1 36 +3 2 36 +4 3 36 5 6 5 4 3 +5 +6 +7 +8 +9 + 10 36 36 36 36 36 1 2 + 12 = 7. +11 36 36 4 36 • Consider flipping a fair coin twice. Let X be the number of heads minus the number of tails. What is its expected value? Ω = {HH, HT, T H, T T } each occurring with probability 14 . X(HH) = 2, X(HT ) = X(T H) = 0, X(T T ) = −2, 1 1 1 P (X = 2) = , P (X = 0) = , P (X = −2) = , 4 2 4 1 1 1 E [X] = 2 +0 −2 = 0. 4 2 4 • Suppose you own a share of stock for two years and each year the value of the stock changes by 2, 1, 0, −1 each with probability 14 . Suppose that changes from one year to the next are independent. The sample space consists of Ω = {(2, 2), (2, 1), (2, 0), (2, −1), (1, 2), (1, 1), (1, 0), (1, −1), (0, 2)} {(0, 1), (0, 0), (0, −1), (−1, 2), (−1, 1), (−1, 0), (−1, −1)}. and the random variable X denoting the net change at the end of two years takes on the values 4, 3, 2, 1, 0, −1, −2. The probability mass function of X is given by p(4) = 1 2 3 4 3 2 1 , p(3) = , p(2) = , p(1) = , p(0) = , p(−1) = , p(−2) = . 16 16 16 16 16 16 16 The expected value of X is given by 1 2 3 4 3 2 1 +3 +2 +1 +0 −1 −2 = 1. E [X] = 4 16 16 16 16 16 16 16 2 Homework • Let X be the r.v. that denotes the number of tosses it takes to get the first head. List the sample space, and look at the probabilities of each outcome. Is the sum of those probabilities 1? • We’ll discuss this on Wednesday! [I’m not collecting it, but think about it] 3