[go: up one dir, main page]

0% found this document useful (0 votes)
3 views11 pages

Continuous Random Variables - Part 1 - Student Version - 2025

Continuous random variables

Uploaded by

englishscottyy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

Continuous Random Variables - Part 1 - Student Version - 2025

Continuous random variables

Uploaded by

englishscottyy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter 7: Continuous Random variables

Introduction
Thus far we have dealt with the properties of discrete random variables. We now extend this to continuous
random variables (c.r.v). Variables that can be measured eg: height, weight, time taken, and distance travelled
are referred to as continuous random variables. These variables take on real number outcomes and their values
form an entire interval on a number line eg: weight =57.8kg

7.1 Probability density function

To understand what a probability density function is conceptually let us consider the discussion below adapted
from Devore and Berk (Chapter 4 - page 155). Suppose the variable 𝑋 of interest is the depth of a lake at a
randomly chosen point on the surface. Let 𝑀 = the maximum depth (in meters), so that any non-negative
number in the interval [0, 𝑀] is a possible value of 𝑋. 𝑋=Depth could be discretized by measuring it to the
nearest meter.

The discrete distribution of depth can be pictured using a probability histogram. In the histogram, if the area
of the rectangle above any possible integer 𝑘 is the proportion of the lake whose depth is (to the nearest
meter) 𝑘, then the total area of all rectangles is 1.

Measuring the depth in smaller intervals (to the nearest centimeter as opposed to a meter) but using the same
measurement axis as in Figure 4.1(a), gives us Figure 4(b) where each rectangle in the resulting probability
histogram is much narrower, although the total area of all rectangles is still 1. The histogram has a much
smoother appearance than the histogram in Figure 4.1(a). Continuing to measure depth more and more finely,
results in the histogram appearing tending to the smooth curve, as pictured in Figure 4.1(c). In the histograms
the total area of all rectangles equals 1, similarly, the total area under the smooth curve is also 1.
Figures extracted from Devore and Berk (page 156)

Definition 7.1.1: Probability density function


7.1
Let 𝑋 be a continuous random variable. A function 𝑓(𝑥) of a continuous random variable 𝑋 is called a
probability density function (or probability distribution) of 𝑋 such that for any two numbers 𝑎 and 𝑏 with
𝑎≤𝑏
𝒃
𝑷(𝒂 ≤ 𝑿 ≤ 𝒃) = ∫ 𝒇(𝒙) 𝒅𝒙
𝒂

The integral from 𝑥 = 𝑎 to 𝑥 = 𝑏 gives the probability that 𝑋 takes a value in the interval [𝑎, 𝑏]

In the context of the example from Devore and Berk, the probability that the depth at a randomly chosen
point is between 𝑎 and 𝑏 is described by the area under the smooth curve between 𝑎 and 𝑏 and is depicted
below:
Graphical depiction from Devore and Berk (page 156)

Properties of a pdf
A function 𝑓(𝑥) of a continuous random variable 𝑋 is called a probability density function (or probability
distribution) of 𝑋 if and only if (iff)

𝑖) 𝑓(𝑥) ≥ 0 −∞≤𝑥 ≤∞


𝑖𝑖) ∫−∞ 𝑓(𝑥) 𝑑𝑥 = 1

Recall: the properties of a probability mass function of a discrete random variable 𝑋 :


𝑖) 𝑝(𝑥) ≥ 0

𝑖𝑖) ∑ 𝑝(𝑥) = 1
∀𝑥

7.2
Example 7.1.1
Show that

