MIT6 436JF08 Lec05
MIT6 436JF08 Lec05
MIT6 436JF08 Lec05
RANDOM VARIABLES
Contents 1. Random variables and measurable functions 2. Cumulative distribution functions 3. Discrete random variables 4. Continuous random variables A. Continuity B. The Cantor set, an unusual random variable, and a singular measure
Loosely speaking a random variable provides us with a numerical value, depend ing on the outcome of an experiment. More precisely, a random variable can be viewed as a function from the sample space to the real numbers, and we will use the notation X ( ) to denote the numerical value of a random variable X , when the outcome of the experiment is some particular . We may be interested in the probability that the outcome of the experiment is such that X is no larger than some c, i.e., that the outcome belongs to the set { | X ( ) c}. Of course, in order to have a probability assigned to that set, we need to make sure that it is F -measurable. This motivates Denition 1 below.
Example 1. Consider a sequence of ve consecutive coin tosses. An appropriate sample space is = {0, 1}n , where 1 stands for heads and 0 for tails. Let F be the col lection of all subsets of , and suppose that a probability measure P has been assigned to (, F ). We are interested in the number of heads obtained in this experiment. This quantity can be described by the function X : R, dened by X (1 , . . . , n ) = 1 + + n .
With this denition, the set { | X ( ) < 4} is just the event that there were fewer than 4 heads overall, belongs to the -eld F , and therefore has a well-dened probability.
Consider the real line, and let B be the associated Borel -eld. Sometimes, we will also allow random variables that take values in the extended real line, R = R {, }. We dene the Borel -eld on R, also denoted by B , as the smallest -eld that contains all Borel subsets of R and the sets {} and {}. 1.1 Random variables Denition 1. (Random variables) Let (, F ) be a measurable space. (a) A function X : R is a random variable if the set { | X ( ) c} is F -measurable for every c R. (b) A function X : R is an extended-valued random variable if the set { | X ( ) c} is F -measurable for every c R. We note here a convention that will be followed throughout: we will always use upper case letters to denote random variables and lower case letters to denote numerical values (elements of R). Thus, a statement such as X ( ) = x = 5 means that when the outcome happens to be , then the realized value of the random variable is a particular number x, equal to 5.
Example 2. (Indicator functions) Suppose that A , and let IA : {0, 1} be the indicator function of that set; i.e., IA ( ) = 1, if A, and IA ( ) = 0, otherwise. / F , then IA is not a random variable. If A F , then IA is a random variable. But if A Example 3. (A function of a random variable) Suppose that X is a random variable, and let us dene a function Y : R by letting Y ( ) = X 3 ( ), for every , or Y = X 3 for short. We claim that Y is also a random variable. Indeed, for any c R, the set { | Y ( ) c} is the same as the set { | X ( ) c1/3 }, which is in F , since X is a random variable.
1.2 The law of a random variable For a random variable X , the event { | X ( ) c} is often written as {X c}, and is sometimes just called the event that X c. The probability of this event is well dened, since this event belongs to F . Let now B be a more general subset of the real line. We use the notation X 1 (B ) or {X B } to denote the set { | X ( ) B }. 2
Because the collection of intervals of the form (, c] generates the Borel -eld in R, it can be shown that if X is a random variable, then for any Borel B , the set X 1 (B ) is F -measurable. It follows that the probability set P X 1 (B ) = P({ | X ( ) B }) is well-dened. It is often denoted by P(X B ). Denition 2. (The probability law of a random variable) Let (, F , P) be a probability space, and let X : R be a random variable. (a) For every Borel subset B of the real line (i.e., B B ), we dene PX (B ) = P(X B ). (b) The resulting function PX : B [0, 1] is called the probability law of X . Sometimes, PX is also called the distribution of X , not to be confused with the cumulative distribution function dened in the next section. According to the next result, the law PX of X is also a probability measure. Notice here that PX is a measure on (R, B ), as opposed to the original measure P, which is a measure on (, F ). In many instances, the original probability space (, F , P) remains in the background, hidden or unused, and one works directly with the much more tangible probability space (R, B , PX ). Indeed, if we are only interested in the statistical properties of the random variable X , the latter space will do. Proposition 1. Let (, F , P) be a probability space, and let X be a random variable. Then, the law PX of X is a measure on (R, B ). Proof: Clearly, PX (B ) 0, for every Borel set B . Also, PX (R) = P(X R) = P() = 1. We now verify countable additivity. Let {Bi } be a countable sequence of disjoint Borel subsets of R. Note that the sets X 1 (Bi ) are also disjoint, and that 1 X 1 (Bi ), i=1 Bi = i=1 X or, in different notation,
{X i=1 Bi } = i=1 {X Bi }.
1.3 Technical digression: measurable functions The following generalizes the denition of a random variable. Denition 3. Let (1 , F1 ) and (2 , F2 ) be two measurable space. A func tion f : 1 2 is called (F1 , F2 )-measurable (or just measurable, if the relevant -elds are clear from the context) if f 1 (B ) F1 for every B F2 . According to the above denition, given a probability space (, F , P), and taking into account the discussion in Section 1.1, a random variable on a proba bility space is a function X : R that is (F , B )-measurable. As a general rule, functions constructed from other measurable functions using certain simple operations are measurable. We collect, without proof, a number of relevant facts below. Theorem 1. Let (, F ) be a measurable space. (a) (Simple random variables) If A F , the corresponding indicator function IA is measurable (more, precisely, it is (F , B )-measurable). (b) If A1 , . . . , An are F -measurable sets, and x1 , . . . , xn are real numbers, the function X = n i=1 xi IAi , or in more detail, X ( ) =
n i=1
xi IAi ( ),
is a random variable (and is called a simple random variable). (c) Suppose that (, F ) = (R, B ), and that X : R R is continuous. Then, X is a random variable. (d) (Functions of a random variable) Let X be a random variable, and sup pose that f : R R is continuous (or more generally, (B , B )-measurable). Then, f (X ) is a random variable. (e) (Functions of multiple random variables) Let X1 , . . . , Xn be random variables, and suppose that f : Rn R is continuous. Then, f (X1 , . . . , Xn ) is a random variable. In particular, X1 +X2 and X1 X2 are random variables.
Another way that we can form a random variable is by taking the limit of a sequence of random variables. Let us rst introduce some terminology. Let each fn be a function from some set into R. Consider a new function f = inf n fn dened by f ( ) = inf n fn ( ), for every . The functions supn fn , lim inf n fn , and lim supn fn are dened similarly. (Note that even if the fn are everywhere nite, the above dened functions may turn out to be extended-valued. ) If the limit limn fn ( ) exists for every , we say that the sequence of functions {fn } converges pointwise, and dene its pointwise limit to be the function f dened by f ( ) = limn fn ( ). For example, suppose that = [0, 1] and that fn ( ) = n . Then, the pointwise limit f = limn fn exists, and satises f (1) = 1, and f ( ) = 0 for [0, 1). Theorem 2. Let (, F ) be a measurable space. If Xn is a random variable for every n, then inf n Xn , supn Xn , lim inf n Xn , and lim supn Xn are random variables. Furthermore, if the sequence {Xn } converges pointwise, and X = limn Xn , then X is also a random variable. As a special case of Theorem 2, we have that a pointwise limit of simple random variables is measurable. On the other hand, we note that measurable functions can be highly discontinuous. For example the function which equals 1 at every rational number, and equals zero otherwise, is measurable, because it is the indicator function of a measurable set. 2 CUMULATIVE DISTRIBUTION FUNCTIONS
A simple way of describing the probabilistic properties of a random variable is in terms of the cumulative distribution function, which we now dene. Denition 4. (Cumulative distribution function) Let X be a random vari able. The function FX : R [0, 1], dened by FX (x) = P(X x), is called the cumulative distribution function (CDF) of X .
Example 4. Let X be the number of heads in two independent tosses of a fair coin. In
particular, P(X = 0) = P(X = 2) = 1/4, and P(X = 1) = 1/2. Then, 0, if x < 0, 1/4, if 0 x < 1, FX (x) = 3/4, if 1 x < 2. 1, if x 2. Example 5. (A uniform random variable and its square) Consider a probability space (, B , P), where = [0, 1], B is the Borel -eld B , and P is the Lebesgue measure. The random variable U dened by U ( ) = is said to be uniformly distributed. Its CDF is given by 0, if x < 0, x, if 0 < x < 1, FU (x) = 1, if x 1. Consider now the random variable X = U 2 . We have P(U 2 x) = 0, when x < 0, and P(U 2 x) = 1, when x 1. For x [0, 1), we have P(U 2 x) = P { [0, 1] | 2 x} = P { [0, 1] : x} = x. Thus, , if x < 0, 0 x, if 0 x < 1, FX (x) = 1, if x 1.
2.1 CDF properties The cumulative distribution function of a random variable always possesses cer tain properties. Theorem 3. Let X be a random variable, and let F be its CDF. (a) (Monotonicity) If x y , then FX (x) FX (y ). (b) (Limiting values) We have limx FX (x) = 0, and limx F (x) = 1. (c) (Right-continuity) For every x, we have limyx FX (y ) = FX (x). Proof: (a) Suppose that x y . Then, {X x} {X y }, which implies that F (x) = P(X x) P(X y ) = F (y ). 6
(b) Since FX (x) is monotonic in x and bounded below by zero, it converges as x , and the limit is the same for every sequence {xn } converging to . So, let xn = n, and note that the sequence of events n=1 {X n} converges to the empty set. Using the continuity of probabilities, we obtain
x
The proof of limx FX (x) = 1 is similar, and is omitted. (c) Consider a decreasing sequence {xn } that converges to x. The sequence of events {X xn } is decreasing and n=1 {X xn } = {X x}. Using the continuity of probabilities, we obtain
n
Since this is true for every such sequence {xn }, we conclude that limyx FX (y ) = FX (x). We note that CDFs need not be left-continuous. For instance, in Example 4, we have limx0 FX (x) = 0, but FX (0) = 1/4. 2.2 From a CDF to a probability law Consider a function F : R [0, 1] that satises the three properties in Theorem 3; we call such a function a distribution function. Given a distribution function F , does there exist a random variable X , dened on some probability space, whose CDF, FX , is equal to the given distribution F ? This is certainly the case for the distribution function F function that satises F (x) = x, for x (0, 1): the uniform random variable U in Example 5 will do. More generally, the objective FX = F can be accomplished by letting X = g (U ), for a suitable function g : (0, 1) R. Theorem 4. Let F be a given distribution function. Consider the probabil ity space ([0, 1], B , P), where B is the Borel -eld, and P is the Lebesgue measure. There exists a measurable function X : R whose CDF FX satises FX = F . Proof: We present the proof under an additional simplifying assumption. In particular, we assume that F is continuous and strictly increasing. Then, the
range of F is the entire interval (0, 1). Furthermore, F is invertible: for ev ery y (0, 1), there exists a unique x, denoted F 1 (y ), such that F (x) = y . We dene U ( ) = and X ( ) = F 1 ( ), for every (0, 1), so that X = F 1 (U ). Note that F (F 1 ( )) = for every (0, 1), so that F (X ) = U . Since F is strictly increasing, we have X x if and only F (X ) F (x), or U F (x). (Note that this also establishes that the event {X x} is measurable, so that X is indeed a random variable.) Thus, for every x R, we have FX (x) = P(X x) = P F (X ) F (x) = P(U F (x)) = F (x), as desired. Note that the probability law of X assigns probabilities to all Borel sets, whereas the CDF only species the probabilities of certain intervals. Neverthe less, the CDF contains enough information to recover the law of X . Proposition 2. The probability law PX of a random variable X is uniquely determined by the CDF FX . Proof: (Outline) Let F0 be the collection of all subsets of the real line that are unions of nitely many intervals of the form (a, b]. Then, F0 is a eld. Note that, the CDF FX can be used to completely determine the probability PX (A) of a set A F0 . Indeed, this is done using relations such as PX ((a, b]) = P((, b]) P((, a]) = FX (b) FX (a), and nite additivity. Thus, FX completely determines PX on F0 . Using the Extension Theorem, it follows that there exists a unique measure on (R, B ) (the probability law of X ) that agrees with the values determined by FX on F0 . 3 DISCRETE RANDOM VARIABLES
Discrete random variables take values in a countable set. We need some nota tion. Given a function f : R, its range is the set f () = {x R | such that f ( ) = x}.
Denition 5. Discrete random variables and PMFs) (a) A random variable X , dened on a probability space (, F , P), is said to be discrete if its range X () is countable. (b) If X is a discrete random variable, the function pX : R [0, 1] dened by pX (x) = P(X = x), for every x, is called the (probability) mass function of X , or PMF for short. Consider a discrete random variable X whose range is a nite set C . In that case, for any Borel set A, countable additivity yields P(X A) = P(X A C ) = P(X = x).
x C
P(X = y ).
A random variable that takes only integer values is discrete. For instance, the random variable in Example 4 (number of heads in two coin tosses) is discrete. Also, every simple random variable is discrete, since it takes a nite number of values. However, more complicated discrete random variables are also possible.
Example 6. Let the sample space be the set N of natural numbers, and consider a measure that satises P(n) = 1/2n , for every n N. The random variable X dened by X (n) = n is discrete. Suppose now that the rational numbers have been arranged in a sequence, and that xn is the nth rational number, according to this sequence. Consider the random variable Y dened by Y (n) = xn . The range of this random variable is countable, so Y is a discrete random variable. Its range is the set of rational numbers, every rational number has positive probability, and the set of irrational numbers has zero probability.
We close by noting that discrete random variables can be represented in terms of indicator functions. Indeed, given a discrete random variable X , with range {x1 , x2 , . . .}, we dene An = {X = xn }, for every n N. Observe that each set An is measurable (why?). Furthermore, the sets An , n N, form a partition of the sample space. Using indicator functions, we can write X ( ) =
n=1
xn IAn ( ).
Conversely, suppose we are given a sequence {An } of disjoint events, and a real sequence {xn }. Dene X : R by letting X ( ) = xn if and only if An . Then X is a discrete random variable, and P(X = xn ) = P(An ), for every n. 4 CONTINUOUS RANDOM VARIABLES
The denition of a continuous random variable is more subtle. It is not enough for a random variable to have a continuous range. Denition 6. A random variable X , dened on a probability space (, F , P), is said to be continuous if there exists a nonnegative measurable function f : R [0, ) such that x FX (x) = f (t) dt, x R. (1)
The function f is called a (probability) density function (or PDF, for short) for X , There is some ambiguity in the above denition, because the meaning of the integral of a measurable function may be unclear. We will see later in this course how such an integral is dened. For now, we just note that the integral is well-dened, and agrees with the Riemann integral encountered in calculus, if the function is continuous, or more generally, if it has a nite number of discontinuities. x Since limx FX (x) = 1, we must have limx f (t)dt = 1, or
fX (t) dt = 1.
(2)
Any nonnegative measurable function that satises Eq. (2) is called adensity x function. Conversely, given a density function f , we can dene F (x) = f (t) dt, and verify that F is a distribution function. It follows that given a density func tion, there always exists a random variable whose PDF is the given density. If a CDF FX is differentiable at some x, the corresponding value fX (x) can be found by taking the derivative of FX at that point. However, CDFs need not be differentiable, so this will not always work. Let us also note that a PDF of a continuous random variable is not uniquely dened. We can always change the PDF at a nite set of points, without affecting its integral, hence multiple 10
PDFs can be associated to the same CDF. However, this nonuniqueness rarely becomes an issue. In the sequel, we will often refer to the PDF of X , ignoring the fact that it is nonunique.
Example 7. For a uniform random variable, we have FX (x) = P(X x) = x, for every x (0, 1). By differentiating, we nd fX (x) = 1, for x (0, 1). For x < 0 we have FX (x) = 0, and for x > 1 we have FX (x) = 1; in both cases, we obtain fX (x) = 0. At x = 0, the CDF is not differentiable. We are free to dene fX (0) to be 0, or 1, or in fact any real number; the value of the integral of fX will remain unaffected.
Using the PDF of a continuous random variable, we can calculate the prob ability of various subsets of the real line. For example, we have P(X = x) = 0, for all x, and if a < b, b P(a < X < b) = P(a X b) = fX (t) dt.
a
More generally, for any Borel set B , it turns out that P(X B ) = f (t) dt = IB (t)fX (t) dt,
B
and that P(X B ) = 0 whenever B has Lebesgue measure zero. However, more detail on this subject must wait until we develop the theory of integration of measurable functions. We close by pointing out that not all random variables are continuous or discrete. For example, suppose that X is a discrete random variable, and that Y is a continuous random variable. Fix some (0, 1), and dene F (z ) = FX (x) + (1 )FY (y ). (3)
It can be veried that F is a distribution function, and therefore can be viewed as the CDF of some new random variable Z . However, the random variable Z is neither discrete, nor continuous. For an interpretation, we can visualize Z being generated as follows: we rst generate the random variables X and Y ; then, with probability , we set Z = X , and with probability 1 , we set Z = Y . Even more pathological random variables are possible. Appendix B dis cusses a particularly interesting one. 5 APPENDIX A CONTINUOUS FUNCTIONS
We introduce here some standard notation and terminology regarding conver gence of function values, and continuity. 11
(a) Consider a function f : Rm R, and x some x Rm . We say that f (y ) converges to a value c, as y tends to x, if we have limn f (xn ) = c, for every sequence {xn } of elements of Rm such that xn = x for all n, and limn xn = x. In this case, we write limyx f (y ) = c. (b) If f : Rm R and limyx f (y ) = f (x), we say that continuous at x. If this holds for every x, we say that f is continuous. (c) Consider a function f : R R, and x some x R {}. We say that f (y ) converges to a value c, as y decreases to x, if we have limn f (xn ) = c, for every decreasing sequence {xn } of elements of Rm such that xn > x for all n, and limn xn = x. In this case, we write limyx f (y ) = c. (d) If f : R R and limyx f (y ) = f (x), we say that the function f is right-continuous at x. If this holds for every x R, we say that f is right-continuous. (e) Consider a function f : R R, and x some x R {}. We say that f (y ) converges to a value c, as y increases to x, if we have limn f (xn ) = c, for every increasing sequence {xn } of elements of R such that xn < x for all n, and limn xn = x. In this case, we write limyx f (y ) = c. (f) If f : R R and limyx f (y ) = f (x), we say that the function f is left-continuous at x. If this holds for every x R, we say that f is leftcontinuous. For a function f : R R, and some x R, it is not hard to show, starting from the above denitions, that f is continuous at x if and only if it is both left-continuous and right-continuous. 6 APPENDIX B THE CANTOR SET, AN UNUSUAL RANDOM VARI ABLE, AND A SINGULAR MEASURE
3i
(4)
This expansion is not unique. For example, 1/3 admits two expansions, namely .10000 and .022222 . Nonuniqueness occurs only for those x that admit an expansion ending with an innite sequence of 2s. The set of such unusual x is countable, and therefore has Lebesgue measure zero. 12
The Cantor set C is dened as the set of all x [0, 1] that have a ternary ex pansion that uses only 0s and 2s (no 1s allowed). The set C can be constructed as follows. Start with the interval [0, 1] and remove the middle third (1/3, 2/3). Then, from each of the remaining closed intervals, [0, 1/3] and [2/3, 1], remove their middle thirds, (1/9, 2/9) and (7/9, 8/9), resulting in four closed intervals, and continue this process indenitely. Note that C is measurable, since it is constructed by removing a countable sequence of intervals. Also, the length (Lebesgue measure) of C is 0, since at each stage its length is mutliplied by a factor of 2/3. On the other hand, the set C has the same cardinality as the set {0, 2} , and is uncountable. Consider now an innite sequence of independent rolls of a 3-sided die, whose faces are labeled 0, 1, and 2. Assume that at each roll, each of the three possible results has the same probability, 1/3. If we use the sequence of these rolls to form a number x, then the probability law of the resulting random vari able is the Lebesgue measure (i.e., picking a ternary expansion at random leads to a uniform random variable). The Cantor set can be identied with the event consisting of all roll se quences in which a 1 never occurs. (This event has zero probability, which is consistent with the fact that C has zero Lebesgue measure.) Consider now an innite sequence of independent tosses of a fair coin. If the ith toss results in tails, record xi = 0; if it results in heads, record xi = 2. Use the xi s to form a number x, using Eq. (4). This denes a random variable X on ([0, 1], B ), whose range is the set C . The probability law of this random variable is therefore concentrated on the zero-length set C . At the same time, P(X = x) = 0 for every x, because any particular sequence of heads and tails has zero probability. A measure with this property is called singular. The random variable X that we have constructed here is neither discrete nor continuous. Moreover, the CDF of X cannot be written as a mixture of the kind considered in Eq. (3).
13
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.