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
2.4 Random Variables and Expectation Example 2.4.1 Two fair dice (blue and red) are rolled. The sample space S is the set of 36 possible outcomes, each consisting of two scores between 1 and 6. Let X denote the total score - the sum of the two scores. Then X associates a number (between 2 and 12) to each outcome - i.e. X is a funtion from S to R. We have X(1, 6) = 7, X(3, 4) = 7, X(4, 6) = 10, etc. Definition 2.4.2 A random variable is a function from a sample space S to the set R of real numbers. This is a formal definition but in practice our random variables will sensibly associate numbers to outcomes of experiments. Examples of Random Variables : 1. X1 : Number of clubs in a randomly dealt poker hand (5 cards). S : Set of possible five-card hands. X1 (S) = {0, 1, 2, 3, 4, 5} - set of possible values of X1 . 2. Experiment : Continue tossing a coin until Heads (H) is obtained for the first time. Sample space S = {H, T H, T T H, T T T H, . . . } - lists consisting of a nubmer of T followed by one H. X2 : Number of tosses up to and including the first H. So X2 (H) = 1, X2 (T H) = 2, X2 (T T H) = 3, etc. X2 (S) = {1, 2, 3, . . . } - the set of natural numbers. 3. Experiment : Select two points of R2 . Sample Space S : Set of pairs of points. X3 : Distance between the two points. X3 (S) − [0, ∞) : the set of non-negative real numbers. Note: X1 and X2 above are examples of discrete random variables; their sets of possible values are “spaced out” along the real number line. X 3 is a continuous random variable its set of possible values is a continuous chunk of the real number line and is uncountable. For now we will restrict our attention to discrete random variables. Definition 2.4.3 Let X : S −→ R be a discrete random variable associated to an experiment whose sample space is S. The probability function pX : X(S) −→ [0, 1] is defined by pX (x) = P (X = x), for x ∈ X(S). It is the function that associates to each possible value of X the probability that X will assume that value in a performance of the experiment. Example 2.4.4 Let X be the total score when two fair dice are rolled. Then X(S) = {2, 3, . . . , 12} and pX (2) pX (3) pX (4) pX (5) pX (6) pX (7) Note 12 k=2 pX (k) = = = = = pX (12) pX (11) pX (10) pX (9) pX (8) = = = = = = = 1 as we would expect. 9 1/36 1/18 1/12 1/9 5/36 1/6 (= 2/36) (= 3/36) (= 4/36) (= 6/36) Example 2.4.5 An unfair coin will show H (heads) with probability 0.3 and T (tails) with probability 0.7. Let X be the number of tosses until the first H. Then X(S) = {1, 2, . . . } and pX (1) = pX (2) = pX (3) = P (X = 1) = P (H) = P (X = 2) = P (T H) = P (X = 3) = P (T T H) = 0.3 0.7 × 0.3 (0.7)2 × 0.3 In general for k ∈ X(S) pX (k) = P (T . . . T} H) = (0.7)k−1 (0.3). | T {z k−1 Note: ∞ X pX (k) = 0.3 + (0.7)(0.3) + (0.7)2 (0.3) + . . . k=1 - a geometric series with initial term 0.3 and common ratio 0.7. The sum is 0.3 = 1, 1 − 0.7 as expected. For any discrete random variable X we must have X pX (x) = 1. x∈X(S) Definition 2.4.6 Let X : S −→ R be a discrete random variable. The expectation or expected value of X, denoted by E(X) or sometimes µ, is defined by X E(X) = xpX (x), x∈X(S) i.e. E(X) is the sum over all the possible values x of X of the expression xP (X = x). Notes: 1. E(X) is a weighted average of the values of X, the weight assigned to each value being its probability of occurring. 2. If X(S) is finite and all values of X are equally likely to occur, then E(X) is just the average of these values. For example if X is the score on a fair die, then X(S) = {1, 2, 3, 4, 5, 6} and E(X) = 1 × 1 1 1 1 1 1 1 + 2 × + 3 × + 4 × + 5 × + 6 × = 21 × = 3.5 6 6 6 6 6 6 6 3. E(X) may not be a possible value of X at all (as in the example above). However E(X) is the value that x takes “on average” over a large number of repetitions of the experiment. Jistificiation for the Formula: Suppose that X has k possible values x1 , x2 , . . . , xk and that P (X = xi ) = pX (i) = pi , 10 for i = 1, . . . , k. So pi is the probability that X takes the value xi . Suppose that in n reperitions of the experiment, the number of times that X takes the value x i is ni . Then the sum of the values of X over the n repetitions is n1 x 1 + n 2 x 2 + · · · + n k x k , and the average value of X is n1 n2 nk n1 x 1 + n 2 x 2 + · · · + n k x k = x1 + x2 + · · · + xk . n n n n Now nni is the proportion of the n repetitions in which X = x i . As n gets large we expect this number to approach pi , so we expect the average value of X to approach x1 p1 + x2 p2 + · · · + xk pk = E(X). 11