1
𝑓(𝑥) = {60 0 ≤ 𝑥 ≤ 60
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
is a p.d.f.

We can visualise the function by plotting it using R


This is an example of a Uniform density (to be studied in greater detail later):
In R, all PDF’s have a “d” prefix for density, thus the R command is
dunif(x, min=0, max=1)

Here, the plot can be generated in R using the code


> dunif(x, min=0, max=60) # function is defined from x=0 to x=60

> curve(dunif(x,min = 0,max=60),-1,70,ylim=c(0,0.05),ylab="f(x)",main="Density f(x)=1/


60") #x axis ranges from -1 to 70 and y axis ranges from 0 to 0.05

7.3
Example 7.1.2
Show that
3 2
𝑓(𝑥) = {4 (2𝑥 − 𝑥 ) 0≤𝑥≤2
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
is a p.d.f.

To visualise 𝑓(𝑥), the plot can be generated in R using the code

> curve(0.75*(2*x-(x^2)),0,2) # functions exists from 0 to 2

In general, we can use the following code to plot the function in R:


curve(expression, xmin, xmax)
expression: an expression or function involving x
xmin: min value of x to plot
xmax max value of x to plot

7.4
Example 7.1.3:
Find the value of 𝑘 that makes 𝑓(𝑥) a p.d.f

−𝑘𝑥
𝑓(𝑥) = {𝑒 𝑘 > 0, 𝑥 > 0
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

Insert working here!

7.2 The Cumulative Distribution function and Percentiles of the Distribution

Definition 7.2.1: Cumulative distribution function


The cumulative distribution function 𝐹(𝑥) of a continuous random variable 𝑋 gives the 𝑃(𝑋 ≤ 𝑥). It is
found by integrating the probability density function 𝑓(𝑦) between the limits −∞ and 𝑥. The cumulative
distribution function 𝐹(𝑥) for a continuous r.v. 𝑋 is defined for every number 𝑥 by
𝑥
𝐹(𝑥) = 𝑃(𝑋 ≤ 𝑥) = ∫ 𝑓(𝑦) 𝑑𝑦
−∞

Thus, for each 𝑥 , 𝐹(𝑥) is the area under the density curve to the left of 𝑥.

We can obtain the CDF of the pdf given in Example 7.1.2

Insert working here !

The plot of the CDF is as below:


> CDF<-function(x)((0.75*(x^2)-(x^3)/4))*(0<=x & x<=2)
> plot(CDF,0,2)

𝑥
So if you had to plot this by hand you will plot each 𝑥 value against 𝐹(𝑥) = 𝑃(𝑋 ≤ 𝑥) = ∫−∞ 𝑓(𝑦) 𝑑𝑦
𝑥 𝐹(𝑥)
0 0
0.5 0.15625
1 0.5
1.5 0.84375
2 1

7.5
Using 𝑭(𝒙) to calculate probabilities
If 𝑋 is a continuous random variable with pdf 𝑓(𝑥) and cumulative distribution function 𝐹(𝑥) then:
i) for any numbers 𝑎 and 𝑏 with 𝑎 < 𝑏
𝑏
𝑃(𝑎 ≤ 𝑋 ≤ 𝑏) = ∫ 𝑓(𝑥) 𝑑𝑥 = 𝐹(𝑏) − 𝐹(𝑎)
𝑎

ii) for any number 𝑎,

𝑃(𝑋 > 𝑎) = 1 − 𝑃(𝑋 ≤ 𝑎) = 1 − 𝐹(𝑎)


and
𝑎
𝑃(𝑋 = 𝑎) = ∫ 𝑓(𝑥) 𝑑𝑥
𝑎

= 𝐹(𝑎) − 𝐹(𝑎)
=0

Using cumulative distribution function 𝑭(𝒙) to find the probability density function 𝒇(𝒙)

If 𝑋 is a continuous random variable with pdf 𝑓(𝑥) and cumulative distribution function 𝐹(𝑥), then at

every 𝑥 at which the derivative 𝐹′(𝑥) exists

𝐹 ′ (𝑥) = 𝑓(𝑥)

Definition 7.2.2: Percentiles


The (100p)th percentile of the distribution of a continuous random variable 𝑋 , denoted by 𝜂(𝑝)
is defined by
𝜂(𝑝)
𝑝 = 𝐹[𝜂(𝑝)] = ∫ 𝑓(𝑦) 𝑑𝑦
−∞

where p is a number between 0 and 1

7.6
Thus, the median or 50th percentile of a distribution of a continuous random variable 𝑋, denoted by 𝑀 is
𝑀
defined by 𝐹(𝑀) = ∫−∞ 𝑓(𝑦) 𝑑𝑦 = 0.5

When looking at your test scores, if we say that your score is at the 75th percentile of the population then we
are saying that 75% of all population scores are below your score and 25% of all scores were above your
score.

Example 7.2.1
Given
𝑘
𝑓(𝑥) = {𝑥 3 𝑥>1
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

i) Homework: Show that 𝑘 = 2 makes 𝑓(𝑥) a p.d.f.


ii) Calculate 𝑃(𝑋 ≥ 3)

Example 7.2.2 Homework:


Given
2
𝑓(𝑥) = {𝑘𝑥 (1 − 𝑥) 0 < 𝑥 < 1; 𝑘 > 0
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

i) Show that 𝑘 = 12 makes 𝑓(𝑥) a p.d.f,


1
ii) Find 𝑃 (𝑋 = 2) - Answer = 0

iii) Find 𝑃(0.1 ≤ 𝑋 ≤ 0.6) - Answer 0.4715

7.3 Expectation and Variance

We can find the first and second moments viz: the mean and variance to get an idea of the measure of
central tendency and spread for a distribution.

Definition 7.3.1: Expected value of random variable 𝑿


The expected value of a continuous random variable 𝑋 with p.d.f. 𝑓(𝑥) is given by

7.7

µ = 𝐸[𝑋] = ∫ 𝑥 𝑓(𝑥) 𝑑𝑥
−∞

Hence, the expected value of a continuous random variable can described as a continuous weighted average.
We can extend the above definition for the case when we may wish to calculate the expected value of some
function ℎ(𝑋) of the random variable X.

