Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

1 What Is A Random Variable (R.V.) ?

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Note: Handouts DO NOT replace the book.

In most cases, they only provide a


guideline on topics and an intuitive feel.

1 What is a random variable (r.v.)?


• A real valued function of the outcome of an experiment

• Example: Coin tosses. r.v. X = 1 if heads and X = 0 if tails (Bernoulli r.v.).

• A function of a r.v. defines another r.v.

• Discrete r.v.: X takes values from the set of integers

2 Discrete Random Variables & Probability Mass Function (PMF)


• Probability Mass Function (PMF): Probability that the r.v. X takes a value x is PMF
of X computed at X = x. Denoted by pX (x). Thus

pX (x) = P ({X = x}) = P (all possible outcomes that result in the event {X = x}) (1)

• Everything that we learnt in Chap 1 for events applies. Let Ω is the sample space (space of
all possible values of X in an experiment). Applying the axioms,

– pX (x) ≥ 0
X
– P ({X ∈ S}) = pX (x) (follows from Additivity since different events {X = x} are
x∈S
disjoint)
X
– pX (x) = 1 (follows from Additivity and Normalization).
x∈Ω
2
X
– Example: X = number of heads in 2 fair coin tosses (p = 1/2). P (X > 0) = pX (x) =
x=1
0.75.

• Can also define a binary r.v. for any event A as: X = 1 if A occurs and X = 0 otherwise.
Then X is a Bernoulli r.v. with p = P (A).

• Bernoulli (X = 1 (heads) or X = 0 (tails)) r.v. with probability of heads p

Bernoulli(p) : pX (x) = px (1 − p)1−x , x = 0, or x = 1 (2)

• Binomial (X = x heads out of n independent tosses, probability of heads p)


³ ´
Binomial(n, p) : pX (x) = nx px (1 − p)n−x , x = 0, 1, . . . n (3)

• Geometric r.v., X, with probability of heads p (X= number of coin tosses needed for a head
to come up for the first time or number of independent trials needed to achieve the first
“success”).

1
– Example: I keep taking a test until I pass it. Probability of passing the test in the xth
try is pX (x).
– Easy to see that

Geometric(p) : pX (x) = (1 − p)x−1 p, x = 0, 1, 2, . . . ∞ (4)

• Poisson r.v. X with expected number of arrivals Λ (e.g. if X = number of arrivals in time τ
with arrival rate λ, then Λ = λτ )

e−Λ (Λ)x
P oisson(Λ) : pX (x) = , x = 0, 1, . . . ∞ (5)
x!

