Chap4-Continuous Random Variables
Chap4-Continuous Random Variables
X(·) : S → R.
EXAMPLE :
Rotate a pointer about a pivot in a plane (like a hand of a clock).
The outcome is the angle where it stops : 2πθ , where θ ∈ (0, 1] .
A good sample space is all values of θ , i.e. S = (0, 1] .
A very simple example of a continuous random variable is X(θ) = θ .
142
The (cumulative) probability distribution function is defined as
FX (x) ≡ P (X ≤ x) .
Thus
FX (b) − FX (a) ≡ P (a < X ≤ b) .
We must have
NOTE : All the above is the same as for discrete random variables !
143
EXAMPLE : In the ”pointer example ”, where X(θ) = θ , we have
the probability distribution function
F(theta)
1/2
1/3
theta
0 1/3 1/2 1
Note that
F ( 31 ) ≡ P (X ≤ 13 ) = 1
3
, F ( 21 ) ≡ P (X ≤ 12 ) = 1
2
,
P ( 31 < X ≤ 12 ) = F ( 12 ) − F ( 13 ) = 1
2
− 1
3
= 1
6
.
QUESTION : What is P ( 31 ≤ X ≤ 21 ) ?
144
The probability density function is the derivative of the probability
distribution function :
′ d
fX (x) ≡ FX (x) ≡ FX (x) .
dx
Thus
0, x≤0
fX (x) = FX′ (x) = 1, 0<x≤1
0, 1<x
145
EXAMPLE : ( continued · · · )
0, x≤0 0, x≤0
F (x) = x, 0<x≤1 , f (x) = 1, 0<x≤1
1, 1<x 0, 1<x
F(theta) f(theta)
1 1
1/2
1/3
theta theta
0 1/3 1/2 1 0 1/3 1/2 1
NOTE :
1
1 1 1
Z
2
P( < X ≤ ) = f (x) dx = = the shaded area .
3 2 1
3
6
146
In general, from
f (x) ≡ F ′ (x) ,
with
F (−∞) = 0 and F (∞) = 1 ,
Z x
f (x) dx = F (x) − F (−∞) = F (x) = P (X ≤ x) ,
−∞
Z b
f (x) dx = F (b) − F (a) = P (a < X ≤ b) ,
a
Z a
f (x) dx = F (a) − F (a) = 0 = P (X = a) .
a
147
EXERCISE : Draw graphs of the distribution and density functions
0, x≤0 0, x≤0
F (x) = , f (x) = ,
1 − e−x , x > 0 e−x , x > 0
148
EXERCISE : For positive integer n, consider the density functions
n
cx (1 − xn ) , 0 ≤ x ≤ 1
fn (x) =
0, otherwise
• Determine P (0 ≤ X ≤ 21 ) in terms of n .
149
Joint distributions
∂ 2 FX,Y (x, y)
By Calculus we have = fX,Y (x, y) .
∂x∂y
Also, Z d Z b
P (a < X ≤ b , c < Y ≤ d) = fX,Y (x, y) dx dy .
c a
150
EXAMPLE :
If
1 for x ∈ (0, 1] and y ∈ (0, 1] ,
fX,Y (x, y) =
0 otherwise ,
Thus
FX,Y (x, y) = xy , for x ∈ (0, 1] and y ∈ (0, 1] .
For example
1 1 1 1 1
P( X ≤ , Y ≤ ) = FX,Y ( , ) = .
3 2 3 2 6
151
0.9
1.5 0.8
0.7
1.0 0.6
f 0.5
0.5
F 0.4
0.3
0.2
0.1 0.1
0.2 0.1
0.2
0.3 0.3
0.4
y 0.4 0.5 0.3
0.2
0.1
0.1 0.2
0.3 0.4 0.7
0.6
0.5 x
0.5
0.6
0.7 0.5
0.4
x y 0.6 0.7 0.8 0.9
0.9
0.8
0.6
0.8 0.7
0.9 0.8
0.9
Also,
3 1
1 1 1 3 1
Z Z
4 2
P( ≤ X ≤ , ≤ Y ≤ ) = f (x, y) dx dy = .
3 2 4 4 1
4
1
3
12
152
Marginal density functions
Z y Z y Z ∞
FY (y) ≡ P (Y ≤ y) = fY (y) dy = fX,Y (x, y) dx dy .
−∞ −∞ −∞
By Calculus we have
dFX (x) dFY (y)
= fX (x) , = fY (y) .
dx dy
153
EXAMPLE : If
1 for x ∈ (0, 1] and y ∈ (0, 1] ,
fX,Y (x, y) =
0 otherwise ,
154
EXERCISE :
(1 − e−x )(1 − e−y )
for x ≥ 0 and y ≥ 0 ,
Let FX,Y (x, y) =
0 otherwise .
• Verify that
2
e−x−y
∂ F for x ≥ 0 and y ≥ 0 ,
fX,Y (x, y) = =
∂x∂y 0 otherwise .
0.9
0.8
0.7
0.9
0.6 0.8
0.5 0.7
f 0.4 0.6
0.5
0.3
F 0.4
0.2 0.3
0.1 0.2
0.1
1 1
2 1
1 2
3 2 2
y 4
3 3
4 x y
3 x
4 4
155
EXERCISE : ( continued · · · )
FX,Y (x, y) = (1−e−x )(1−e−y ) , fX,Y (x, y) = e−x−y , for x, y ≥ 0 .
R∞R∞
• 0 0
fX,Y (x, y) dx dy = 1 , ( Why zero lower limits ? )
R∞
• fX (x) = 0
e−x−y dy = e−x ,
R∞
• fY (y) = 0
e−x−y dx = e−y .
156
EXERCISE : ( continued · · · )
157
Independent continuous random variables
Equivalently, X(s) and Y (s) are independent if for all such sets
IX and IY the events
X −1 (IX ) and Y −1 (IY ) ,
are independent in the sample space S.
158
FACT : X(s) and Y (s) are independent if for all x and y
fX,Y (x, y) = fX (x) · fY (y) .
NOTE :
(1 − e−x )(1 − e−y ) for x ≥ 0 and y ≥ 0 ,
FX,Y (x, y) =
0 otherwise ,
also satisfies (by the preceding exercise)
FX,Y (x, y) = FX (x) · FY (y) .
159
PROPERTY :
For independent continuous random variables X and Y we have
FX,Y (x, y) = FX (x) · FY (y) , for all x, y .
PROOF :
FX,Y (x, y) = P (X ≤ x , Y ≤ y)
Rx Ry
= −∞ −∞
fX,Y (x, y) dy dx
Rx Ry
= −∞ −∞
fX (x) · fY (y) dy dx (by independence)
Rx Ry
= −∞
[ fX (x) · −∞
fY (y) dy ] dx
Rx Ry
= [ −∞
fX (x) dx ] · [ −∞
fY (y) dy ]
= FX (x) · FY (y) .
REMARK : Note how the proof parallels that for the discrete case !
160
Conditional distributions
Let X and Y be continuous random variables.
For given allowable sets IX and IY (typically intervals), let
Ex = X −1 (IX ) and Ey = Y −1 (IY ) ,
be their corresponding events in the sample space S .
P (Ex Ey )
We have P (Ex |Ey ) ≡ .
P (Ey )
161
EXAMPLE : The random variables with density function
−x−y
e for x ≥ 0 and y ≥ 0 ,
fX,Y (x, y) =
0 otherwise ,
162
Expectation
163
EXAMPLE :
we have
∞ 1
x2 1
Z Z 1
E[X] = x fX (x) dx = x dx = = ,
−∞ 0 2 0 2
and
∞ 1
x3 1
Z Z 1
2 2 2
E[X ] = x fX (x) dx = x dx = = .
−∞ 0 3 0 3
164
EXAMPLE : For the joint density function
−x−y
e for x > 0 and y > 0 ,
fX,Y (x, y) =
0 otherwise .
Z ∞ ∞
−x −x
Thus E[X] = dx = −[(x+1)e ]
xe = 1 . ( Check ! )
0 0
Z ∞
Similarly E[Y ] = y e−y dy = 1 ,
0
and Z ∞ Z ∞
E[XY ] = xy e−x−y dy dx = 1 . ( Check ! )
0 0
165
EXERCISE :
Prove the following for continuous random variables :
• E[aX] = a E[X] ,
• E[aX + b] = a E[X] + b ,
EXERCISE :
A stick of length 1 is split at a randomly selected point X.
( Thus X is uniformly distributed in the interval [0, 1]. )
Determine the expected length of the piece containing the point 1/3.
166
PROPERTY : If X and Y are independent then
R R
E[XY ] = R R
x y fX,Y (x, y) dy dx
R R
= R R
x y fX (x) fY (y) dy dx (by independence)
R R
= R
[ x fX (x) R
y fY (y) dy ] dx
R R
= [ R x fX (x) dx ] · [ R y fY (y) dy ]
= E[X] · E[Y ] .
REMARK : Note how the proof parallels that for the discrete case !
167
EXAMPLE : For −x−y
e for x > 0 and y > 0 ,
fX,Y (x, y) =
0 otherwise ,
we already found
fX (x) = e−x , fY (y) = e−y ,
so that
fX,Y (x, y) = fX (x) · fY (y) ,
168
Variance Z ∞
Let µ = E[X] = x fX (x) dx
−∞
169
e−x ,
x>0,
EXAMPLE : For f (x) =
0, x≤0,
we have
R∞
E[X] = µ = 0
x e−x dx = 1 ( already done ! ) ,
R∞ ∞
2 2 −x 2 −x
E[X ] = 0
x e dx = − [(x + 2x + 2)e ] = 2,
0
V ar(X) = E[X 2 ] − µ2 = 2 − 12 = 1 ,
p
σ(X) = V ar(X) = 1 .
EXERCISE :
Also use the Method of Moments to compute E[X] and E[X 2 ] .
170
EXERCISE : For the random variable X with density function
0, x ≤ −1
f (x) = c , −1 < x ≤ 1
0, x>1
171
EXERCISE : For the random variable X with density function
x + 1 , −1 < x ≤ 0
f (x) = 1−x , 0<x≤1
0, otherwise
172
EXERCISE : For the random variable X with density function
3
(1 − x2 ) , −1 < x ≤ 1
f (x) = 4
0, otherwise
• Draw the graph of f (x)
R∞
• Verify that −∞ f (x) dx = 1
• Determine the distribution function F (x)
• Draw the graph of F (x)
• Determine E[X]
• Compute V ar(X) and σ(X)
• Determine P (X ≤ 0)
• Compute P (X ≥ 23 )
• Compute P (| X |≥ 23 )
173
EXERCISE : Recall the density function
n
cx (1 − xn ) , 0 ≤ x ≤ 1
fn (x) =
0, otherwise
• Determine E[X 2 ]
174
Covariance
Let X and Y be continuous random variables with mean
E[X] = µX , E[Y ] = µY .
Cov(X, Y ) ≡ E[ (X − µX ) (Y − µY ) ]
Z ∞ Z ∞
= (x − µX ) (y − µY ) fX,Y (x, y) dy dx .
−∞ −∞
= E[XY − µX Y − µY X + µX µY ]
175
As in the discrete case, we also have
PROPERTY 1 :
• V ar(X + Y ) = V ar(X) + V ar(Y ) + 2 Cov(X, Y ) ,
and
NOTE :
• The proofs are identical to those for the discrete case !
176
EXAMPLE : For
−x−y
e for x > 0 and y > 0 ,
fX,Y (x, y) =
0 otherwise ,
we already found
fX (x) = e−x , fY (y) = e−y ,
so that
fX,Y (x, y) = fX (x) · fY (y) ,
177
EXERCISE :
• V ar(cX + d) = c2 V ar(X) ,
• Cov(X, Y ) = Cov(Y, X) ,
• Cov(cX, Y ) = c Cov(X, Y ) ,
• Cov(X, cY ) = c Cov(X, Y ) ,
178
EXERCISE :
R1R1
• Verify that 0 0
f (x, y) dy dx = 1 .
179
The joint probability density function fXY (x, y) .
180
Markov’s inequality.
For a continuous nonnegative random variable X , and c > 0 ,
we have
E[X]
P (X ≥ c) ≤ .
c
PROOF :
Z ∞ Z c Z ∞
E[X] = xf (x) dx = xf (x) dx + xf (x) dx
0 0 c
Z ∞
≥ xf (x) dx
c
Z ∞
≥ c f (x) dx ( Why ? )
c
= c P (X ≥ c) .
EXERCISE :
Show Markov’s inequality also holds for discrete random variables.
181
Markov’s inequality : For continuous nonnegative X , c > 0 :
E[X]
P (X ≥ c) ≤ .
c
−x
EXAMPLE : For e for x > 0 ,
f (x) =
0 otherwise ,
we have
Z ∞
E[X] = x e−x dx = 1 ( already done ! )
0
E[X] 1
c = 10 : P (X ≥ 10) ≤ = = 0.1
10 10
182
QUESTION : Are these estimates ”sharp ” ?
Markov’s inequality gives
E[X] 1
c=1 : P (X ≥ 1) ≤ = = 1 (!)
1 1
E[X] 1
c = 10 : P (X ≥ 10) ≤ = = 0.1
10 10
The actual values are
Z ∞
P (X ≥ 1) = e−x dx = e−1 ∼
= 0.37
1
Z ∞
P (X ≥ 10) = e−x dx = e−10 ∼
= 0.000045
10
183
Chebyshev’s inequality: For (practically) any random variable X:
1
P( | X − µ | ≥ k σ ) ≤ 2
,
k
p
where µ = E[X] is the mean, σ = V ar(X) the standard deviation.
P ( | X −µ | ≥ kσ ) = P ( (X −µ)2 ≥ k2 σ 2 ) = P ( Y ≥ k2 σ 2 )
E[ Y ] V ar(X) σ2 1
≤ = = 2 2 = . QED !
k2 σ2 k2 σ2 k σ k 2
184
EXAMPLE : Suppose the value of the Canadian dollar in terms of
the US dollar over a certain period is a random variable X with
What can be said of the probability that the Canadian dollar is valued
between $0.88US and $1.08US ,
that is,
between µ − 2σ and µ + 2σ ?
185
EXERCISE :
The score of students taking an examination is a random variable
with mean µ = 65 and standard deviation σ = 5 .
186
SPECIAL CONTINUOUS RANDOM VARIABLES
F(x1)
F(x2)
x x
a x1 x2 b a x1 x2 b
187
EXERCISE :
has mean
a+b
µ = ,
2
188
A joint uniform random variable :
1 (x − a)(y − c)
f (x, y) = , F (x, y) = ,
(b − a)(d − c) (b − a)(d − c)
0.9
1.5 0.8
0.7
1.0 0.6
f 0.5
0.5
F 0.4
0.3
0.2
0.1 0.1
0.2 0.1
0.2
0.3 0.3
0.4
y 0.4 0.5 0.3
0.2
0.1
0.1 0.2
0.3 0.4 0.7
0.6
0.5 x
0.5
0.6
0.7 0.5
0.4
x y 0.6 0.7 0.8 0.9
0.9
0.8
0.6
0.8 0.7
0.9 0.8
0.9
189
EXERCISE :
• What is P (X < 0) ?
• What is f ( x | y = 1 ) ?
190
The Exponential Random Variable
−λx
λe , x>0 1 − e−λx , x > 0
f (x) = , F (x) =
0, x≤0 0, x≤0
with
R∞ −λx 1
E[X] = µ = 0
x λe dx = λ
( Check ! ) ,
2
R∞ 2
E[X ] = 0
x2 λe−λx dx = λ2
( Check ! ) ,
1
V ar(X) = E[X 2 ] − µ2 = λ2
,
p 1
σ(X) = V ar(X) = λ
.
191
2.0 1.0
0.8
1.5
0.6
F (x)
f (x)
1.0
0.4
0.5
0.2
0.0 0.0
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
x x
for λ = 0.25, 0.50, 0.75, 1.00 (blue), 1.25, 1.50, 1.75, 2.00 (red ).
192
PROPERTY : From
we have
P (X > x) = 1 − (1 − e−λx ) = e−λx .
193
EXAMPLE :
with
194
EXAMPLE : ( continued · · · ) F (t) = 1 − e−t .
P (Et+1 ) = 1 − F (t + 1) = e−(t+1) .
which is independent of t !
195
The Standard Normal Random Variable
Since
Z ∞
E[X 2 ] = x2 f (x) dx = 1 , ( more difficult · · · )
−∞
we have
196
1 − 12 x2
f (x) = √ e
2π
0.40
0.35
0.30
0.25
f (x)
0.20
0.15
0.10
0.05
0.00
−4 −3 −2 −1 0 1 2 3 4
x
The standard normal density function f (x) .
197
x
1
Z
− 12 x2
Φ(x) = F (x) = √ e dx
2π −∞
1.0
0.9
0.8
0.7
0.6
F (x)
0.5
0.4
0.3
0.2
0.1
0.0
−4 −3 −2 −1 0 1 2 3 4
x
The standard normal distribution function F (x)
( often denoted by Φ(x) ) .
198
The Standard Normal Distribution Φ(z)
z Φ(z) z Φ(z)
0.0 .5000 -1.2 .1151
-0.1 .4602 -1.4 .0808
-0.2 .4207 -1.6 .0548
-0.3 .3821 -1.8 .0359
-0.4 .3446 -2.0 .0228
-0.5 .3085 -2.2 .0139
-0.6 .2743 -2.4 .0082
-0.7 .2420 -2.6 .0047
-0.8 .2119 -2.8 .0026
-0.9 .1841 -3.0 .0013
-1.0 .1587 -3.2 .0007
199
EXERCISE :
• P ( X ≤ −0.5 )
• P ( X ≤ 0.5 )
• P ( | X | ≥ 0.5 )
• P ( | X | ≤ 0.5 )
• P( − 1 ≤ X ≤ 1 )
• P ( − 1 ≤ X ≤ 0.5 )
200
The General Normal Random Variable
E[X] = µ ( Why ? )
201
The standard normal (black) and the normal density functions
with µ = −1, σ = 0.5 (red ) and µ = 1.5, σ = 2.5 (blue).
202
To compute the mean of the general normal density function
1 − 21 (x−µ)2 /σ 2
f (x) = √ e
2π σ
consider
Z ∞
E[X − µ] = (x − µ) f (x) dx
−∞
∞
1
Z
− 12 (x−µ)2 /σ 2
= √ (x − µ) e dx
2π σ −∞
−σ 2 − 12 (x−µ)2 /σ 2
∞
= √ e = 0.
2π σ −∞
E[X] = µ .
203
NOTE : If X is general normal we have the very useful formula :
X −µ
P( ≤ c ) = Φ(c) ,
σ
i.e., we can use the Table of the standard normal distribution !
204
EXERCISE : Suppose X is normally distributed with
• P ( X ≤ −0.5 )
• P ( X ≥ 0.5 )
• P ( | X − µ | ≥ 0.5 )
• P ( | X − µ | ≤ 0.5 )
205
The Chi-Square Random Variable
Suppose X1 , X2 , · · · , Xn ,
are independent standard normal random variables.
NOTE :
2
The in χ2n is part of its name , while 2
in X12 , etc. is “power 2 ” !
206
0.5 1.0
0.4 0.8
0.3 0.6
F (x)
f (x)
0.2 0.4
0.1 0.2
0.0 0.0
0 2 4 6 8 10 0 2 4 6 8 10
x x
207
If n = 1 then
χ21 ≡ X12 , where X ≡ X1 is standard normal .
We can compute the moment generating function of χ21 :
Z ∞
tχ21 tX 2 1 tx2 − 12 x2
E[e ] = E[e ] = √ e e dx
2π −∞
∞
1
Z
− 12 x2 (1−2t)
= √ e dx
2π −∞
Let
1 1
1 − 2t = 2 , or equivalently , σ̂ ≡ √ .
σ̂ 1 − 2t
Then
∞
1 1
Z
tχ21 − 12 x2 /σ̂ 2
E[e ] = σ̂ · √ e dx = σ̂ = √ .
2π σ̂ −∞ 1 − 2t
(integral of a normal density function)
208
Thus we have found that :
tχ21 1
ψ(t) ≡ E[e ] = √ ,
1 − 2t
209
We found that
E[χ21 ] = 1 , V ar(χ21 ) = 2 .
and √
σ(χ2n ) = 2n .
210
0.16
0.14
0.12
0.10
f (x)
0.08
0.06
0.04
0.02
0.00
0 5 10 15 20 25
x
The Chi-Square density functions for n = 5, 6, · · · , 15 .
( For large n they look like normal density functions ! )
211
The χ2n - Table
n α = 0.975 α = 0.95 α = 0.05 α = 0.025
5 0.83 1.15 11.07 12.83
6 1.24 1.64 12.59 14.45
7 1.69 2.17 14.07 16.01
8 2.18 2.73 15.51 17.54
9 2.70 3.33 16.92 19.02
10 3.25 3.94 18.31 20.48
11 3.82 4.58 19.68 21.92
12 4.40 5.23 21.03 23.34
13 5.01 5.89 22.36 24.74
14 5.63 6.57 23.69 26.12
15 6.26 7.26 25.00 27.49