Week 6 Discussion Notes

Table of Contents

Continuous Random Variables

A continuous random variable XX is a random variable with a probability density function (pdf), that is, a non-negative function fXf_X such that

fX(x)dx=1andP(aXb)=abfX(x)dx.\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}.

We can include or exclude the endpoints and get the same number, since the integral of any function over a single point is 00. Compare with discrete random variables:

discretecontinuousdistributionP(X=x)=f(x) (pmf)P(aXb)=abf(x)dx (pdf)E[u(X)]xSXu(x)f(x)u(x)f(x)dx\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}

One thing that all random variables in common, though, is the definition of the cumulative density function (cdf):

F(x)=P(Xx)F\p{x} = \P\p{X \leq 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)=xf(x)dxandf(x)=F(x)F\p{x} = \int_{-\infty}^x f\p{x} \,\diff{x} \quad\text{and}\quad f\p{x} = F'\p{x}

and for a discrete random variable taking values in N\N,

F(x)=kSXkxf(x)andf(x)=F(x)F(x1).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}.

Examples

Example 1.
  1. Calculate
    n=2e(2n+1)t(2n+1)!.\sum_{n=2}^\infty \frac{e^{\p{2n+1}t}}{\p{2n+1}!}.
  2. Calculate
    1xexdx.\int_1^\infty xe^{-x} \,\diff{x}.
Solution.
  1. First, recall that

    ez=1+z1!+z22!+z33!+ez=1z1!+z22!z33!+\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}

    So if we subtract them (and divide by 22), we get just the odd terms:

    ezez2=z1!+z33!+=n=0z2n+1(2n+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}!}.

    To compute our sum, we need to plug in z=etz = e^t to get

    eeteet2=n=0(et)2n+1(2n+1)!=n=0e(2n+1)t(2n+1)!=et1!+e3t3!+n=2e(2n+1)t(2n+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}

    Rearranging,

    n=2e(2n+1)t(2n+1)!=eeteet2et1!e3t3!.\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!}}.
  2. Recall integration by parts:

    udv=uvvdu\int u \,\diff{v} = uv - \int v \,\diff{u}

    Pick the parts

    u=x,dv=exdx    du=dx,v=ex,u = x, \quad \diff{v} = e^{-x} \,\diff{x} \implies \diff{u} = \diff{x}, \quad v = -e^{-x},

    which gives

    xexdx=xex+exdx=xexex+C.\int xe^{-x} \,\diff{x} = -xe^{-x} + \int e^{-x} \,\diff{x} = -xe^{-x} - e^{-x} + C.

    Applying the bounds and using the fact that limxxex=0\lim_{x\to\infty} \frac{x}{e^x} = 0, we get

    1xexdx=0(e1e1)=2e.\int_1^\infty xe^{-x} \,\diff{x} = 0 - \p{-e^{-1} - e^{-1}} = \boxed{\frac{2}{e}}.
Example 2.
(3.1-20)

Let XX have pdf

f(x)={x,if 0x<1,cx3,if 1x<,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}
  1. Find cc so that ff is a pdf.
  2. Find the mean of XX (if it exists).
  3. Find the variance of XX (if it exists).
Solution.
  1. For ff to be a pdf, we need to make sure it integrates to 11:

    1=f(x)dx=01xdx+1cx3dx=12+12c.\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}

    Solving, we get

    c=1.\boxed{c = 1}.
  2. Like before, we need to split up the integral:

    E[X]=01x2dx+11x2dx=13+1=43.\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}
  3. To calculate VarX\Var{X}, we can just (try to) calculate EX2\E{X^2}:

    E[X2]=01x3dx+11xdx\E\br{X^2} = \int_0^1 x^3 \,\diff{x} + \int_1^\infty \frac{1}{x} \,\diff{x}

    But the second integral doesn't converge, so the variance doesn't exist.

Example 3.

Let XX be uniformly distributed on [0,2]\br{0, 2}. Find the pdf of Y=X2Y = X^2.

Solution.

The general strategy is as follows:

  1. Find the support of YY (i.e., the possible values of YY).
  2. Compute the cdf (not pdf) of YY, and then differentiate to get the pdf.

Since XX ranges over [0,2]\br{0, 2}, when we square XX, the possible values range over [0,4]\br{0, 4}. Now we look for the cdf:

FY(y)=P(Yy)=P(X2y)=P(Xy)(X0, so we can ignore negative values)=0y12dx=y2.\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}

Thus,

fY(y)=F(y)=14y,0y4.f_Y\p{y} = F'\p{y} = \boxed{\frac{1}{4\sqrt{y}},\quad 0 \leq y \leq 4}.
Example 4.
(3.4-11)

Assume XExp(λ)X \sim \operatorname{Exp}\p{\lambda} is such that E[X]=5\E\br{X} = 5. If Y=max{X,3}Y = \max\set{X, 3}, calculate E[Y]\E\br{Y}.

Solution.

First, we need to figure out λ\lambda. The mean of an exponential distribution is 1λ\frac{1}{\lambda}, so

1λ=E[X]=5    λ=15.\frac{1}{\lambda} = \E\br{X} = 5 \implies \lambda = \frac{1}{5}.

Next, to calculate the expectation, we can view Y=u(X)Y = u\p{X}, where u(x)=max{x,3}u\p{x} = \max\set{x, 3}. Thus,

E[Y]=E[u(X)]=u(x)f(x)dx=033f(x)dx+3xf(x)dx=0335ex5dx+3x5ex5dx=3+5e35.\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}
Example 5.
(3.4-21)

Assume XX has the pdf

f(x)=3x21203e(x120)3for 0<x<.f\p{x} = \frac{3x^2}{120^3} e^{-\p{\frac{x}{120}}^3} \quad\text{for } 0 < x < \infty.

Find E[X]\E\br{X}.

Solution.

Using the change of variables u=(x120)3u = \p{\frac{x}{120}}^3, we get

du=3x21203dxandx=120u13.\diff{u} = \frac{3x^2}{120^3} \,\diff{x} \quad\text{and}\quad x = 120u^{\frac{1}{3}}.

Plugging these into the integral for the expectation,

E[X]=xf(x)dx=0x3x21203e(x120)3dx=0120u13eudu=1200u431eudu=120Γ(43).\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}

Recall that the Gamma function is

Γ(z)=0xz1exdx.\Gamma\p{z} = \int_0^\infty x^{z-1} e^{-x} \,\diff{x}.