You are on page 1of 23

# Continuous Random Variables

## Aria Nosratinia Probability and Statistics 4-1

Continuous Random Variables
Consider a wheel with a pointer, we spin
the pointer so that the eventual position of
the pointer is equally likely anywhere on the
wheel.
What is the probability that the pointer will
be between 30 and 50 degrees?
What is the probability that the pointer will
be exactly at 35.23 degrees?
Aria Nosratinia Probability and Statistics 4-2
Another Example
A teacher plans to arrive on the hour to start his class, but due to
unavoidable variations he will be arriving, with uniform probability,
in a time interval [1, 1] minutes around the start of the class.
What is the probability that the teacher will arrive before the top
of the hour.
What is the probability that the teacher will arrive exactly 30.229
seconds late?
By specifying the probability of arrival at each instance in time,
can we distinguish this teacher from another one that arrives in an
interval of [5, 5] minutes? Why?
Aria Nosratinia Probability and Statistics 4-3
Cumulative Distribution Function
Recall
F
X
(x) = P(X x)
F
X
() = 0
F
X
() = 1
P(a < X b) = F
X
(b) F
X
(a)
The CDF of teacher arrival:
-1 1
x
F
1
Aria Nosratinia Probability and Statistics 4-4
Continuous Random Variables
A random variable is a continuous random variable if its CDF is
continuous.
x
F
x
F
X
(x)
1
0.8
0.4
0.3
x
F
Continuous
Discrete
Mixed
Aria Nosratinia Probability and Statistics 4-5
Probability Density Function (pdf)
We are interested to know, what values of X are more probable,
which ones are not?
x

P
1
P
2
Denition: probability density function
f
X
(x) =
d F
X
(x)
dx
Aria Nosratinia Probability and Statistics 4-6
Probability Density Function (pdf)
We are interested to know, what values of X are more probable,
which ones are not?
x
probability density
Denition: probability density function
f
X
(x) =
d F
X
(x)
dx
Aria Nosratinia Probability and Statistics 4-7
Properties of the PDF
f
X
(x) 0 x
F
X
(x) =
_
x

f
X
()d
_

f
X
()d = 1
Calculating probabilities using the pdf:
P(x
1
< X x
2
) =
_
x
2
x
1
f
X
()d
proof:
P(x
1
< X x
2
) = P(X x
2
) P(X x
1
) = F
X
(x
2
) F
X
(x
1
).
Aria Nosratinia Probability and Statistics 4-8
Exercise
Random Variable X has the following CDF:
F
X
(x) =
_

_
0 x < 0
(
x
4
)
2
0 x 4
1 x > 4
Draw this CDF. Find the pdf of X and draw it.
Find P(X > 2)
Find P(1 < X < 1).
Aria Nosratinia Probability and Statistics 4-9
Exercise
Random variable Z has the following PDF
f
Z
(z) =
_

_
z + 1 z [1, 0]
z + 1 z [0, 1]
0 otherwise
Draw this pdf. Find the CDF of Z, and draw it.
Find P(Z < 0.5) and P(0.25 < Z < 0.5).
Aria Nosratinia Probability and Statistics 4-10
Exercise
Random variable X has probability density function:
f
X
(x) =
_
_
_
c xe
2x
x 0
0 otherwise
Sketch the pdf. Find the constant c
Find the cdf of X, and sketch it.
Find P(2 X 2)
Aria Nosratinia Probability and Statistics 4-11
Expected Value
Recall: expected value (mean, average) for discrete variables
E[X] =

i
x
i
P
X
(x
i
)
IDEA: summation of each value its probability.
But in the continuous case, each value has probability zero!
We have to nd another way...
Aria Nosratinia Probability and Statistics 4-12
Expected Value
The interval [x, x + dx] has probability: F(x + dx) F(x).
By denition:
F(x + dx) F(x) F

(x) dx
= f
X
(x)dx
Multiply this probability by x, and add overall:
E[X] = lim
dx0

x (f
X
(x) dx)
E[X] =
_
x f
X
(x)dx
Aria Nosratinia Probability and Statistics 4-13
Example
A random variable has pdf
f
X
(x) =
_
_
_
2x 0 x 1
0 otherwise
Verify that this is a valid pdf. Then calculate E[X].
Aria Nosratinia Probability and Statistics 4-14
Expected Value and Variance
Theorem: The expected value of a function g(X) is
E[g(X)] =
_

