Chapter 2
Chapter 2
Chapter 2
0-0
Random Variables
• Experiment: Procedure + Observations
• Observation is an outcome
1
Discrete Random Variables
• SX = range of X (set of possible values)
• X is discrete if SX is countable
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
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
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
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
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.
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:
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
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
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
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
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.
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
22
CDF Properties
For any discrete rv X with range SX = {x1 , x2 , . . .} satisfying
x1 ≤ x2 ≤ . . .,
• FX (−∞) = 0 and FX (∞) = 1
23
CDF Properties
• Theorem 2.3: For all b ≥ a,
24
Expected Value
• The expected value of X is
E[X] = μX = xPX (x)
x∈SX
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
• 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,
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
35
Theorem 2.18
• For any x ∈ B, PX|B (x) ≥ 0
• x∈B PX|B (x) = 1
36
Conditional Expectations
• Replace PX (x) with PX|B (x)
• E[X|B] = x xPX|B (x)
37
Virtual Laboratories
• Binomial Coin Experiment
• Poisson Experiment
38
Chapter Summary
• Discrete random variables, CDF, and PMF PX (x)
• A function of a random variable Y = g(X)
39