You are on page 1of 40

Probability and Stochastic Processes

Chapter 2 Discrete Random Variables

0-0
Random Variables
• Experiment: Procedure + Observations
• Observation is an outcome

• Assign a number to each outcome: Random variable

Defintion 2.1: A Random Variable is a function that assigns a real number


to each outcome in the sample space of the experiment.

1
Discrete Random Variables
• SX = range of X (set of possible values)
• X is discrete if SX is countable

• Discrete rv X has PMF

PX (x) = P [X = x]

2
Theorem 2.1 PMF Properties
For a discrete random variable X with PMF PX (x) and range SX :
• For any x, PX (x) ≥ 0

• x∈SX PX (x) = 1

• For B ⊂ SX ,

P [X ∈ B] = PX (x)
x∈B

3
Bernoulli rv
X is a Bernoulli random variable if the PMF of X has the form


⎨ 1−p x=0

PX (x) = p x=1



0 otherwise

where the parameter p is in the range 0 < p < 1.

4
Geometric rv
X is a geometric random variable if the PMF of X has the form

⎨ p(1 − p)x−1 x = 1, 2, . . .
PX (x) =
⎩ 0 otherwise

where the parameter p is in the range 0 < p < 1.

5
Geometric rv Example
Circuit rejected with prob p. Y is the number of tests up to and including the
first reject.

p r •Y =1 p r •Y =2 p r •Y =3
   
  
a a a ...
1−p 1−p 1−p

From the tree, P [Y = 1] = p, P [Y = 2] = p(1 − p),



⎨ p(1 − p)y−1 y = 1, 2, . . .
PY (y) =
⎩ 0 otherwise

6
Geometric: p = 0.2

⎨ (0.2)(0.8)y−1 y = 1, 2, . . .
PY (y) =
⎩ 0 otherwise

0.2

P (y)
0.1

Y
0
0 10 20
y

• Example 2.12 (MATLAB Demo)

7
Binomial (n, p) rv
X is a binomial (n, p) random variable if the PMF of X has the form

n x
PX (x) = p (1 − p)n−x x = 0, 1, . . . , n
x
where 0 < p < 1 and n is an integer such that n ≥ 1.

8
Binomial (n, p) rv Example
• Test n circuits, each circuit is rejected with probability p independent of
other tests.

• K = no. of rejects (a random variable)


• k is the number of rejects in n trials:

⎨ n pk (1 − p)n−k k = 0, 1, . . . , n
PK (k) = k
⎩ 0 otherwise

• Binomial Coin Experiment (Virtual Laboratories)

9
Pascal (k, p) rv
X is a Pascal (k, p) random variable if the PMF of X has the form

x−1 k
PX (x) = p (1 − p)x−k
k−1
where 0 < p < 1 and k is an integer such that k ≥ 1.

10
Pascal rv Example
• No. of tests, L, needed to find k rejects.

P [L = l] = P [AB]

• A = {k − 1 rejects in l − 1 tests}

• B = {reject on attempt l}
• Events A and B are independent

11
Pascal rv Example (continued)
• P [B] = p and P [A] is binomial:

P [A] = P [k − 1 rejects in l − 1 trials]



l − 1 k−1
= p (1 − p)l−1−(k−1)
k−1

PL (l) = P [AB] = P [A]P [B]



⎨ l−1 pk (1 − p)l−k l = k, k + 1, . . .
= k−1
⎩ 0 otherwise

12
Pascal: p = 0.2, k = 4

⎨ l−1
(0.2)4 (0.8)l−4 l = 4, 5, . . .
3
PL (l) =
⎩ 0 otherwise.

0.1
P (l)
0.05
L

0
0 10 20 30 40
l

13
Summary: Examples
• Bernoulli No. of succ. on one trial
• Binomial No. of succ on n trials

• Geometric No. of trials until first succ.

• Pascal No. of trials until succ k

14
Discrete Uniform rv
X is a discrete uniform random variable if the PMF of X has the form

⎨ 1/(l − k + 1) x = k, k + 1, k + 2, . . . , l
PX (x) =
⎩ 0 otherwise

where the parameters k and l are integers such that k < l.

15
Poisson rv
X is a Poisson random variable if the PMF of X has the form

⎨ αx e−α /x! x = 0, 1, 2, . . .
PX (x) =
⎩ 0 otherwise

where the parameter α is in the range α > 0.

16
Poisson rv Example
• Counts arrivals of something on interval time T .
• Arrival rate λ, interval time T .

• With α = λT ,

⎨ αx e−α /x! x = 0, 1, 2, . . .
PX (x) =
⎩ 0 otherwise

• Poisson Experiment (Virtual Laboratories)

17
Poisson: α = 0.5

⎨ (0.5)j e−0.5 /j! j = 0, 1, . . .
PJ (j) =
⎩ 0 otherwise

PJ(j)
0.5

0
0 2 4
j

18
Poisson: α = 5

⎨ 5j e−5 /j! j = 0, 1, . . .
PJ (j) =
⎩ 0 otherwise

0.2

P (j)
0.1

