8 Random Variables
8.1 Describing Random Variables
A random variable is a random process that produces a number.
- Typically, capital letters (often near the end of the alphabet) are used for random variables. Example:
\[ p(X = 3) = 0.2 \]
We will focus our attention on discrete random variables. A discrete random variable can only take on values from a finite or countable list of values. We will be especially interested in the finite case.
Any random process can be converted into a random variable by a function that maps outcomes in the sample space to numbers. In our text you will see notation like \(X: S \to R\) (X maps each outcome to a number) or \(X(HHT) = 2\) (counting the number of heads).
We will mostly work with random variables in two formats: (a) a table of values and probabilities, or (b) a formula that tells how to compute the probability for any specified value.
8.2 Probability Tables
First example
Here is an example probability table for a random variable we’ll call \(X\).
value | 1 | 2 | 3 | 4 |
---|---|---|---|---|
probability | 0.4 | 0.3 | 0.2 | 0.1 |
What properties must the numbers in such a table always have?
What is \(p(X = 2)\)?
What is \(p(X > 2)\)?
What is \(p(X \mbox{ is even})\)?
Creating a probability table
Create a probability table for the random variable \(H\), where \(H\) is the number of heads observed when flipping 4 fair coins. Start by determining all the possible values. Then for each value, determine its probability.
Let \(X\) be the absolute value of the difference in the values of two fair 4-sided dice. For example, if you roll a 3 and a 1, the difference is 2. Create a probability table for \(X\). (What are the possible values?)
Let \(D\) be the number of diamonds dealt in a 5 card hand.
Create a probability table for \(D\).
What is the most likely number of diamonds in such a hand?
8.3 Probability Functions
We can also describe random variables with formulas.
Let \(Y\) be defined by \(p(Y = y) = y/10\) when \(y \in \{1, 2, 3, 4\}\).
What is \(p(Y = 3)\)?
Create a probability table for \(Y\).
Suppose you keep flipping a coin until you get a head. Let \(F\) count the number of flips.
What is \(p(F = 1)\)?
What is \(p(F = 2)\)?
What is \(p(F = 3)\)?
What are the possible values for \(F\)?
Can you come up with a formula for \(p(F = k)\)?
Let \(X\) be the number of heads in \(n\) tosses of a fair coin.
What are the possible values of \(X\)?
Give a formula for \(p(X = k)\)?
Give a formula for \(p(X = x)\)? (This is the same as the preceding part, but with different notation.)
Now suppose the coin isn’t fair. Let \(p\) be the probability of getting a head on each flip. Let \(X\) be the number of heads in \(n\) flips.
What is \(p(X=1)\) when \(n = 1\) and \(p = 0.75\)?
What is \(p(X=1)\) when \(n = 2\) and \(p = 0.75\)?
Make a probability table for \(X\) when \(n = 3\) and \(p = 0.75\).
Determine a general formula for \(p(X = x)\) in terms of \(n\) and \(p\).
8.4 Binomial Distributions
The previous example illustrates a scenario that arises in many applications:
- A random process consists for \(n\) parts or steps (traditionally called trials).
- Each trial has two possible outcomes (traditionally called success and failure).
- The probability of success is the same (\(p\)) for each trial.
- The trials are independent of each other.
- Our random variable is the count of the number of successes in the \(n\) trials.
We will denote this \(X \sim \textsf{Binom}(n,p)\).
Create a probability table for a \(\textsf{Binom}(2, 0.2)\) random variable.
Create a probability table for a \(\textsf{Binom}(3, 1/4)\) random variable.