Discrete Random Variables
Introduction to Discrete Random Variables
Let be a random variable.
If takes on a finite or countable number of values, we say is a discrete random variable.
Example: Discrete Random Variables
For example, suppose we have 100 red, 100 blue, and 100 white socks, and we choose 3 at once. Now suppose we define as the total number of red socks we can obtain, and note that can only be 0, 1, 2, or 3.
For a discrete random variable , the probability mass function / distribution function (pdf) of is a function such that is the probability that takes on a value . So, for any possible value of ,
It naturally follows from this that
In other words, the probabilities sum to 1.
Sometimes, resources will ask us to “verify” a function is a probability mass function. This simply means to check that all sum to 1.
Example: Probability Mass Function (1)
Say we toss a coin twice. Let be the number of tails we get. Then,
Note that by this definition, the pdf of lists the probability of ‘s outputs, not necessarily the elements in the sample space chooses from. See the below example.
Example: Probability Mass Function (2)
Let , and assume one value is chosen with an equal chance. Now let , where denotes some element from the sample space. Then, we find the following outputs:
Using these, we find as a function such that
Where all other .
A cummulative distribution function (cdf) of a random variable , denoted . In other words, the value of is the cumulative probability of all values such that .
Theorem: Cummulative Distribution Functions
A function is a cummulative distribution function if and only if
- for all that takes on.
- is non-decreasing
- is right-continuous for all . In other words,
For discrete random variables, cummulative distribution functions appear as progressively increasing step functions.
Example: Cummulative Distribution Functions
Take our probability mass function from the previous example. Given this pmf, we find that:
- For , .
- For ,
- For ,
- For ,
- For , .
While we typically create cdfs from pdfs, we can also derive pdfs from cdfs. This is given in the below theorem.
Theorem: Deriving PDFs from CDFs
If a discrete random variable takes on values such that
Then , and for .
Moreover,
Example: Deriving PDFs from CDFs
Let the cdf of a discrete random variable be given as
Given this cdf, determine what and are.
We find that
Additionally, we find that
Note that we have to re-add , as subtracting removes that from our interval. Additionally, note that , as this will get rid of everything right before .
Expectation and Variance
If is a discrete random variable with pmf , then the expected value of is given as
provided that the sum does NOT diverge.
Similarly, the expected value of a function is given as
provided does NOT diverge.
Note that when passing into a function, the output is not passed into .
If , then is the moment of .
Example: Expected Value
A coin is tossed until you see tails. If you end on toss , you win dollars. What are your expected winnings?
Let is a random variable denoting our possible winnings. Then, .
The probability we end on round is given as
Because we must only get heads before hitting a tail to end on round .
Then the expected value of is
This sum diverges, so we cannot possibly have an expected value. This makes sense, as we cannot possibly expect to get “0” money.
The variance of a random variable is given by
Furthermore, we have the following properties of expected value and variance.
Theorem: Properties of Expected Value and Variance
For random variable , we have
for
For , . This generalizes to as well.
Proofs
The proof for property (1) is given below.
The proof for property (2) is given below.
The proof for property (3) is given below.
Note that we can take out the because the expected value of is already a predetermined constant, so we can treat it as so.
The proof for property (4) is given below.
Example: Variance
Consider rolling a 4-sided die once, and let be the value the die takes on. Find .
We find the expected value of , as
Using this, we can calculate the variance
Note that if is large, then so is (by definition). We can intuitively think of this variance as telling us how “far” the values of are away from the “average” expected value .
Common Discrete Random Variables
In this section, we discuss some common discrete random variables.
Uniform Discrete Random Variable
The Discrete Uniform Distribution, is the random variable with uniform spacing elements, all with equal chance of occurring.
The pmf of the Uniform Distribution is given as follows:
The merely indicates that elements of the random variable must have uniform spacing from one another.
We find the expected value as
Expected Value Derivation: Uniform Distribution
We find the variance as
Variance Derivative: Uniform Distribution
Bernoulli Distribution
The Bernoulli Distribution, often denoted , tracks the probability of a success (given as 1), given probability of success .
The pmf of the Bernoulli Distribution is given as
We find the expected value as
We find the variance as
Geometric Distribution
The Geometric Distribution, often denoted , tracks the probability of the first success after trials, where is the probability of success for any trial.
The pmf of the Geometric Distribution is given as follows:
We can intuitively understand this as getting failures, then a single success.
We find the expected value as
Expected Value Derivation: Geometric Distribution
Let to obtain
Observe how . We can use this to solve our summation.
We find the variance as
Variance Derivation: Geometric Distribution
We need to find
Because we already know what is, we need to find . Let .
We use the same derivation idea as with the expected value derivation, but with a second derivative.
Binomial Distribution
The Binomial Distribution, denoted , tracks the probability of successes given trials, each with a probability of . Each trial is independent of one another, so the success/failure of one does not influence the success/failure of another.
The pmf of the Binomial Distribution is given as follows:
We can intuitively think of this as choosing positions out of trials for success, and leaving the rest as failures.
We find the expected value as
Expected Value Derivation: Binomial Distribution
Note that we make the summation start from to because the term evaluates to 0.
Let . Then, we see our summation becomes
Applying the binomial theorem, we find that
Thus, we find our expected value to be
We find the variance as
Variance Derivation: Binomial Distribution
To find , we need to find . We do that below.
Let . Then, we find
Notice that in this combination, the left term is equivalent to our expected value (for ), and the right term was found before in our expected value derivation.
We now use to find .
Hypergeometric Distribution
The Hypergeometric Distribution, denoted , tracks the probability of successes, given trials from total sample of elements with successes (no replacement).
Example: Hypergeometric Distribution
6 trucks of 100 are inspected. We know 4 of the 100 have issues. What is the probablility that 5 trucks pass?
Given this scenario, we have
Note that , because we want to know the number of trucks that pass, not fail.
The pmf of the Hypergeometric Distribution is given as follows:
We now find our expected value and variance. To aid us in this, we use the following lemma:
Lemma
We find our expected value as
Expected Value: Derivation
We find the variance as
The proof is ommitted due to how complex the calculation is.
Hypergeomtric Distribution and Binomial Distribution
Let be the proportions of the successes and failures, respectively. In other words,
Then, the pmf is
Note that as , (the population gets larger), we find
In other words, the binomial distribution! So, for large , even though we’re drawing without replacements, we’ll get about the same answer as if we treated everything as independent!
Negative Binomial
The Negative Binomial Distribution, denoted , tracks the probability of obtaining the success after trials, given that every trial has a probability of success .
Negative Binomial Distribution
If a person is exposed to a disease, 30% show symptoms, What is the probability that the person exposed is the person to show symptoms?
We have a negative binomial distribution with and . To find our probability, we check for .
To understand why we call this the Negative Binomial Distribution, let’s verify the pmf. Note that we can verify our pmf using the concept of “negative binomials”.
Negative Binomial: PMF Verification
Let be the number of failures. We find the probability of to be
We can expand the binomial coefficient as
Note: We can do negative binomial coefficients, in a similar way we do positive ones.
Let . Note that we can expand using the binomial theorem, to obtain the following:
Now, summing our pmf to verify it, we find
We find our expected value and variance as
If our pmf is instead expressed as the number of failures (as it sometimes is), we have
Poisson Distribution
The Poisson Distribution, denoted , tracks the probability of some event occurring times, over some period of time, where is the expected occurrence of the event over this time.
Thus, the Poisson distribution, denoted has a pmf given as
We don’t really apply this distribution too much, though for sufficiently large values its a good approximation of the binomial distribution.
PDF Derivation
Consider a fixed period of time, with occurrences of some event over that period of time. How can we find the probability of occurring times?
To do this, we can break the time interval up subintervals small enoguh such that for any subinterval, occurs at most once. We can then average the occurrences of the event for every subinterval to find a probability of occurring for any subinterval .
Now, assuming our subintervals are independent, we can find the occurrences of using a binomial distribution! However, note that as our number of subintervals increases, our average and thus probability will decrease, giving us inconsistent results. Thus, we will assume that the ratio of subintervals to probability, , is constant.
Now, recall that the binomial distribution has pdf given by
We can use this pdf to find the probability of our event occurring. Letting , we find
Now observe that the number of subintervals , we find
Giving us our pdf.
We now find the expected value as
and variance as
The proof is omitted, though to do it, note that
Continuous Random Variables
Introduction to Continuous Random Variables
A continuous random variable is a function that takes on uncountably many elements. In other words, we say is continuous if there is a non-negative function such that is defined for all and
where is a set of values in .
This gives us smooth probability curves, which can be integrated along to find probabilities along an interval.
The probability mass function of a contiuous random variable has the following properties:
- for all
- .
Property (4) occurs because as we have uncountably many values, we cannot examine the probability of any singular value. (5) naturally follows from this fact.
To “verify” the pdf, we check that property (2) holds.
Example: PDFs of Contiuous Random Variables
Let have pdf given by
Find .
We find by choosing a value such that we have a valid pdf.
If is a continuous random variable with pdf , then the cummulative distribution function (cdf) is
We can intuitively understand this as summing (integrating) all values up to some point - just like our discrete case!
The properties of cummulative distribution functions follow similarly to that of the discrete case.
Just like in the discrete case, we can find the pdf from the cdf, and vice versa.
Theorem: CDF and PDF Conversions
If , are the pdf and cdf of a contiuous random variable , then
Moreover, we can find our pdf by taking the derivative of the cdf, assuming is differentiable.
Example: CDF and PDF Conversions
Consider the last example, with pdf given as
We find the cdf as
Expectation and Variance
If is a continuous random variable with pdf given by , then the expected value is
and the variance is given as
However, just like in the discrete case, we will often just use the form
All of this is directly analogous to the discrete case.
The properties of expected value and variance are given below. Note that they are virtually the same (and can be proven the same) as the discrete case.
Example: Expectation and Variance
If has pdf given by
Then we can find as
Common Continuous Random Variables
In this section, we discuss some common continuous random variables below.
Uniform Distribution
The Continuous Uniform Distribution, denoted , is the random variable over interval , with a uniform probability throughout.
The pdf of the Uniform Distribution is given as follows:
Moreover, we have a cdf which can easily be derived as
While this looks scary, the cdf is really just a line.
Finally, we have expected value and variance given as
These can easily be derived using the definitions for and , so we omit the derivations below.
Normal Distribution
The Normal Distribution, denoted is the distribution with pdf given as follows:
The curve created by this pdf is sometimes referred to as the bell curve.
PDF Verification
Let us verify the pdf of the normal distribution below. In other words, we must show that
Now, let
Using these variables, we can convert our integral to a double integral as so:
Now, if we let and , we find that we have a double integral spanning the entire -plane. Furthermore, as our and terms in the integral are given in the form (), we will convert to polar coordinates to simplify our integral.
Accounting for the Jacobian as well, we perform a change of variables to obtain the integral
Thus, we find . We have verified our pdf.
The expected value and variance for the normal distribution are given as
Note that is often called the standard deviation, whereas is often called the mean.
The normal distribution on is called the standard normal distribution. In this special case, our pdf simplifies down to
And we find the expected value and variance as
To find the expected value, we can use the fact that the function we’re integrating is odd.
Given a random variable representing a normal distribution, we can perform a transformation on the random variable to obtain the standard normal distribution. This transformation is known as standardization.
Theorem: Standardizing Normal Distributions
If , then the transformation
will yield the standard normal distribution.
This transformation essentially has the effect of shifting our values by , then bringing them closer together / further apart by dividing by .
Note that the cdf of the standard normal distribution is often denoted .
Standardizing normal distributions is often helpful in the real world, as the standard normal distribution is much easier to use in data analysis! Using the standard normal distribution, we can find the probability of obtaining any value between , as
Which can easily be evaluated using commonly known tables for the standard distribution.
These books may represent tables of values for for both , or ! Be sure you know which type of table you’re using.
Some examples of this are given below.
Example: Standardizing Normal Distributions (1)
The height of students obey a normal distribution with inches, inches. What percent of students have heights between 64 and 70 inches?
To calculate this, we will first standardize this distribution. Let’s define as
Then, we can calculate the probability as
We can then use a table of values (or a calculator) to find our result. Note that if we have a table that only tells us , we can find by virtue of the normal distribution’s symmetry.
Example: Standardizing Normal Distributions (2)
Radiation Exposure in an area takes on a normal distribution with mean mrem and standard distribution mrem. What is the probability a person is exposed to more than mrem?
Using our standardization of , we want
Gamma Distribution
The Gamma Distribution, denoted is the distribution whose pdf is given as
where is the gamma function.
This complicated looking expression is essentially just scaling a function so that it becomes a valid pdf.
Theorem: Gamma Function
Given the Gamma function, we have the following properties.
For , . If is a positive integer, then
We have .
Proof (Property 1)
We can easily prove (1) by applying integration by parts on . We can then use this to find
Furthermore, we see that
Proof (Property 2)
Conceptually, the Gamma distribution is fairly similar to the Poisson distribution in the discrete case.
If the Poisson distribution measures the probability of successes in some time interval , then the Gamma distribution is measuring the probability of “waiting” a certain amount of time for successes, where is our average rate of success.
We can find the expected value and variance of the Gamma Distribution as so:
Derivation for Expected Value
The derivation for variance follows similarly.
The Gamma distribution has many use cases. Below, we list some of the of most common cases.
The Gamma distribution on is known as the exponential distribution. In this distribution, we’re measuring the probability of the first success at some time.
Example: Exponential Distribution
Suppose the total cars exceeding the speed limit in half an hour is a random variable with a Poisson distribution with .
What is the probability the wait time is at most 5 minutes between cars exceeding the speed limit?
Here, we define as “one unit of 30 min”. So, we can expect an average of cars exceeding the speed limit in a 30 minute period. We find the probability that our wait time is at most 5 minutes using the Gamma distribution, with .
The Gamma distribution on is known as the chi-squared distribution, where denotes the degrees of freedom.
This distribution is used a lot in sampling and statistical theory!
This distribution has expected value , and variance .
Cauchy Distribution
The Cauchy Distribution, denoted , is the distribution with pdf:
This distribution commonly finds a use case in optics problems!
The cauchy distribution looks similar to the normal distribution’s bell curve, but with slower decreasing sides.
PDF Verification
Let’s verify the pdf of the Cauchy distribution for .
Surprisingly, we find that the cauchy distribution does not have any expected value or variance.
Beta Distribution
The Beta Distribution, denoted , is the distribution with pdf given as
PDF Verification
We verify the pdf of the beta distribution. Recall the gamma function
Now, letting , we obtain
We can manipulate this double integral and show it is equal to .
Let’s define the change of variables , . Then,
Note that as .
We use this fact to perform a change of variables on our double integral.
There is no Jacobian in this change of variables, as it evaluates to 1.
We can pull a out of this double integral to obtain
Which will divide our beta pdf to give us 1.
We find the expected value and variance of the beta distribution as follows.
Beta Distribution: Derivation for Expected Value
Looking at the last two terms, notice that we are really just integrating . Note that because of this, we eliminate terms by definition of the beta distribution’s pdf.
The derivation for the variance follows quite similarly.
Transformations of Random Variables (Univariate)
Suppose we have a random variable , and define random variable such that it is given in terms of .
Then, the probability of some value , , is asking for the cumulative probability over all possibilities satisfying .
Given some random variable , how do we find it’s pmf?
Discrete Case
In the discrete case, if is a one-to-one function, we can find the pmf of using the inverse function . Plugging this function into the pmf of as will yield us the pmf of .
Consider the following example.
Example: Transforming Discrete Random Variables
Let , and find the pmf of .
We find the pmf of by solving for , and subbing this into our binomial pdf.
This tells us that if , then as it is “unreachable” from .
Now, subbing this into our distribution as , we find pmf
Continuous Case
In the continuous case, it is often the case that we can find the pdf of by first finding its cdf (which can be easier to do). Consider the following examples.
Example: Transforming Continuous Random Variables
Let . Find the pdf of .
We can find the pdf of using its cdf.
We can use to find the cdf of , and differentiate this cdf to find our desired pdf.
Example: Transforming Continuous Random Variables (2)
Let be the standard normal distribution. Find the pdf of .
Note that . We can use this to find the cdf of .
We can differentiate this expression to find the pdf of as
For .
Alternatively, given that is strictly increasing (or decreasing), we can apply the following theorem:
Theorem: Transforming Random Variables, Continuous
Let be the pdf of a continuous random variable, and suppose is strictly increasing or decreasing.
Then, the pdf of is given as
Provided exists.
Proof
Assume is increasing. We know and .
We can use these facts to find this to find as
Consider the following examples.
Example: Transforming Continuous Random Variables (3)
Let the pdf of be given as
Find the pdf of .
Because our pdf is always decreasing, using the theorem, we can find
And use this to find the pdf as