g(x) f
X
(x) dx
Theorem: For any random variable X,
E[aX + b] = aE[X] + b
V ar(X) = E[X
2
] E[X]
2
V ar(aX + b) = a
2
V ar(X).
Aria Nosratinia Probability and Statistics 4-15
Example
Consider the pdf f
X
(x) = |x| for x [1, 1]
Draw the pdf
Calculate V ar(X).
Calculate E[e
|x|
].
Aria Nosratinia Probability and Statistics 4-16
The Uniform distribution
This is arguably the simplest continuous distribution.
a b
f
X
(x)
E[X] =
ba
2
V ar(X) =
(ba)
2
12
If a, b are integers, then X is a discrete uniform r.v.
Aria Nosratinia Probability and Statistics 4-17
The Exponential Distribution
f
X
(x) =
_
_
_
e
x
x 0
0 otherwise
f
X
(x)
NOTE: this can be shown with (e
x
) u(x) where u() is the unit
step function.
The CDF is: F
X
(x) =
_
_
_
(1 e
x
) x 0
0 else
E[X] = 1/
V ar(X) = 1/
2
If X is exponential, then X is a geometric r.v. with p = 1e

.
Aria Nosratinia Probability and Statistics 4-18
Example
Assume that the number of hours to nish the legal work on a case is
an exponential random variable with parameter = 0.2. We assume
the rm bills the time with innite precision.
Assuming the rm charges \$200 per hour, nd the mean and
variance of the cost.
Aria Nosratinia Probability and Statistics 4-19
Example 2
Now assume we have drawn a contract with this rm with
performance incentives, so that the billing is adjusted to 200 20x
dollars per hour. Calculate the mean and variance of the cost.
Aria Nosratinia Probability and Statistics 4-20
Example 3
Now assume the rm bills only whole hours, with each hour billed
as it starts, at a at rate of \$200 per hour. What is the mean and
variance of the cost?
Aria Nosratinia Probability and Statistics 4-21
The Erlang Distribution
f
X
(x) =
_
_
_

n
x
n1
e
x
(n1)!
x 0
0 otherwise
> 0 and n is integer
Erlang has heavier tail than exponential
f
X
(x)
E[X] =
n

V ar(X) =
n

2
Erlang vs. Poisson: If X is Erlang and Y
x
are Poisson with
parameter = x, then,
F
X
(x) = 1 F
Y
x
(n 1)
Aria Nosratinia Probability and Statistics 4-22
The Gaussian Distribution
f
X
(x) =
1

2
2
e
(x)
2
/2
2
f
X
(x)
E[X] = V ar(X) =
2
If X is Gaussian (, ) then aX + b is a Gaussian (a + b, a)
The Gaussian (0, 1) is known as the Normal distribution.
The Gaussian distribution is one of the most important in all of
engineering.
Aria Nosratinia Probability and Statistics 4-23
Gaussian CDF
The standard normal cdf is:
(z) =
1
2
_
z

e
u
2
/2
du
This is an important function and is widely tabulated.
The probability of any Gaussian interval is:
P{a < X b} =
_
b

_

_
a

_
Example: For a Gaussian with mean -3 and variance 4, nd the
probability X [2, 1] (Use tables of ).
Aria Nosratinia Probability and Statistics 4-24
Complementary CDF
The standard normal complementary CDF is:
Q(z) = P{Z > z} =
1

2
_

z
e
u
2
/2
du = 1 (z)
z
(z)
z
Q(z)
Example: Consider a Gaussian r.v. X with mean 1.3 and variance 9.
Calculate P[X < 10.7].
Aria Nosratinia Probability and Statistics 4-25
Some Other Distributions
f
X
(x) =
1
2
k/2
(k/2)
x
(k/2)1
e
x/2
x 0 Chi square distribution
f
X
(x) =
1

2
xe

x
2
2
2
x 0 Rayleigh distribution
f
X
(x) = x
k1
e
x/

k
(k)
x 0 Gamma distribution
f
X
(x) =
(
+1
2
)

(/2)
_
1 +
x
2

+1
2
x 0 Students T distribution
Gamma function:
(z) =
_

0
t
z1
e
t
dt
generalization of the factorial: (z + 1) = z(z)
Aria Nosratinia Probability and Statistics 4-26
Delta Functions (review)
Take:
d(x, ) =
_
_
_
1/ x [/2, /2]
0 otherwise
Then the unit impulse or Dirac delta function:
(x) = lim
0
d(x, )
The impulse is everywhere-zero, except at x = 0.
Aria Nosratinia Probability and Statistics 4-27
Properties of the Impulse
Theorem: The impulse integrates to one:
_

(x) dx = 1
(Because it is a limit of a series of functions, each of them having unit
integral).
Sifting Property: For any continuous g(x),
_

g(x) (x x
0
) dx = g(x
0
)
Aria Nosratinia Probability and Statistics 4-28
Unit Step Function
u(x) =
_
_
_
0 x < 0
1 x 0
u(x)
x
Theorem:
u(x) =
_
x

(z)dz
(x) =
d
dx
u(x)
Now that we can take the derivative of discontinuities, we can dene
the pdf of discrete random variables.
Aria Nosratinia Probability and Statistics 4-29
PDF of Discrete Random Variables
So far, we only had pmf; now we can dene their pdf.
Example:
x
F
X
(x)
1
1 -4 9 11
0.8
0.4
0.3
P
X
(x)
0.1
1
x
0.3
-4
0.4
9
0.2
11
x
We take the derivative of the CDF to get:
f
X
(x) = 0.3(x + 4) + 0.1(x 1) + 0.4(x 9) + 0.2(x 11)
NOTE: Each discontinuity in CDF gives rise to one impulse in PDF.
Aria Nosratinia Probability and Statistics 4-30
PDF of Discrete R.V.
Using insights from last example:
f
X
(x) =