Definition 7.3.2: Expected value of some function 𝒉(𝑿) of the random variable X
If 𝑋 is a continuous random variable with p.d.f. 𝑓(𝑥) and ℎ(𝑋)is any function of 𝑋, then 𝐸[ℎ(𝑋)] is given
by

µℎ(𝑋) = 𝐸[ℎ(𝑋)] = ∫ ℎ(𝑥) 𝑓(𝑥) 𝑑𝑥
−∞

For example, when we have a linear function of 𝑋 eg: ℎ(𝑋) = 𝑎𝑋 + 𝑏 then the mean and variance can be
described as
𝐸[ℎ(𝑋)] = 𝐸[𝑎𝑋 + 𝑏] = 𝑎𝐸(𝑋) + 𝑏
and
𝑉𝑎𝑟[ℎ(𝑋)] = 𝑉𝑎𝑟[𝑎𝑋 + 𝑏] = 𝑎2 𝑉𝑎𝑟(𝑋) = 𝑎2 𝜎𝑋2

Definition 7.3.3: Variance


The variance of a continuous random variable 𝑋 with p.d.f. 𝑓(𝑥) is given by


𝜎 2 = 𝑉𝑎𝑟(𝑋) = ∫ (𝑥 − µ)2 𝑓(𝑥) 𝑑𝑥
−∞

Homework:
Show that

𝑉𝑎𝑟(𝑋) = 𝜎 2 = ∫−∞ 𝑥 2 𝑓(𝑥) 𝑑𝑥 − (𝐸[𝑋])2 = 𝐸[𝑋 2 ]−(𝐸[𝑋])2

Example 7.3.1
Going back to example 7.2.1, calculate the expected value of 𝑋

2
𝑓(𝑥) = {𝑥 3 𝑥>1
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

7.8
Example7.3.2
Let
1
0≤𝑥<2
8
𝑓(𝑥) = 𝑥
2≤𝑥<4
8
{0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

Find:
i) The cumulative distribution function (c.d.f) 𝐹(𝑥) of the probability distribution function (p.d.f.) 𝑓(𝑥)
ii) 𝑃(𝑋 ≤ 1.5)
iii) 𝑃(1 ≤ 𝑋 < 3),
iv) the median,
v) the mean and
vi) the variance

Insert working here!

7.4 Revision of Mathematical Concepts:


We will require many of the integration techniques you covered in Mathematics, eg, Integration by
substitution and Integration by parts. You are expected to revise these techniques on your own however,
we will do a few examples from integration by parts. You will also need to deal with indeterminate forms,
using L’Hospital’s Rule.

7.4.1 Integration by parts


Suppose 𝑢 and 𝑣 are both functions of x. Then from the product rule
7.9
[𝑢(𝑥) 𝑣(𝑥)]′ = 𝑢′ (𝑥) 𝑣(𝑥) + 𝑣 ′ (𝑥) 𝑢(𝑥)

Thus, taking the integral on both sides gives

𝑢(𝑥)𝑣(𝑥) = ∫ 𝑢′ (𝑥) 𝑣(𝑥) 𝑑𝑥 + ∫ 𝑣 ′ (𝑥) 𝑢(𝑥) 𝑑𝑥

Generally speaking:
𝑢𝑣 − ∫ 𝑣 𝑑𝑢 = ∫ 𝑢 𝑑𝑣

General guidelines:
𝑢 × 𝑑𝑣 must give the original integrand
• 𝑑𝑥 must be part of 𝑑𝑣
• For 𝑢 choose something that can be differentiated without getting messy
• For 𝑑𝑣 - generally pick the most complicated part of the integrand that will integrate into
something not too messy

Example 7.4.1.1

∫ 𝑥 𝑒 𝑥 𝑑𝑥

Insert working here!


Example 7.4.1.2 (homework)

Show that

2 1 𝑥2
∫ 𝑥 𝑒 𝑥 𝑑𝑥 = 𝑒 +𝐶
2

Example 7.4.1.3
2
Find ∫ 𝑥 𝑒 6x 𝑑𝑥 and evaluate ∫−1 𝑥 𝑒 6x 𝑑𝑥

Insert working here!

Example 7.4.1.4 (homework)


Show that the indefinite integral

2 3 4 5
∫ 𝑥 √(𝑥 + 1) 𝑑𝑥 = 𝑥(𝑥 + 1)2 − (𝑥 + 1)2 + 𝐶
3 15
7.10
Example 7.4.1.5

Evaluate ∫ 𝑥 5 √(𝑥 3 + 1) 𝑑𝑥

Insert working here!

Example 7.4.1.6
Find 𝐸[𝑋] for the following function
1 −𝑥
𝑓(𝑥) = {4 𝑥 𝑒 𝑥≥0
2

0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

Insert working here!

Recall L'Hopital's Rule:


If we have an indeterminate form 0/0 or ∞/∞ all we need to do is differentiate the numerator and
differentiate the denominator and then take the limit.

7.11

You might also like