J 0
0 5 10 15
j

19
Binomial and Poisson Distributions
• Theorem 2.8: Perform n Bernoulli trials. In each trial, let the probability
of success be α/n, where α > 0 is a constant and n > α. Let the random
variable Kn be the number of successes in the n trials. As n → ∞,
PKn (k) converges to the PMF of a Poisson (α) random variable.

• Comparison of Binomial and Poisson Distributions (MATLAB Demo)

20
Cumulative Distribution Functions
• The cumulative distribution function (CDF) of random variable X is

FX (x) = P [X ≤ x]

21
CDF Example
1
1

P (r)

F (r)
0.5 0.5
R

R
0 0
−1 0 1 2 3 −1 0 1 2 3
r r

At the discontinuities r = 0 and r = 2, FR (r) is the upper values. (right


hand limit)

22
CDF Properties
For any discrete rv X with range SX = {x1 , x2 , . . .} satisfying
x1 ≤ x2 ≤ . . .,
• FX (−∞) = 0 and FX (∞) = 1

• For all x ≥ x, FX (x ) ≥ FX (x)


• For xi ∈ SX and , an arbitrarily small positive number,

FX (xi ) − FX (xi − ) = PX (xi )

• FX (x) = FX (xi ) for all x such that xi ≤ x < xi+1

23
CDF Properties
• Theorem 2.3: For all b ≥ a,

FX (b) − FX (a) = P [a < X ≤ b].

24
Expected Value
• The expected value of X is

E[X] = μX = xPX (x)
x∈SX

• Also called the average of X.

• A mode of X is a number xmod satisfying

PX (xmod ) ≥ PX (x) for all x.

• A median of X is a number that satisfies

P [X < xmed ] = P [X > xmed ].

25
Average vs. E[X]
1
n
• Average of n samples: mn = n i=1 x(i)
• Each x(i) ∈ SX . If each x ∈ SX occurs Nx times,
1   Nx 
mn = Nx x = x→ xPX (x)
n n
x∈SX x∈SX x∈SX

26
Derived Random Variables
• Each sample value y of a derived rv Y is a function g(x) of a sample
value x of a rv X: y = g(x)
• Notation: Y = g(X)

27
PMF of Y = g(X)

PY (y) = PX (x)
x:g(x)=y

28
Expected value of Y = g(X)
• Theorem 2.10: Given rv X with PMF PX (x), the expected value of
Y = g(X), is

E[Y ] = μY = E[g(X)] = g(x)PX (x)
x∈SX

• Example: Y = aX + b:

E[Y ] = (ax + b)PX (x) = aE[X] + b
x∈SX

29
Variance and Standard Deviation
• Variance: Y = (X − μX )2

E[Y ] = (x − μX )2 PX (x) = Var [X] = σX
2

x∈SX

• Variance measures spread of PMF

• Standard Deviation: σX = Var [X]


• Units of σX are the same as X.

• Theorem 2.13:
2
 
Var [X] = E X − μ2X =E X 2
− (E[X])2 .

30
Properties of the variance
• If Y = aX + b, Var [Y ] = a2 Var [X].

31
Moments
For random variable X,

• The n-th moment is E[X n ]

• The n-th central moment is E[(X − μX )n ]

32
Conditional PMF of X given B
• Definition 2.19: Given the event B, with P [B] > 0, the conditional PMF
of X is
PX|B (x) = P [X = x|B]

• Theorem 2.17:

P [X = x, B] ⎨
X P (x)
x∈B
P [B]
PX|B (x) = =
P [B] ⎩ 0 otherwise

33
Conditional PMF Example
Example: X is geometric with p = 0.1. What is the conditional PMF of X
given event B that X > 9?

34
Conditional PMFs

Theorem 2.16: A random variable X with event space {B1 , B2 , . . . , Bm }


has PMF
m
PX (x) = PX|Bi (x) P [Bi ]
i=1
.

35
Theorem 2.18
• For any x ∈ B, PX|B (x) ≥ 0

• x∈B PX|B (x) = 1

• For any event C ⊂ B, P [C|B], the conditional probability that X is in


the set C, is

P [C|B] = PX|B (x)
x∈C

36
Conditional Expectations
• Replace PX (x) with PX|B (x)

• E[X|B] = x xPX|B (x)

• Theorem 2.19: For event space {B1 , B2 , · · · , Bm },



m
E[X] = E[X|Bi ] P [Bi ].
i=1

• Theorem 2.20: E[g(X)|B] = g(x)PX|B (x)
x
2

• Var [X|B] = E (X − E[X|B]) |B

• Die Coin Experiment (Virtual Laboratories)


• Coin Die Experiment (Virtual Laboratories)

37
Virtual Laboratories
• Binomial Coin Experiment
• Poisson Experiment

• Die Coin Experiment

• Coin Die Experiment

38
Chapter Summary
• Discrete random variables, CDF, and PMF PX (x)
• A function of a random variable Y = g(X)

• Expectation and variance

• Conditional PMF PX|B (x) and conditional expectation E[X|B]

39

You might also like