• Uniform(a,b):
(
1/(b − a + 1), if x = a, a + 1, . . . b
pX (x) = (6)
0, otherwise

• pmf of Y = g(X)
X
– pY (y) = P ({Y = y}) = pX (x)
x|g(x)=y
Example Y = |X|. Then pY (y) = pX (y) + pX (−y), if y > 0 and pY (0) = pX (0).
Exercise: X ∼ U nif orm(−4, 4) and Y = |X|, find pY (y).

• Expectation, mean, variance

– Motivating example: Read pg 81


X
– Expected value of X (or mean of X): E[X] , xpX (x)
x∈Ω
– Interpret mean as center of gravity of a bar with weights pX (x) placed at location x
(Fig. 2.7)
X
– Expected value of Y = g(X): E[Y ] = E[g(X)] = g(x)pX (x). Exercise: show this.
x∈Ω

– nth moment of X: E[X n ]. nth central moment: E[(X − E[X])n ].


– Variance of X: var[X] , E[(X − E[X])2 ] (2nd central moment)
– Y = aX + b (linear fn): E[Y ] = aE[X] + b, var[Y ] = a2 var[X]
– Poisson: E[X] = Λ, var[X] = Λ (show this)
– Bernoulli: E[X] = p, var[X] = p(1 − p) (show this)
(b−a+1)2 −1
– Uniform(a,b): E[X] = (a + b)/2, var[X] = 12 (show this)

• Application: Computing average time. Example 2.4

• Application: Decision making using expected values. Example 2.8 (Quiz game, compute
expected reward with two different strategies to decide which is a better strategy).

• Binomial(n, p) becomes P oisson(np) if time interval between two coin tosses becomes very
small (so that n becomes very large and p becomes very small, but Λ = np is finite). **

2
3 Multiple Discrete Random Variables: Topics
• Joint PMF, Marginal PMF of 2 and or more than 2 r.v.’s

• PMF of a function of 2 r.v.’s

• Expected value of functions of 2 r.v’s

• Expectation is a linear operator. Expectation of sums of n r.v.’s

• Conditioning on an event and on another r.v.

• Bayes rule

• Independence

4 Joint & Marginal PMF, PMF of function of r.v.s, Expectation


• For everything in this handout, you can think in terms of events {X = x} and {Y = y} and
apply what you have learnt in Chapter 1.

• The joint PMF of two random variables X and Y is defined as

pX,Y (x, y) , P (X = x, Y = y)

where P (X = x, Y = y) is the same as P ({X = x} ∩ {Y = y}).

– Let A be the set of all values of x, y that satisfy a certain property, then
P
P ((X, Y ) ∈ A) = (x,y)∈A pX,Y (x, y)
– e.g. X = outcome of first die toss, Y is outcome of second die toss, A = sum of outcomes
of the two tosses is even.

• Marginal PMF is another term for the PMF of a single r.v. obtained by “marginalizing”
the joint PMF over the other r.v., i.e. the marginal PMF of X, pX (x) can be computed as
follows:
Apply Total Probability Theorem to pX,Y (x, y), i.e. sum over {Y = y} for different values y
(these are a set of disjoint events whose union is the sample space):
X
pX (x) = pX,Y (x, y)
y

Similarly the marginal PMF of Y , pY (y) can be computed by “marginalizing” over X


X
pY (y) = pX,Y (x, y)
x

• PMF of a function of r.v.’s: If Z = g(X, Y ),


X
pZ (z) = pX,Y (x, y)
(x,y):g(x,y)=z

– Read the above as pZ (z) = P (Z = z) = P (all values of (X, Y ) for which g(X, Y ) = z)

3
• Expected value of functions of multiple r.v.’s
If Z = g(X, Y ), X
E[Z] = g(x, y)pX,Y (x, y)
(x,y)

• See Example 2.9

• More than 2 r.v.s.

– Joint PMF of n r.v.’s: pX1 ,X2 ,...Xn (x1 , x2 , . . . xn )


– We can marginalize over one or more than one r.v.,
P
e.g. pX1 ,X2 ,...Xn−1 (x1 , x2 , . . . xn−1 ) = xn pX1 ,X2 ,...Xn (x1 , x2 , . . . xn )
P
e.g. pX1 ,X2 (x1 , x2 ) = x3 ,x4 ,...xn pX1 ,X2 ,...Xn (x1 , x2 , . . . xn )
P
e.g. pX1 (x1 ) = x2 ,x3 ,...xn pX1 ,X2 ,...Xn (x1 , x2 , . . . xn )
See book, Page 96, for special case of 3 r.v.’s

• Expectation is a linear operator. Exercise: show this

E[a1 X1 + a2 X2 + . . . an Xn ] = a1 E[X1 ] + a2 E[X2 ] + . . . an E[Xn ]

– Application: Binomial(n, p) is the sum of n Bernoulli r.v.’s. with success probability p,


so its expected value is np (See Example 2.10)
– See Example 2.11

5 Conditioning and Bayes rule


• PMF of r.v. X conditioned on an event A with P (A) > 0

P ({X = x} ∩ A)
pX|A (x) , P ({X = x}|A) =
P (A)
P
– pX|A (x) is a legitimate PMF, i.e. x pX|A (x) = 1. Exercise: Show this
– Example 2.12, 2.13

• PMF of r.v. X conditioned on r.v. Y . Replace A by {Y = y}

P ({X = x} ∩ {Y = y}) pX,Y (x, y)


pX|Y (x|y) , P ({X = x}|{Y = y}) = =
P ({Y = y}) pY (y)

The above holds for all y for which py (y) > 0. The above is equivalent to

pX,Y (x, y) = pX|Y (x|y)pY (y)

pX,Y (x, y) = pY |X (y|x)pX (x)


P
– pX|Y (x|y) (with pY (y) > 0) is a legitimate PMF, i.e. x pX|Y (x|y) = 1.
P
– Similarly, pY |X (y|x) is also a legitimate PMF, i.e. y pY |X (y|x) = 1. Show this.
– Example 2.14 (I did a modification in class), 2.15

4
• Bayes rule. How to compute pX|Y (x|y) using pX (x) and pY |X (y|x),

pX,Y (x, y)
pX|Y (x|y) =
pY (y)
pY |X (y|x)pX (x)
= P ′ ′
x′ pY |X (y|x )pX (x )

• Conditional Expectation given event A


X
E[X|A] = xpX|A (x)
x
X
E[g(X)|A] = g(x)pX|A (x)
x

• Conditional Expectation given r.v. Y = y. Replace A by {Y = y}


X
E[X|Y = y] = xpX|Y (x|y)
x

Note this is a function of Y = y.

• Total Expectation Theorem


X
E[X] = pY (y)E[X|Y = y]
y

Proof on page 105.

• Total Expectation Theorem for disjoint events A1 , A2 , . . . An which form a partition


of sample space.
Xn
E[X] = P (Ai )E[X|Ai ]
i=1

Note Ai ’s are disjoint and ∪ni=1 Ai =Ω

– Application: Expectation of a geometric r.v., Example 2.16, 2.17

6 Independence
• Independence of a r.v. & an event A. r.v. X is independent of A with P (A) > 0, iff

pX|A (x) = pX (x), for all x

– This also implies: P ({X = x} ∩ A) = pX (x)P (A).


– See Example 2.19

5
• Independence of 2 r.v.’s. R.v.’s X and Y are independent iff

pX|Y (x|y) = pX (x), for all x and for all y for which pY (y) > 0

This is equivalent to the following two things(show this)

pX,Y (x, y) = pX (x)pY (y)

pY |X (y|x) = pY (y), for all y and for all x for which pX (x) > 0

• Conditional Independence of r.v.s X and Y given event A with P (A) > 0 **


pX|Y,A (x|y) = pX|A (x) for all x and for all y for which pY |A (y) > 0 or that
pX,Y |A (x, y) = pX|A (x)pY |A (y)

• Expectation of product of independent r.v.s.

– If X and Y are independent, E[XY ] = E[X]E[Y ].


XX
E[XY ] = xypX,Y (x, y)
y x
XX
= xypX (x)pY (y)
y x
X X
= ypY (y) xpX (x)
y x
= E[X]E[Y ]

– If X and Y are independent, E[g(X)h(Y )] = E[g(X)]E[h(Y )]. (Show).

• If X1 , X2 , . . . Xn are independent,

pX1 ,X2 ,...Xn (x1 , x2 , . . . xn ) = pX1 (x1 )pX2 (x2 ) . . . pXn (xn )

• Variance of sum of 2 independent r.v.’s.


Let X, Y are independent, then V ar[X + Y ] = V ar[X] + V ar[Y ].
See book page 112 for the proof

• Variance of sum of n independent r.v.’s.


If X1 , X2 , . . . Xn are independent,

V ar[X1 + X2 + . . . Xn ] = V ar[X1 ] + V ar[X2 ] + . . . V ar[Xn ]

– Application: Variance of a Binomial, See Example 2.20


Binomial r.v. is a sum of n independent Bernoulli r.v.’s. So its variance is np(1 − p)
– Application: Mean and Variance of Sample Mean, Example 2.21
Let X1 , X2 , . . . Xn be independent and identically distributed, i.e. pXi (x) = pX1 (x) for
all i. Thus all have the same mean (denote by a) and same variance (denote by v).
Sample mean is defined as Sn = X1 +X2n+...Xn .
Since E[.] is a linear operator, E[Sn ] = ni=1 n1 E[Xi ] = na
P
Pn 1 n = a.
Since the Xi ’s are independent, V ar[Sn ] = i=1 n2 V ar[Xi ] = nv n2
= nv
– Application: Estimating Probabilities by Simulation, See Example 2.22

You might also like