Skip to main content

Section 2.2 Continuous Random Variables

Subsection 2.2.1 Probability Density Functions

We have to think about probability differently for continuous random variables. If \(X\) is a continuous random variable taking values in an interval \([a, b]\text{,}\) it doesn’t quite make sense to ask, as we have for discrete random variables, to find the probabilities of each individual outcome.
When we roll a fair 6-sided die, there are 6 equally likely outcomes, so they each get assigned the probability \(1/6\text{.}\) If we try to select a random number in the interval \([0, 1]\) in a similarly "fair" way (i.e., with each outcome equally likely), then what probability \(\alpha\) should we assign to each outcome? If \(\alpha > 0\text{,}\) then we have a problem: if you add up the probabilities of all the (infinitely many) outcomes, you get an infinite total, whereas the total probability in any sample space should be 1. If \(\alpha = 0\text{,}\) then we also have a problem: if you add up the probabilities of all the outcomes, you get total of 0, whereas the total probability in any sample space should be 1.
We need a new way to model and calculate probabilities for continuous random variables.

Definition 2.2.1.

Let \(X\) be a continuous random variable taking values in the interval \([a, b]\text{.}\) The probability density function (or pdf) for \(X\) is a function \(f(x)\) defined on \([a, b]\) satisfying the properties:
  1. \(f(x) \geq 0\) for all \(x \in [a, b]\text{,}\) and
  2. \(\displaystyle{\int_a^b f(x)\ dx = 1}\text{.}\)
It’s important to keep in mind that the output values of a pdf \(f(x)\) are probability densities, not probabilities. You can (somewhat casually) think of the units of \(f(x)\) values as "probability per <units of the sample space>". You may not have discussed the units of the differential \(dx\) very much in your Calculus 1 course, but \(dx\) has the same units as \(x\) and is being multiplied by the integrand when you take an integral. So, although \(f(x)\) is not a probability, the result of computing \(\int_c^d f(x)\ dx\) is a probability.
A pdf’s purpose in life is to be integrated, which tells us probabilities for a continuous random variable:
\begin{gather*} \Pr(c \leq X \leq d) = \int_c^d f(x)\ dx. \end{gather*}

Definition 2.2.2.

Let \(X\) take values in the interval \([a, b]\text{.}\) We say that \(X\) has the uniform distribution if, for any subinterval \([c, d] \subset [a, b]\text{,}\) the probability that \(X\) lies within \([c, d]\) is equal to the proportion of the total sample space taken by \([c, d]\text{.}\) That is:
\begin{gather*} \Pr(c \leq X \leq d) = \frac{d - c}{b - a}. \end{gather*}
In this case, \(X\) has the pdf \(f(x) = \frac{1}{b - a}\text{.}\)
We’ll ignore for the moment how to find this pdf and instead we’ll quickly check that it behaves the way we want it to:
\begin{align*} \Pr(c \leq X \leq d) \amp = \int_c^d \frac{1}{b-a}\ dx \\ \amp = \frac{x}{b - a}\bigg|_c^d \\ \amp = \frac{d - c}{b - a}, \end{align*}
as we wanted.

Example 2.2.3.

Let \(X\) be a continuous random variable taking values in the interval \([0, 4]\) with pdf \(f(x) = k \sqrt{x}\) for some constant \(k\text{.}\) Because of the restriction that the total probability must be 1, we can determine the value of \(k\text{:}\)
\begin{align*} 1 = \Pr(0\leq X \leq 4) \amp = \int_0^4 k\sqrt{x}\ dx \\ \amp = \frac{kx^{3/2}}{3/2}\bigg|_0^4 \\ \amp = \frac{2kx^{3/2}}{3}\bigg|_0^4 \\ \amp = \left(\frac{2k(4^{3/2})}{3}\right) - 0 \\ \amp = \frac{16k}{3} \end{align*}
Therefore \(k = \frac{3}{16}\text{.}\) Now we can calculate probabilities, e.g.:
\begin{align*} \Pr(1 \leq X \leq 2) \amp = \int_1^2 \frac{3\sqrt{x}}{16}\ dx \\ \amp = \frac{3}{16}\left(\frac{2x^{3/2}}{3}\right)\bigg|_1^2 \\ \amp = \frac{1}{8}\left(x^{3/2}\right)\bigg|_1^2 \\ \amp = \frac{1}{8}\left( 2^{3/2} - 1 \right) \\ \amp \approx 0.23. \end{align*}

