Week 6 Discussion Notes
Table of Contents
Continuous Random Variables
A continuous random variable X X X is a random variable with a probability density function (pdf) , that is, a non-negative function f X f_X f X such that
∫ − ∞ ∞ f X ( x ) d x = 1 and P ( a ≤ X ≤ b ) = ∫ a b f X ( x ) d x . \int_{-\infty}^\infty f_X\p{x} \,\diff{x} = 1
\quad\text{and}\quad
\P\p{a \leq X \leq b} = \int_a^b f_X\p{x} \,\diff{x}. ∫ − ∞ ∞ f X ( x ) d x = 1 and P ( a ≤ X ≤ b ) = ∫ a b f X ( x ) d x .
We can include or exclude the endpoints and get the same number, since the integral of any function over a single point is 0 0 0 . Compare with discrete random variables:
discrete continuous distribution P ( X = x ) = f ( x ) (pmf) P ( a ≤ X ≤ b ) = ∫ a b f ( x ) d x (pdf) E [ u ( X ) ] ∑ x ∈ S X u ( x ) f ( x ) ∫ − ∞ ∞ u ( x ) f ( x ) d x \begin{array}{rll}
& \text{discrete} & \text{continuous} \\[1ex]\hline\\[-2ex]
\text{distribution} & \P\p{X = x} = f\p{x} \text{ (pmf)} & \P\p{a \leq X \leq b} = \int_a^b f\p{x} \,\diff{x} \text{ (pdf)} \\[1ex]
\E\br{u\p{X}} & \sum_{x \in S_X} u\p{x} f\p{x} & \int_{-\infty}^\infty u\p{x}f\p{x} \,\diff{x} \\[1ex]\hline
\end{array} distribution E [ u ( X ) ] discrete P ( X = x ) = f ( x ) (pmf) ∑ x ∈ S X u ( x ) f ( x ) continuous P ( a ≤ X ≤ b ) = ∫ a b f ( x ) d x (pdf) ∫ − ∞ ∞ u ( x ) f ( x ) d x
One thing that all random variables in common, though, is the definition of the cumulative density function (cdf) :
F ( x ) = P ( X ≤ x ) F\p{x} = \P\p{X \leq x} F ( x ) = P ( X ≤ x )
A cdf is essentially equivalent to a pdf. By this, I mean that if you know one, then you can calculate the other: for a continuous random variable,
F ( x ) = ∫ − ∞ x f ( x ) d x and f ( x ) = F ′ ( x ) F\p{x} = \int_{-\infty}^x f\p{x} \,\diff{x}
\quad\text{and}\quad f\p{x} = F'\p{x} F ( x ) = ∫ − ∞ x f ( x ) d x and f ( x ) = F ′ ( x )
and for a discrete random variable taking values in N \N N ,
F ( x ) = ∑ k ∈ S X k ≤ x f ( x ) and f ( x ) = F ( x ) − F ( x − 1 ) . F\p{x} = \sum_{\substack{k \in S_X \\ k \leq x}} f\p{x}
\quad\text{and}\quad f\p{x} = F\p{x} - F\p{x-1}. F ( x ) = k ∈ S X k ≤ x ∑ f ( x ) and f ( x ) = F ( x ) − F ( x − 1 ) .
Examples
Example 1.
Calculate
∑ n = 2 ∞ e ( 2 n + 1 ) t ( 2 n + 1 ) ! . \sum_{n=2}^\infty \frac{e^{\p{2n+1}t}}{\p{2n+1}!}. n = 2 ∑ ∞ ( 2 n + 1 ) ! e ( 2 n + 1 ) t .
Calculate
∫ 1 ∞ x e − x d x . \int_1^\infty xe^{-x} \,\diff{x}. ∫ 1 ∞ x e − x d x .
Solution.
First, recall that
e z = 1 + z 1 ! + z 2 2 ! + z 3 3 ! + ⋯ e − z = 1 − z 1 ! + z 2 2 ! − z 3 3 ! + ⋯ \begin{aligned}
e^z &= 1 + \frac{z}{1!} + \frac{z^2}{2!} + \frac{z^3}{3!} + \cdots \\
e^{-z} &= 1 - \frac{z}{1!} + \frac{z^2}{2!} - \frac{z^3}{3!} + \cdots
\end{aligned} e z e − z = 1 + 1 ! z + 2 ! z 2 + 3 ! z 3 + ⋯ = 1 − 1 ! z + 2 ! z 2 − 3 ! z 3 + ⋯
So if we subtract them (and divide by 2 2 2 ), we get just the odd terms:
e z − e − z 2 = z 1 ! + z 3 3 ! + ⋯ = ∑ n = 0 ∞ z 2 n + 1 ( 2 n + 1 ) ! . \frac{e^z - e^{-z}}{2}
= \frac{z}{1!} + \frac{z^3}{3!} + \cdots
= \sum_{n=0}^\infty \frac{z^{2n+1}}{\p{2n+1}!}. 2 e z − e − z = 1 ! z + 3 ! z 3 + ⋯ = n = 0 ∑ ∞ ( 2 n + 1 ) ! z 2 n + 1 .
To compute our sum, we need to plug in z = e t z = e^t z = e t to get
e e t − e − e t 2 = ∑ n = 0 ∞ ( e t ) 2 n + 1 ( 2 n + 1 ) ! = ∑ n = 0 ∞ e ( 2 n + 1 ) t ( 2 n + 1 ) ! = e t 1 ! + e 3 t 3 ! + ∑ n = 2 ∞ e ( 2 n + 1 ) t ( 2 n + 1 ) ! . \begin{aligned}
\frac{e^{e^t} - e^{-e^t}}{2}
&= \sum_{n=0}^\infty \frac{\p{e^t}^{2n+1}}{\p{2n+1}!} \\
&= \sum_{n=0}^\infty \frac{e^{\p{2n+1}t}}{\p{2n+1}!} \\
&= \frac{e^t}{1!} + \frac{e^{3t}}{3!} + \sum_{n=2}^\infty \frac{e^{\p{2n+1}t}}{\p{2n+1}!}.
\end{aligned} 2 e e t − e − e t = n = 0 ∑ ∞ ( 2 n + 1 ) ! ( e t ) 2 n + 1 = n = 0 ∑ ∞ ( 2 n + 1 ) ! e ( 2 n + 1 ) t = 1 ! e t + 3 ! e 3 t + n = 2 ∑ ∞ ( 2 n + 1 ) ! e ( 2 n + 1 ) t .
Rearranging,
∑ n = 2 ∞ e ( 2 n + 1 ) t ( 2 n + 1 ) ! = e e t − e − e t 2 − e t 1 ! − e 3 t 3 ! . \sum_{n=2}^\infty \frac{e^{\p{2n+1}t}}{\p{2n+1}!}
= \boxed{\frac{e^{e^t} - e^{-e^t}}{2} - \frac{e^t}{1!} - \frac{e^{3t}}{3!}}. n = 2 ∑ ∞ ( 2 n + 1 ) ! e ( 2 n + 1 ) t = 2 e e t − e − e t − 1 ! e t − 3 ! e 3 t .
Recall integration by parts:
∫ u d v = u v − ∫ v d u \int u \,\diff{v} = uv - \int v \,\diff{u} ∫ u d v = uv − ∫ v d u
Pick the parts
u = x , d v = e − x d x ⟹ d u = d x , v = − e − x , u = x,
\quad \diff{v} = e^{-x} \,\diff{x}
\implies \diff{u} = \diff{x}, \quad v = -e^{-x}, u = x , d v = e − x d x ⟹ d u = d x , v = − e − x ,
which gives
∫ x e − x d x = − x e − x + ∫ e − x d x = − x e − x − e − x + C . \int xe^{-x} \,\diff{x}
= -xe^{-x} + \int e^{-x} \,\diff{x}
= -xe^{-x} - e^{-x} + C. ∫ x e − x d x = − x e − x + ∫ e − x d x = − x e − x − e − x + C .
Applying the bounds and using the fact that lim x → ∞ x e x = 0 \lim_{x\to\infty} \frac{x}{e^x} = 0 lim x → ∞ e x x = 0 , we get
∫ 1 ∞ x e − x d x = 0 − ( − e − 1 − e − 1 ) = 2 e . \int_1^\infty xe^{-x} \,\diff{x}
= 0 - \p{-e^{-1} - e^{-1}}
= \boxed{\frac{2}{e}}. ∫ 1 ∞ x e − x d x = 0 − ( − e − 1 − e − 1 ) = e 2 .
Example 2.
(3.1-20)
Let X X X have pdf
f ( x ) = { x , if 0 ≤ x < 1 , c x 3 , if 1 ≤ x < ∞ , 0 , elsewhere . f\p{x} =
\begin{cases}
x, & \text{if } 0 \leq x < 1, \\
\frac{c}{x^3}, & \text{if } 1 \leq x < \infty, \\
0, & \text{elsewhere}.
\end{cases} f ( x ) = ⎩ ⎨ ⎧ x , x 3 c , 0 , if 0 ≤ x < 1 , if 1 ≤ x < ∞ , elsewhere .
Find c c c so that f f f is a pdf.
Find the mean of X X X (if it exists).
Find the variance of X X X (if it exists).
Solution.
For f f f to be a pdf, we need to make sure it integrates to 1 1 1 :
1 = ∫ − ∞ ∞ f ( x ) d x = ∫ 0 1 x d x + ∫ 1 ∞ c x 3 d x = 1 2 + 1 2 c . \begin{aligned}
1
&= \int_{-\infty}^\infty f\p{x} \,\diff{x} \\
&= \int_0^1 x \,\diff{x} + \int_1^\infty \frac{c}{x^3} \,\diff{x} \\
&= \frac{1}{2} + \frac{1}{2c}.
\end{aligned} 1 = ∫ − ∞ ∞ f ( x ) d x = ∫ 0 1 x d x + ∫ 1 ∞ x 3 c d x = 2 1 + 2 c 1 .
Solving, we get
Like before, we need to split up the integral:
E [ X ] = ∫ 0 1 x 2 d x + ∫ 1 ∞ 1 x 2 d x = 1 3 + 1 = 4 3 . \begin{aligned}
\E\br{X}
&= \int_0^1 x^2 \,\diff{x} + \int_1^\infty \frac{1}{x^2} \,\diff{x} \\
&= \frac{1}{3} + 1 \\
&= \frac{4}{3}.
\end{aligned} E [ X ] = ∫ 0 1 x 2 d x + ∫ 1 ∞ x 2 1 d x = 3 1 + 1 = 3 4 .
To calculate Var X \Var{X} Var X , we can just (try to) calculate E X 2 \E{X^2} E X 2 :
E [ X 2 ] = ∫ 0 1 x 3 d x + ∫ 1 ∞ 1 x d x \E\br{X^2} = \int_0^1 x^3 \,\diff{x} + \int_1^\infty \frac{1}{x} \,\diff{x} E [ X 2 ] = ∫ 0 1 x 3 d x + ∫ 1 ∞ x 1 d x
But the second integral doesn't converge, so the variance doesn't exist.
Example 3.
Let X X X be uniformly distributed on [ 0 , 2 ] \br{0, 2} [ 0 , 2 ] . Find the pdf of Y = X 2 Y = X^2 Y = X 2 .
Solution.
The general strategy is as follows:
Find the support of Y Y Y (i.e., the possible values of Y Y Y ).
Compute the cdf (not pdf) of Y Y Y , and then differentiate to get the pdf.
Since X X X ranges over [ 0 , 2 ] \br{0, 2} [ 0 , 2 ] , when we square X X X , the possible values range over [ 0 , 4 ] \br{0, 4} [ 0 , 4 ] . Now we look for the cdf:
F Y ( y ) = P ( Y ≤ y ) = P ( X 2 ≤ y ) = P ( X ≤ y ) ( X ≥ 0 , so we can ignore negative values ) = ∫ 0 y 1 2 d x = y 2 . \begin{aligned}
F_Y\p{y}
&= \P\p{Y \leq y} \\
&= \P\p{X^2 \leq y} \\
&= \P\p{X \leq \sqrt{y}}
&& \p{X \geq 0,\text{ so we can ignore negative values}} \\
&= \int_0^{\sqrt{y}} \frac{1}{2} \,\diff{x} \\
&= \frac{\sqrt{y}}{2}.
\end{aligned} F Y ( y ) = P ( Y ≤ y ) = P ( X 2 ≤ y ) = P ( X ≤ y ) = ∫ 0 y 2 1 d x = 2 y . ( X ≥ 0 , so we can ignore negative values )
Thus,
f Y ( y ) = F ′ ( y ) = 1 4 y , 0 ≤ y ≤ 4 . f_Y\p{y}
= F'\p{y}
= \boxed{\frac{1}{4\sqrt{y}},\quad 0 \leq y \leq 4}. f Y ( y ) = F ′ ( y ) = 4 y 1 , 0 ≤ y ≤ 4 .
Example 4.
(3.4-11)
Assume X ∼ Exp ( λ ) X \sim \operatorname{Exp}\p{\lambda} X ∼ Exp ( λ ) is such that E [ X ] = 5 \E\br{X} = 5 E [ X ] = 5 . If Y = max { X , 3 } Y = \max\set{X, 3} Y = max { X , 3 } , calculate E [ Y ] \E\br{Y} E [ Y ] .
Solution.
First, we need to figure out λ \lambda λ . The mean of an exponential distribution is 1 λ \frac{1}{\lambda} λ 1 , so
1 λ = E [ X ] = 5 ⟹ λ = 1 5 . \frac{1}{\lambda} = \E\br{X} = 5
\implies \lambda = \frac{1}{5}. λ 1 = E [ X ] = 5 ⟹ λ = 5 1 .
Next, to calculate the expectation, we can view Y = u ( X ) Y = u\p{X} Y = u ( X ) , where u ( x ) = max { x , 3 } u\p{x} = \max\set{x, 3} u ( x ) = max { x , 3 } . Thus,
E [ Y ] = E [ u ( X ) ] = ∫ − ∞ ∞ u ( x ) f ( x ) d x = ∫ 0 3 3 f ( x ) d x + ∫ 3 ∞ x f ( x ) d x = ∫ 0 3 3 5 e − x 5 d x + ∫ 3 ∞ x 5 e − x 5 d x = 3 + 5 e − 3 5 . \begin{aligned}
\E\br{Y}
&= \E\br{u\p{X}} \\
&= \int_{-\infty}^\infty u\p{x} f\p{x} \,\diff{x} \\
&= \int_0^3 3f\p{x} \,\diff{x} + \int_3^\infty xf\p{x} \,\diff{x} \\
&= \int_0^3 \frac{3}{5} e^{-\frac{x}{5}} \,\diff{x} + \int_3^\infty \frac{x}{5} e^{-\frac{x}{5}} \,\diff{x} \\
&= \boxed{3 + 5e^{-\frac{3}{5}}}.
\end{aligned} E [ Y ] = E [ u ( X ) ] = ∫ − ∞ ∞ u ( x ) f ( x ) d x = ∫ 0 3 3 f ( x ) d x + ∫ 3 ∞ x f ( x ) d x = ∫ 0 3 5 3 e − 5 x d x + ∫ 3 ∞ 5 x e − 5 x d x = 3 + 5 e − 5 3 .
Example 5.
(3.4-21)
Assume X X X has the pdf
f ( x ) = 3 x 2 12 0 3 e − ( x 120 ) 3 for 0 < x < ∞ . f\p{x} = \frac{3x^2}{120^3} e^{-\p{\frac{x}{120}}^3} \quad\text{for } 0 < x < \infty. f ( x ) = 12 0 3 3 x 2 e − ( 120 x ) 3 for 0 < x < ∞.
Find E [ X ] \E\br{X} E [ X ] .
Solution.
Using the change of variables u = ( x 120 ) 3 u = \p{\frac{x}{120}}^3 u = ( 120 x ) 3 , we get
d u = 3 x 2 12 0 3 d x and x = 120 u 1 3 . \diff{u} = \frac{3x^2}{120^3} \,\diff{x}
\quad\text{and}\quad x = 120u^{\frac{1}{3}}. d u = 12 0 3 3 x 2 d x and x = 120 u 3 1 .
Plugging these into the integral for the expectation,
E [ X ] = ∫ − ∞ ∞ x f ( x ) d x = ∫ 0 ∞ x ⋅ 3 x 2 12 0 3 e − ( x 120 ) 3 d x = ∫ 0 ∞ 120 u 1 3 e − u d u = 120 ∫ 0 ∞ u 4 3 − 1 e − u d u = 120 Γ ( 4 3 ) . \begin{aligned}
\E{\br{X}}
&= \int_{-\infty}^\infty xf\p{x} \,\diff{x} \\
&= \int_0^\infty x \cdot \frac{3x^2}{120^3} e^{-\p{\frac{x}{120}}^3} \,\diff{x} \\
&= \int_0^\infty 120u^{\frac{1}{3}} e^{-u} \,\diff{u} \\
&= 120 \int_0^\infty u^{\frac{4}{3}-1} e^{-u} \,\diff{u} \\
&= \boxed{120 \Gamma\p{\frac{4}{3}}}.
\end{aligned} E [ X ] = ∫ − ∞ ∞ x f ( x ) d x = ∫ 0 ∞ x ⋅ 12 0 3 3 x 2 e − ( 120 x ) 3 d x = ∫ 0 ∞ 120 u 3 1 e − u d u = 120 ∫ 0 ∞ u 3 4 − 1 e − u d u = 120Γ ( 3 4 ) .
Recall that the Gamma function is
Γ ( z ) = ∫ 0 ∞ x z − 1 e − x d x . \Gamma\p{z} = \int_0^\infty x^{z-1} e^{-x} \,\diff{x}. Γ ( z ) = ∫ 0 ∞ x z − 1 e − x d x .