i
P
X
(x
i
)(x x
i
)
Now we can use the formulas that require a pdf, for example:
E[X] =
_
xf
X
(x)dx =
_
x

i
P
X
(x
i
)(x x
i
) dx
Exercise: Show that this is equivalent to the summation formula for
expected value of d(x)discrete r.v.
Hint: exchange the order of sum and integral.
Aria Nosratinia Probability and Statistics 4-31
Mixed Random Variables
Denition: X is a mixed r.v. if f
X
(x) contains both impulses as well
as non-impulsive non-zero values.
x
F(x)
x
f(x)
Aria Nosratinia Probability and Statistics 4-32
Mixed R.V. Example
Assume that the number of months required by a team of engineers to
design an ASIC chip is exponentially distributed with parameter
= 0.25. At the 2-month mark, the market will be assessed and if
there is not enough demand, the development will be terminated. This
event has probability 10%.
Find and sketch the pdf of the time spent by the team.
Calculate the expected time spent by the team.
Aria Nosratinia Probability and Statistics 4-33
Solution
We start by noting that with probability 0.1 the project concludes at
exactly 2 months, and with the remaining probability (0.9) the project
duration is exponentially distributed.
f
X
(x) = 0.9
_
0.25 e
0.25x
u(x)
_
+0.1(x2)
f
X
(x)
x
E[X] =
_
x f
X
(x)dx
= 0.9
_

0
x0.25 e
0.25x
dx + 0.1
_
x(x 2) dx
= 0.9
1

+ 0.1 2
= 3.8
Aria Nosratinia Probability and Statistics 4-34
Derived Random Variables - Outline
Objective: We are given a random variable X with f
X
(x) and a
function Y = g(X). We wish to determine f
Y
(y).
Procedure:
1. Find the CDF of X, namely F
X
(x).
2. Calculate the CDF of Y , namely F
Y
(y).
3. Find the PDF of Y by taking the derivative f
Y
(y) =
d
dy
F
Y
.
NOTE: The second step can be tricky.
Aria Nosratinia Probability and Statistics 4-35
Case 1 - g() monotonically increasing
x
y
g(x)
F
Y
(y) = P{Y y} = P{X g
1
(y)}
= F
X
_
g
1
(y)
_
Aria Nosratinia Probability and Statistics 4-36
Case 2 - g() monotonically decreasing
x
y
g(x)
F
Y
(y) = P{Y y} = P{X g
1
(y)}
= 1 F
X
_
g
1
(y)
_
+ P
X
(g
1
(y))
Aria Nosratinia Probability and Statistics 4-37
Case 3 - g() non-monotonic
x
y
g(x)
F
Y
(y) = P{Y y} = P{X : g(X) y}
In this case, we must break into various intervals and calculate
accordingly.
Aria Nosratinia Probability and Statistics 4-38
Example 1
Let X have the following pdf:
f
X
(x) = 0.08x x [0, 5]
Find the pdf of Y = g(X) = 3X + 2
Aria Nosratinia Probability and Statistics 4-39
Example 2
Let X have the following pdf:
f
X
(x) = 0.08x x [0, 5]
Find the pdf of Z = h(X) = X
2
Aria Nosratinia Probability and Statistics 4-40
Example 3
Let X have the following pdf:
f
X
(x) = |x| x [1, 1]
Find the pdf of Y = g(X) where g() is the clipping function:
g(X) = u(X) 0.5
Aria Nosratinia Probability and Statistics 4-41
Example 4
Let X be uniformly distributed on [1, 3] and Y = X
2
. Calculate the
PDF of Y
Aria Nosratinia Probability and Statistics 4-42
Example 5
This example shows that a function can convert a continuous PDF to
a mixed PDF.
Consider random variable X uniformly distributed on [2, 2] and
Y = g(X). Find the PDF of Y .
x
y
g(x)
1 -1
1
Aria Nosratinia Probability and Statistics 4-43
Conditional Distribution
Denition: For r.v. X and event B with P(B) > 0,
f
X|B
(x) =
_
_
_
f
X
(x)
P(B)
x B
0 else
Example: A random variable X is exponential with = 2.
Furthermore, you gain the information that X < 3. What is the pdf?
f
X
(x) f
X|B
(x)
x<3
3
Aria Nosratinia Probability and Statistics 4-44
Conditional Mean and Variance

X|B
= E[X|B] =
_

x f
X|B
(x) dx
V ar(X|B) = E
_
(X
X|B
)
2

B
_
= E[X
2
| B] E[X|B]
2
Aria Nosratinia Probability and Statistics 4-45