Subsection 2.2.2 Cumulative Distribution Functions

When a random variable takes values in an interval \([a, b]\text{,}\) it’s often useful to consider how much probability has been accumulated up to some specified value \(x \in [a, b]\text{.}\) For each value of \(x\text{,}\) we can calculate this accumulated probability. Since there’s an association between inputs (the \(x\) values) and output (the accumulated probability), we can naturally build a function.

Definition 2.2.4.

Let \(X\) be a continuous random variable taking values in an interval \([a, b]\text{.}\) The cumulative distribution function (or cdf) is the function \(F(x)\) defined on \([a, b]\) such that
\begin{gather*} F(x) = \Pr(a \leq X \leq x). \end{gather*}
How do we actually calculate these cumulative probabilities? Luckily, these are precisely the sort of probabilities we can use the pdf to find:
\begin{gather*} F(x) = \Pr(a \leq X \leq x) = \int_a^x f(t)\ dt. \end{gather*}
(Note that on the far left side of the equation, we used the letter \(x\) to refer to some point within \([a, b]\) up to which we’re trying to accumulate probability. So that value \(x\) must also appear at the top of the integral sign. We can’t then use the same letter for the integrand and differential inside the integral; we can’t use the same letter to refer to two different variables at the same time. So, we have changed the letter inside the integral to \(t\text{.}\))
This equation may look familiar from Calculus 1. If you review the First Fundamental Theorem of Calculus, you’ll see precisely the relationship between the cdf \(F(x)\) and the pdf \(f(x)\text{:}\)
\begin{gather*} F'(x) = f(x). \end{gather*}
Let’s see how we can put this relationship to use.

Example 2.2.5.

Suppose \(X\) is uniformly distributed in the interval \([a, b]\text{.}\) We previously said in DefinitionΒ 2.2.2 that, for any subinterval \([c, d] \subset [a, b]\text{,}\) we should have
\begin{gather*} \Pr(c\leq X \leq d) = \frac{d - c}{b - a}. \end{gather*}
In particular, for any \(x\in [a, b]\text{,}\) we would have:
\begin{gather*} F(x) = \Pr(a \leq X \leq x) = \frac{x - a}{b - a}. \end{gather*}
Therefore, taking the derivative:
\begin{gather*} f(x) = F'(x) = \frac{1}{b - a}. \end{gather*}
So, we can see that the idea we wanted to capture in probability led to a formula that gave accumulated probability, which then led to the pdf. Both the cdf and the pdf contain essentially all of the information we need to answer probability questions about \(X\text{.}\) However, keep in mind that these functions output different mathematical objects. \(F(x)\) outputs probabilities already; \(f(x)\) must be integrated over a subinterval to find probabilities.

Subsection 2.2.3 The Exponential Distribution

Definition 2.2.6.

Suppose we observe a Poisson process in which an event occurs with rate parameter \(\lambda\text{.}\) Let \(T\) be the time until the event is first observed. Then \(T\) has the exponential distribution with parameter \(\lambda\text{.}\) We’ll write \(T \sim \Exp(\lambda)\) to denote this.
The binomial, geometric, Poisson, and exponential distributions are conceptually grouped together. Consider the following two dichotomies:
  1. Is time being measured discretely or continuously?
  2. Does the random variable count occurrences of an event, or does it measure time until an event?
There are four combinations of answers to these two questions.
Binomial
"Time" is discrete; the random variables counts occurrences.
Geometric
"Time" is discrete; the random variable measures "time" until an event.
Poisson
Time is continuous; the random variable counts occurrences.
Exponential
Time is continuous; the random variable measures time until an event.
When we talk about discrete "time", we don’t always mean something measured in actual units of time. We might; for example, an experiment may involve a bacterial colony growing in a petri dish over time, but we only check in and measure something about the bacterial colony once each day. In this case, since our measurements of time must occur in whole numbers of days, time is being measured in a discrete way (that is, not involving an interval of real numbers).
Consider, instead, an experiment in which we flip a coin repeatedly until we first see heads appear. The number of flips doesn’t have units of time, but counting flips is analogous to measuring time until an event occurs. The flip count is a discrete stand-in for something analogous to time. We can consider this experiment to be a discrete analog of a Poisson process.
It’s also worth including a warning here about the Poisson distribution, specifically. The dichotomy mentioned above about whether time is being measured discretely or continuously is not the same as the consideration of whether the random variable itself is discrete or continuous. In a Poisson process, time is being measured continuously. But the Poisson random variable counts the number of occurrences of the event, and this number must be a whole number. So a Poisson random variable is a discrete random variable.

Subsection 2.2.4 Normal Distribution

Definition 2.2.8.

Consider the parametrized family of functions:
\begin{gather*} f(x; \mu, \sigma^2) = \frac{1}{\sqrt{2\pi \sigma^2}} e^{\frac{-(x-\mu)^2}{2\sigma^2}}. \end{gather*}
The function \(f(x; \mu, \sigma^2)\) is called a normal density function with parameters \(\mu\) and \(\sigma^2\text{.}\) A continuous random variable \(X\) with pdf \(f(x; \mu, \sigma^2)\) is said to have a normal distribution. We’ll write \(X \sim \Norm(\mu, \sigma^2)\text{.}\)
In the specific case that \(\mu = 0\) and \(\sigma^2 = 1\text{,}\) we call the resulting distribution the standard normal distribution. We’ll use the notation \(\phi(x)\) for the standard normal density function, and \(\Phi(x)\) for the standard normal cumulative distribution function.
It’s an unfortunate reality that the normal density functions can’t easily be integrated. (In fact, it is provably impossible to write nice formulas for their antiderivatives). So we won’t worry much about probability computations like \(\Pr(c \leq X \leq d)\) for normal distributions. The normal distributions will play a central role in later chapters (after which you can return here and appreciate this pun).

Exercises 2.2.5 Exercises

2.

A continuous random variable \(X\) taking values in \([1, 2]\) has p.d.f. \(\displaystyle{f(x) = \frac{1}{2}\left(\frac{1}{x^2} + x\right)}\text{.}\) Find the c.d.f. \(F(x)\text{.}\) Use your c.d.f. to find \(\Pr\left(1 \leq X \leq \frac{3}{2}\right)\text{.}\)
Answer.
\(\frac{1}{2}\left(\frac{x^2}{2} - \frac{1}{x}\right) + \frac{1}{4}\text{.}\) \(\Pr\left(1 \leq X \leq \frac{3}{2}\right) \approx 0.479.\)

3.

A continuous random variable \(X\) taking values in \([2, 3]\) has c.d.f. \(F(x) = \frac{x^3}{3} - x^2 + 4\text{.}\) Find the p.d.f. \(f(x)\text{.}\)
Answer.
\(f(x) = x^2 - 2x.\)

4.

Let \(T \sim \Exp(3)\text{.}\) Find \(\Pr(1 \leq T \leq 3)\) and \(\Pr(T \geq 0.5)\text{.}\)
Answer.
\(\Pr(1 \leq T \leq 3) \approx 0.050\text{.}\) \(\Pr(T \geq 0.5) \approx 0.223\text{.}\)