Continuous Random Variables Explained
Continuous Random Variables Explained
Naveen Kumar
Assistant Professor
SVNIT, Surat
Problem
I choose a real number uniformly at random in the interval [a, b], and call
it X . By uniformly at random, we mean all intervals in [a, b] that have the
same length must have the same probability.
For continuous random variables, it does not matter if we use “<” or “≤”, since
Key Point:
The CDF of a continuous random variable is a continuous function
without jumps, as P(X = x) = 0 for all x.
Definition:
A random variable X with CDF FX (x) is continuous if FX (x) is a
continuous function for all x ∈ R.
For continuous random variables, the PMF does not apply because
P(X = x) = 0 for all x ∈ R.
Instead, we define the probability density function (PDF) as the
density of probability per unit length.
Definition of PDF:
P(x < X ≤ x + ∆)
fX (x) = lim+ .
∆→0 ∆
Alternatively, using the CDF:
dFX (x)
fX (x) = = FX′ (x) (if FX (x) is differentiable).
dx
The PDF gives the probability density at point x.
1 Find c
2 Find the CDF of X, FX (x)
3 Find P(1 < X < 3)
RX = {x | fX (x) > 0}
This is the set of real numbers x for which the PDF is greater than
zero.
Note: The set RX may not precisely capture all possible values of X ,
but the difference is practically insignificant.
For a continuous random variable, replace sum with integral and PMF
with PDF: Z ∞
E [X ] = xfX (x) dx
−∞
(
1
fX (x) = b−a , a<x <b
0, otherwise
Expected value E [X ]:
Z ∞ Z b
1 a+b
E [X ] = xfX (x) dx = x dx =
−∞ a b−a 2
Intuitive result: The mean is the midpoint of the interval [a, b].
Expected value E [X ]:
Z 1
2
E [X ] = x · 2x dx =
0 3
E [aX + b] = aE [X ] + b
Find E [X n ]
Using LOTUS:
Z 1
n n 1 3n + 4
E [X ] = x x+ dx =
0 2 2(n + 1)(n + 2)
Var(aX + b) = a2 Var(X )
To find E [X 2 ]:
Z ∞ Z ∞ ∞
E [X 2 ] = x 2 fX (x) dx = x 2 · 3x −4 dx = −3x −1 1 = 3
−∞ 1
The variance:
2
2 2 3 3
Var(X ) = E [X ] − (E [X ]) = 3 − =
2 4
FY (y ) = P(Y ≤ y ) = P(g (X ) ≤ y )
Known CDF of X :
0
for x < 0
FX (x) = x for 0 ≤ x ≤ 1
1 for x > 1
Using LOTUS:
Z 1 Z 1
X x
E [Y ] = E [e ] = e fX (x) dx = e x dx = e − 1.
0 0
1
Let Y = X. Find fY (y ).
where x1 = g −1 (y ) = y1 .
fX (x1 ) 4x13 4
fY (y ) = ′
= = 4x15 = 5 .
|g (x1 )| −1 y
x12
(
4
y5
, y ≥1
fY (y ) =
0, otherwise
Let Y = X 2 . Find fY (y ).
fX (x1 ) fX (x2 )
fY (y ) = +
|g ′ (x1 )| |g ′ (x2 )|
This gives: √ √
fX ( y ) fX (− y )
fY (y ) = √ + √
2 y | − 2 y|
Substituting the PDF:
1 y 1 y 1 y
fY (y ) = √ e− 2 + √ e− 2 = √ e− 2 , for y ∈ (0, ∞).
2 2πy 2 2πy 2πy
Problem 1:
Let X be a random variable with PDF given by
(
cx 2 |x| ≤ 1
fX (x) =
0 otherwise
Problem 2:
Let X be a continuous random variable with PDF given by
1
fX (x) = e −|x| , for all x ∈ R.
2
If Y = X 2 , find the CDF of Y .
Thus, ( √
1 − e− y y ≥0
FY (y ) =
0 otherwise
Problem 3:
Let X be a continuous random variable with PDF given by
(
4x 3 0 < x ≤ 1
fX (x) =
0 otherwise
Problem 4:
Let X be a continuous random variable with PDF given by
(
x 2 (2x + 3/2) 0 < x ≤ 1
fX (x) =
0 otherwise
2
If Y = X + 3, find Var(Y ).
Expected value
a+b
E [X ] = .
2
To find the variance, we can calculate E [X 2 ] using LOTUS:
Z ∞ Z b
1
a2 + ab + b 2
E [X 2 ] = x 2 fX (x) dx = x2 dx = .
−∞ a b−a 3
(b − a)2
Var(X ) = E [X 2 ] − (E [X ])2 = .
12
Calculation:
h ix
FX (x) = −e −λt
0
−λx
=1−e
Final CDF:
FX (x) = (1 − e −λx )u(x)
Finding Variance:
Var (X ) = E [X 2 ] − (E [X ])2
Finding E [X 2 ]: Z ∞
E [X 2 ] = x 2 λe −λx dx
0
Using Integration by Parts Again:
2
E [X 2 ] =
λ2
Variance Calculation:
2
2 2 2 1 1
Var (X ) = E [X ] − (E [X ]) = 2 − = 2.
λ λ λ
Memoryless Property:
The term √1 ensures that the area under the PDF is equal to 1.
2π
Let us find the mean and variance of the standard normal distribution.
First, we will use a useful fact:
u2
2k+1
g (u) = u exp − , k = 0, 1, 2, . . .
2
R∞
R ∞ < ∞. This is because
Then g (u) is an odd function. Also, 0 g (u)du
g (u) decays faster
R∞ than exp(−u), and since 0 exp(−u)du < ∞, we
conclude that 0 g (u)du < ∞.
E [Z ] = E [Z 3 ] = E [Z 5 ] = · · · = 0.
In particular, the standard normal distribution has zero mean. This is not
surprising since the PDF is symmetric around the origin. Therefore,
E [Z ] = 0.
E [Z 2 ] = 1.
Var(Z ) = 1.
E [Z ] = 0 and Var(Z ) = 1.
This integral does not have a closed-form solution. However, due to the
importance of the normal distribution, the values of FZ (z) have been
tabulated, and many calculators and software packages provide this
function.
The Φ(x) function is widely used in probability, as the CDF of any normal
random variable can be written in terms of it.
Figure 4.7: The Φ(x) function (CDF of the standard normal distribution).
Here are some properties of the Φ(x) function, which can be shown from
its definition:
limx→∞ Φ(x) = 1
limx→−∞ Φ(x) = 0
1
Φ(0) = 2
Φ(−x) = 1 − Φ(x), for all x ∈ R
Due to the importance of the normal distribution, the values of the Φ(x)
function have been tabulated, and many software packages provide this
function.
X = σZ + µ, where σ > 0.
Then:
E [X ] = σE [Z ] + µ = µ,
Var(X ) = σ 2 Var(Z ) = σ 2 .
We say that X is a normal random variable with mean µ and variance σ 2 ,
and we write X ∼ N(µ, σ 2 ).
X −µ
Z=
σ
is a standard normal random variable, i.e., Z ∼ N(0, 1).
FX (x) = P(X ≤ x)
d
fX (x) = FX (x)
dx
d x −µ
= Φ
dx σ
1 x −µ
= Φ′ (by the chain rule)
σ σ
1 x −µ
= fZ
σ σ
(x − µ)2
1
= √ exp − .
σ 2π 2σ 2
(x − µ)2
1
fX (x) = √ exp − ,
σ 2π 2σ 2
x −µ
FX (x) = P(X ≤ x) = Φ ,
σ
b−µ a−µ
P(a < X ≤ b) = Φ −Φ .
σ σ
Now, for Y = aX + b:
Y = aX + b = a(σX Z + µX ) + b
The gamma function Γ(x) is an extension of the factorial function for real
(and complex) numbers.
7
Find Γ 2 .
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 100 / 155
Example 1
Find Γ 72 .
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 101 / 155
Example 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 102 / 155
Example 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 103 / 155
Gamma Distribution PDF
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 104 / 155
Special Case: Exponential Distribution
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 105 / 155
Sum of Exponentials
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 106 / 155
Example 3
Using the properties of the gamma function, show that the gamma PDF
integrates to 1. That is, show that for α, λ > 0:
Z ∞ α α−1 −λx
λ x e
dx = 1.
0 Γ(α)
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 107 / 155
Example 3
Using the properties of the gamma function, show that the gamma PDF
integrates to 1. That is, show that for α, λ > 0:
Z ∞ α α−1 −λx
λ x e
dx = 1.
0 Γ(α)
Solution:
∞ ∞
λα x α−1 e −λx λα
Z Z
dx = x α−1 e −λx dx
0 Γ(α) Γ(α) 0
λα
= · Γ(α)/λα = 1.
Γ(α)
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 108 / 155
Mean and Variance of Gamma Distribution
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 109 / 155
Table of Contents
1 Introduction
2 Probability Density Function (PDF)
3 Expected Value and Variance
4 Variance
5 Functions of Continuous Random Variables
6 Solved Problems
7 Special Distribution
Uniform Distribution
Exponential Distribution
Normal (Gaussian Distribution)
Gamma Distribution
8 Practice Questions
9 Mixed Random Variable
Using the Delta Function
Problems on Mixed Random Variable
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 110 / 155
Practice Questions
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 111 / 155
Problem: Poisson Distribution Leading to Exponential
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 112 / 155
Problem-1
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 114 / 155
Problem-2 Solution
Problem: Let Y ∼ Geometric(p), where p = λ∆. Define X = Y ∆, where
λ, ∆ > 0. Prove that for any x ∈ (0, ∞), we have:
lim FX (x) = 1 − e −λx .
∆→0
Solution: If Y ∼ Geometric(p) and q = 1 − p, then:
n
X
P(Y ≤ n) = pq k−1 = 1 − (1 − p)n .
k=1
For any y ∈ (0, ∞), we can write:
P(Y ≤ y ) = 1 − (1 − p)⌊y ⌋ .
Since X = Y ∆, we have:
x x
FX (x) = P(X ≤ x) = P(Y ≤ ) = 1 − (1 − p)⌊ ∆ ⌋ .
∆
Taking the limit:
x
lim FX (x) = 1 − lim (1 − λ∆)⌊ ∆ ⌋ = 1 − e −λx .
∆→0 ∆→0
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 115 / 155
Problem 3
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 116 / 155
Problem 3 Solution
Thus, we get:
FX (x) = P(U ≤ 1 − e −x ) = 1 − e −x ,
which is the CDF of Exponential(1).
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 117 / 155
Problem 4
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 118 / 155
Solution Problem 4
Let X ∼ N(2, 4) and Y = 3 − 2X .
Find P(X > 1):
1−2
P(X > 1) = 1 − Φ = 1 − Φ(−0.5) = Φ(0.5) = 0.6915.
2
Find P(−2 < Y < 1): Since Y = 3 − 2X , we have Y ∼ N(−1, 16).
Therefore:
1 − (−1) −2 − (−1)
P(−2 < Y < 1) = Φ −Φ
4 4
= Φ(0.5) − Φ(−0.25) = 0.29.
Find P(X > 2|Y < 1):
P(X > 2)
P(X > 2|Y < 1) = P(X > 2|X > 1) =
P(X > 1)
1 − Φ(0)
= ≈ 0.72.
1 − Φ(−0.5)
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 119 / 155
Problem-5
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 120 / 155
Expected Value of |X | for X ∼ N(0, σ 2 )
We can write X = σZ , where Z ∼ N(0, 1). Thus,
E |X | = σE |Z |.
We have Z ∞
1 2 /2
E |Z | = √ |t|e −t dt
2π −∞
Z ∞
2 2 /2
=√ te −t dt (integral of an even function)
2π 0
2 ∞ −t 2 /2
r Z
= te dt
π 0
r h i∞ r 2
2 −t 2 /2
= −e = .
π 0 π
Thus, we conclude r
2
E |X | = σE |Z | = σ .
π
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 121 / 155
Table of Contents
1 Introduction
2 Probability Density Function (PDF)
3 Expected Value and Variance
4 Variance
5 Functions of Continuous Random Variables
6 Solved Problems
7 Special Distribution
Uniform Distribution
Exponential Distribution
Normal (Gaussian Distribution)
Gamma Distribution
8 Practice Questions
9 Mixed Random Variable
Using the Delta Function
Problems on Mixed Random Variable
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 122 / 155
Mixed Random Variables
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 123 / 155
Example 4.14
Define Y = g (X ) as: (
1
X 0≤X ≤ 2
Y = 1
2 X > 12
We aim to find the CDF of Y .
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 124 / 155
Solution
Ry
For 0 ≤ y < 21 , FY (y ) = P(Y ≤ y ) = 0 2x dx = y 2 .
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 125 / 155
CDF of Y
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 126 / 155
CDF of Y
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 127 / 155
CDF Components
FY (y ) = C (y ) + D(y )
Continuous part:
1
4
y ≥ 12
C (y ) = y 2 1
0≤y < 2
0 y <0
Discrete part: (
3 1
4 y≥ 2
D(y ) = 1
0 y< 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 128 / 155
Expected Value of Y
Then calculate E [Y ]:
Z 1/2
1 1 1 3 11
E [Y ] = y (2y ) dy + · P(Y = ) = + =
0 2 2 12 8 24
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 129 / 155
Find These
1 3
P 4 ≤Y ≤ 8
P(Y ≥ 14 )
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 130 / 155
1 3
Example 1: P 4 ≤Y ≤ 8
We can write:
1 3 3 1 1
P ≤Y ≤ = FY − FY +P Y =
4 8 8 4 4
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 131 / 155
Example 2: P(Y ≥ 14 )
We calculate:
2
1 1 1 1 15
P(Y ≥ ) = 1 − FY =1− =1− =
4 4 4 16 16
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 132 / 155
Using the Delta Function
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 133 / 155
Dirac Delta Function
Issue: The PDF cannot be defined for a discrete random variable since its CDF
has jumps. If we could differentiate the CDF at jump points, we would be able to
define the PDF for discrete random variables.
Solution: Introduce the Dirac delta function.
The unit step function u(x) is defined as:
(
1 x ≥0
u(x) =
0 otherwise
Consider the function uα (x) for α > 0:
1
x > α2
uα (x) = α1 (x + α2 ) − α2 ≤ x ≤ α
2
x < − α2
0
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 134 / 155
Dirac Delta Function
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 135 / 155
Dirac Delta Function (Cont.)
Properties of δ(x):
δ(x) = 0 for x ̸= 0.
R∞
−∞ δ(x) dx = 1.
Symbolically, we can write:
du(x)
δ(x) =
dx
where u(x) is the unit step function.
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 136 / 155
Lemma: Properties of the Dirac Delta Function
Proof:
R∞
Let I = limα→0 − x0 ) dx
−∞ g (x)δα (x
R x0 + α
By the Mean Value Theorem, x0 − α2 g (x) α1 dx = g (xα ) for some
2
xα ∈ (x0 − α2 , x0 + α2 )
Thus, I = limα→0 g (xα ) = g (x0 )
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 137 / 155
Delta Function in PDFs of Discrete and Mixed Random
Variables
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 138 / 155
Applications of Generalized PDF
The generalized PDF unifies the theory for all types of random
variables (discrete, continuous, and mixed).
If the PDF is a sum of delta functions, X is a discrete random
variable.
If the PDF has no delta functions, X is continuous.
If the PDF contains both, X is a mixed random variable.
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 139 / 155
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 140 / 155
Example: CDF and PDF of a Mixed Random Variable
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 141 / 155
Solution: Identifying the Random Variable Type
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 142 / 155
Finding the Generalized PDF
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 143 / 155
Calculating P(X > 0.5)
1 1 ∞ −x
Z
1 1
P(X > 0.5) = 0 + + e dx = + e −0.5 ≈ 0.5533.
4 2 0.5 4 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 144 / 155
Finding E [X ]
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 145 / 155
Finding Var(X )
First, calculate E [X 2 ]:
Z ∞ Z ∞
1 2 1 2 1 2 −x
E [X 2 ] = x 2 fX (x) dx = x δ(x) + x δ(x − 1) + x e u(x) d
−∞ −∞ 4 4 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 146 / 155
Generalized PDF of a Mixed Random Variable
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 147 / 155
Problem 2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 148 / 155
Solution: Part (a) - Identifying Random Variable Type
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 149 / 155
Solution: Part (b) - Finding the PDF
1 1
fX (x) = δ(x) + 1(0,1) (x) .
2 2
This confirms that X has a point mass at 0 and a continuous uniform part
on (0, 1).
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 150 / 155
Solution: Part (c) - Expected Value of e X
Using LOTUS:
Z ∞ Z Z 1
X x 1 x 1
E (e ) = e fX (x) dx = e δ(x)dx + e x dx.
−∞ 2 2 0
First integral: Z
1 1 1
e x δ(x)dx = e 0 = .
2 2 2
Second integral: Z 1
1 1
e x dx = (e − 1).
2 0 2
Total:
1 1 1
E (e X ) = + (e − 1) = e.
2 2 2
e
E (e X ) = .
2
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 151 / 155
Solution: Part (d) - Conditional Probability
We want
P(X = 0, X ≤ 0.5) P(X = 0)
P(X = 0 | X ≤ 0.5) = = .
P(X ≤ 0.5) P(X ≤ 0.5)
1
P(X = 0) = .
2
For the denominator:
Z 0.5 Z 0.5
1 1 1 1 3
P(X ≤ 0.5) = fX (x)dx = + 1 dx = + = .
−∞ 2 2 0 2 4 4
Therefore,
1
2 2
P(X = 0 | X ≤ 0.5) = 3
= .
4
3
2
P(X = 0 | X ≤ 0.5) = .
3
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 152 / 155
Thanks
Naveen Kumar (SVNIT, Surat) MFCS October 11, 2025 153 / 155