05 Continuous Distr Answers Hidden Lecture
05 Continuous Distr Answers Hidden Lecture
Continuous RV are just like discrete RV, except that every sum becomes
an integral.
Continuous RV are just like discrete RV, except that every sum becomes
an integral.
Examples:
X : price of a stock
X : time that a machine works before breakdown
X : error in an experimental measurement
x
a b
x
a b
Z b b
Integral = area under a curve = g(x)dx = G(x) = G(b) − G(a)
x=a a
where G(x) is the antiderivative for g(x).
x
a b
Z b b
Integral = area under a curve = g(x)dx = G(x) = G(b) − G(a)
x=a a
where G(x) is the antiderivative for g(x).
Some examples:
Z b b
x3 b 3 − a3
Z
x 2 dx = = a dx = ax + C
a 3 a 3
1
Z Z
dx = ln|x| + C ex dx = ex + C
x
Real values are defined with infinite precision, thus the probability that a
RV takes on a specific value is not meaningful when the RV is continuous.
0 ≤ P[a ≤ X ≤ b] ≤ 1
Z ∞
P [ −∞ < X < ∞ ] = 1 = f (x)dx
−∞
0 ≤ P[a ≤ X ≤ b] ≤ 1
Z ∞
P [ −∞ < X < ∞ ] = 1 = f (x)dx
−∞
p(x) f (x)
P [ X = x ] = p(x)
b
X Z b
P[a ≤ X ≤ b] = p(x) P[a ≤ X ≤ b] = f (x)dx
x=a x=a
Example
Let X be a continuous RV with PDF:
(
1
x if 0 ≤ x ≤ 2
f (x) = 2
0 otherwise
What is P [ X ≥ 1 ]?
Answer
Computing probability example
Example
Let X be a continuous RV with PDF:
(
1
x if 0 ≤ x ≤ 2
f (x) = 2
0 otherwise
What is P [ X ≥ 1 ]?
Answer
f (x)
1.0
0.5
x
0 1.0 2.0
f (x) f (x)
x x
a a
|{z}
ϵ
f (x) f (x)
x x
a a
|{z}
ϵ
Z a+ ϵ2
h ϵ ϵi
P a− ≤X ≤a+ = f (x)dx ≈ width × height = ϵf (a)
2 2 a− ϵ2
f (x) f (x)
x x
a a
|{z}
ϵ
Z a+ ϵ2
h ϵ ϵi
P a− ≤X ≤a+ = f (x)dx ≈ width × height = ϵf (a)
2 2 a− ϵ2
f (x) f (x)
x x
a a
|{z}
ϵ
Z a+ ϵ2
h ϵ ϵi
P a− ≤X ≤a+ = f (x)dx ≈ width × height = ϵf (a)
2 2 a− ϵ2
x
0 1 2
x
0 1 2
Z ∞ Z 2 Z ∞
P[X > 1] = f (x)dx = f (x)dx + 0dx
1 1 2
x
0 1 2
Z ∞ Z 2 Z ∞
P[X > 1] = f (x)dx = f (x)dx + 0dx
1 1 2
!
2 2
3 3 2x 3
Z
= (4x − 2x 2 )dx = 2x − 2
=
1 8 8 3 1
x
0 1 2
Z ∞ Z 2 Z ∞
P[X > 1] = f (x)dx = f (x)dx + 0dx
1 1 2
!
2 2
3 3 2x 3
Z
= (4x − 2x 2 )dx = 2x 2 − =
1 8 8 3 1
3 16 2 1
= 8− − 2− =
8 3 3 2
x
a
Cumulative distribution function
Since PDF is not a probability, we need to solve an integral every single
time we want to calculate a probability.
F (a)
x
a
Cumulative distribution function
Since PDF is not a probability, we need to solve an integral every single
time we want to calculate a probability.
F (a)
−∞
x
a
If you learn to use CDFs, you can avoid integrating the PDF.
F (a)
x
a b
P[a ≤ X ≤ b]
F (b)
F (a)
– =
b a a b
F (a)
x
a b
P[a ≤ X ≤ b]
F (b)
F (a)
– =
b a a b
Z b Z a
F (b) − F (a) = f (x)dx − f (x)dx
−∞ −∞
Z a Z b Z a
= f (x)dx + f (x)dx − f (x)dx
−∞ a −∞
Z b
= f (x)dx = P [ a < X < b ] = P [ a ≤ X ≤ b ]
a
Discrete RV X Continuous RV X
X Z ∞
E[X ] = xp(x) E[X ] = xf (x)dx
x −∞
X Z ∞
E [ g(X ) ] = g(x)p(x) E [ g(X ) ] = g(x)f (x)dx
x −∞
E [ aX + b ] = aE [ X ] + b Linearity of expectation
h i h i
V [ X ] = E (X − E [ X ])2 = E X 2 − (E [ X ]2 ) Properties of
2
V [ aX + b ] = a V [ X ] variance
X∼Uni(α, β)
X∼Uni(α, β)
1
Notice that the density β−α is exactly the
f (x)
area= 1 same regardless of the value of x. This
makes it uniform.
1
β−α 1
The PDF is β−α since it is a constant such
x that the integral over all possible inputs
α β evaluates to 1.
Intro to Probability Uniform random variable 18
Public transport example
Example
The University bus arrives at the Computer Lab bus stop at 7:00, 7:15
and so on at 15 minute intervals. You arrive at the bus stop a time
uniformly distributed in the interval between 1pm and 1:30pm. What is
the probability that you wait less than 5 minutes for the bus?
Answer
Public transport example
Example
The University bus arrives at the Computer Lab bus stop at 7:00, 7:15
and so on at 15 minute intervals. You arrive at the bus stop a time
uniformly distributed in the interval between 1pm and 1:30pm. What is
the probability that you wait less than 5 minutes for the bus?
Answer
Let X be a RV for the time you arrive after 1pm to the bus stop.
Define RVs: X ∼ Uni(0, 30)
Solve:
f (x)
1
β−α
x
α β
Z ∞ Z β
1
E[X ] = x · f (x) dx = x· dx
−∞ α β−α
β
1 1 2 1 1 2
= x = (β − α2 )
β−α2 α β−α2
1 (β + α)(β − α) α+β
= =
2 β−α 2
Range: [0, ∞)
(
λe−λx when x ≥ 0
PDF: f (x) =
0 otherwise
1
Expectation: E [ X ] = (time)
λ
1
Variance: V [ X ] = 2
λ
Range: [0, ∞)
(
λe−λx when x ≥ 0
PDF: f (x) =
0 otherwise
1
Expectation: E [ X ] = (time)
λ
1
Variance: V [ X ] = 2
λ
F (x) = 1 − e−λx
Proof:
Z x
F (x) = P [ X ≤ x ] = λe−λx dx
0
x
1 −λx
=λ e
−λ 0
= −1(e−λx − e−λ0 )
= 1 − e−λx
Range: (−∞, ∞)
1 2 2
PDF: f (x) = √ e−(x−µ) /2σ
σ 2π
Expectation: E [ X ] = µ
Variance: V [ X ] = σ 2
Range: (−∞, ∞)
1 2 2
PDF: f (x) =√ e−(x−µ) /2σ
σ 2π
Expectation: E [ X ] = µ
Variance: V [ X ] = σ 2
1 (x−µ)2
−
f (x) = √ e 2σ2
σ 2π
1 (x−µ)2
−
f (x) = √ e 2σ2
σ 2π
normalising constant
1 (x−µ)2
−
f (x) = √ e 2σ2
σ 2π
normalising constant variance σ 2 manages spread
1 (x−µ)2
−
f (x) = √ e 2σ2
σ 2π
normalising constant variance σ 2 manages spread
1 (x−µ)2
−
f (x) = √ e 2σ2
σ 2π
normalising constant variance σ 2 manages spread
1 (x−µ)2
− 1.5
N (0, 1)
f (x) = √ e 2σ 2 1
N (0, 2)
N (−2, 0.5)
σ 2π 0.5 N (0, 0.2)
Example
You spent X minutes walking to the department every day. The average
time you spend is µ = 10 minutes. The variance from day to day of the
time spent to get to the department is σ 2 = 2 minutes2 . Suppose X is
normally distributed. What is the probability you spend ≥ 12 minutes
travelling to the department?
Answer
Walking example
Example
You spent X minutes walking to the department every day. The average
time you spend is µ = 10 minutes. The variance from day to day of the
time spent to get to the department is σ 2 = 2 minutes2 . Suppose X is
normally distributed. What is the probability you spend ≥ 12 minutes
travelling to the department?
Answer
2
X ∼ N (µ = 10, σ = 2)
Z ∞ Z ∞ (x−µ)2
1 −
P [ X ≥ 12 ] = f (x)dx = √ e 2σ2 dx
12 12 σ 2π
Example
You spent X minutes walking to the department every day. The average
time you spend is µ = 10 minutes. The variance from day to day of the
time spent to get to the department is σ 2 = 2 minutes2 . Suppose X is
normally distributed. What is the probability you spend ≥ 12 minutes
travelling to the department?
Answer
2
X ∼ N (µ = 10, σ = 2)
Z ∞ Z ∞ (x−µ)2
1 −
P [ X ≥ 12 ] = f (x)dx = √ e 2σ2 dx
12 12 σ 2π
f (x)
P[X ≤ µ − x ] 1 − P[X ≤ µ + x ]
x
µ−x µ µ+x
x −µ
F (x) = Φ
σ
x −µ
F (x) = Φ
σ
Z∼N (0, 1)
Not a new distribution: a special case of the Normal (N (µ, σ 2 ) = µ+σN (0, 1)).
CDF of Z defined as P [ Z ≤ z ] = Φ(z).
Z∼N (0, 1)
Not a new distribution: a special case of the Normal (N (µ, σ 2 ) = µ+σN (0, 1)).
CDF of Z defined as P [ Z ≤ z ] = Φ(z).
0.4
0.3 z = 0.83
0.2
Φ(z)
0.1
−3 −2 −1 0 1 2 3
P [ Z ≤ 0.83 ] = Φ(0.83) =
Z∼N (0, 1)
Not a new distribution: a special case of the Normal (N (µ, σ 2 ) = µ+σN (0, 1)).
CDF of Z defined as P [ Z ≤ z ] = Φ(z).
0.4
0.3 z = 0.83
0.2
Φ(z)
0.1
−3 −2 −1 0 1 2 3
2
X ∼ N (µ = 10, σ = 2)
R∞
(But P [ X ≥ 12 ] = 12 f (x)dx has no analytic solution.)
(x−µ)
1. Compute z = σ
: 2. Look up Φ(z) in table: