Lecture 3
Random Variables
Robin Sandquist
September 2026
Random Variables
Definition (Random variable)
A random variable is a function
that assigns a real number to each outcome in the sample space .
For every , the set
is an event to which a probability can be assigned.
Example (The sum of two die)
Let the sample space
A random variable on this sample space is
Discrete Random Variables
Definition (Discrete random variable)
A random variable is called discrete if it takes values in a finite or countably infinite set with probability one:
Definition (Probability mass function)
The probability mass function of a discrete random variable is
Note: for values outside the set of possible values of .
Example (Students arriving late)
Suppose that three students each have probability of arriving late, independently of one another. Let be the number of students who arrive late.
Then , and
Unequivocally,
the probability that at least two students arrive late is
Theorem (Properties of the probability mass function)
Let be a discrete random variable. Then:
-
For every ,
-
The probabilities sum to one:
-
For with ,
If is integer-valued and are integers, this becomes
-
For every ,
-
For every ,
Proof of property 3 .
Suppose that are integers. We can write
The events are pairwise disjoint. By additivity of probability,
Cumulative Distribution Functions
Definition (Cumulative distribution function)
For any random variable , the cumulative distribution function is defined by
This definition applies to both discrete and continuous random variables.
The function determines the probability distribution of .
Theorem (Properties of the cumulative distribution function)
Let be the cumulative distribution function of a random variable . Then is non-decreasing and right continuous. That is,
and
-
-
-
For ,
-
For every ,
-
For every ,
where denotes the left limit of at .
Continuous Random Variables
Example (Waiting for a bus)
Suppose that a bus arrives exactly every ten minutes and that a passenger arrives at a unifor random time between two buses.
Let be the passengers waiting time measured in minutes. Then is uniformly distributed on , with density
For example,
Definition (Probability density function)
A random variable is called absolutely continuous if there exists a non-negative measurable function
such that, for every ,
The function is called a probability density function of .
In these notes, ``continuous random variable’’ refers to a random variable with such a density.
Remark (The probability of a single value)
If has a density, then for every fixed ,
Consequently, including or excluding the endpoints of an interval does not change its probability.
This does not apply to a constant random variable: if with probability one, then
Theorem (Properties of a probability density)
If is a probability density function, then
and
the total probability is
The relationship between the PDF and CDF
If has density , then
It follows that
Expected Values
Definition (Expected value)
Let be a discrete random variable with probability mass function . Its expected value is
provided that
If has density , its expected value is
provided that
The expected value is an average of the possible values of .
Remark
The expected value dont have to be the most likely outcome, and it doesn’t need to be a value that can take.
For example, a random variable taking the values and , each with probability , has
even though never equals .
Variance and Standard Deviation
Theorem (Expected value of a function of a random variable)
Let be a random variable and let be a function such that
Then:
-
If is discrete with probability mass function ,
-
If has density ,
Definition (Variance)
The variance of , denoted by or , is
Variance measures the spread of a random variable around its expected value. A small variance means that the deviation from the mean is close to it.
Definition (Standard deviation)
The standard deviation of is
The variance and standard deviation are often denoted by
Note that the standard deviation has the same units as .
For a discrete random variable,
For a continous variable with density ,
Theorem (Computational formula for variance)
If , then
Proof.
Let . Expanding the square and using linearity of expectation, we obtain