Free preview
88 lessons
Essential Probability & Statistics for ML
Free preview
Essential Probability & Statistics for ML · 88 lessons
No surprise gaps
Actually remember it
Skip what you know
One subscription. All learning paths included.
Our content is best on a larger screen
What a random variable is
We often care about a number given by an experiment's outcome rather than the outcome itself, such as the total of two dice, how long a customer waits or a player's winnings.
Suppose a game pays £ for each head in ten tosses. With events alone, describing the winnings needs eleven of them, "win £", "win £", up to "win £", and there is still no way to say the winnings are twice the number of heads. If we give the number of heads a name, , the winnings are . A number given by the outcome in this way is called a random variable.
It is a third kind of object on a sample space, after outcomes and events.
Consider two coin tosses, with , and let be the number of heads. The diagram builds up each kind of object in turn, then runs the experiment.
The diagram draws each outcome as an oval inside
Definition
A random variable on a sample space is a function . It assigns each outcome one number , the value of at . We write random variables with capital letters such as and .
A card's suit is not a number, but " if the card is a heart, otherwise" assigns every card a number.
So a random variable is not an outcome, an event or a single number, but a rule that assigns a number to every outcome.
A shop's records list every basket bought last week, and one basket is chosen at random. Which of these quantities are random variables?
Solution
Each outcome is one of last week's baskets. For each quantity we ask what it gives each basket:
| Quantity | What it gives each basket | Random variable? |
|---|---|---|
| The items in the basket | A list of goods, the outcome itself | No |
| The baskets that cost over £ | A set of baskets, an event | No |
| The total cost | One number, its cost in pounds | Yes |
| The number of items | One number, its count | Yes |
A random variable must give every basket one number, which is what the middle column checks. The total cost and the number of items vary because the basket is chosen at random: the rule is fixed, the basket is not.
Practice questions
4 questions
One card is drawn from a shuffled -card deck. Which of these is a random variable?
Select the correct answer:
+ 3 more questions
The value of a random variable
We've seen that a random variable assigns each outcome a number. The value is the number it assigns the outcome , and we find it by applying the rule to .
If counts the number of heads in two coin tosses, the outcome has one head, so . Applying the rule to every outcome in the sample space in turn gives a table of the values of , with one row per outcome.
Several random variables can be defined on the same sample space. If counts the number of tails, its values form a second column of the same table:
| Outcome | Number of heads, | Number of tails, |
|---|---|---|
A player tosses a coin three times, scoring for each head and for each tail. Give her total score on each outcome.
Solution
We start by listing the sample space. Each outcome records the three tosses in order, so
Next we apply the rule to each outcome. For example, has two heads and one tail, so
Doing the same for every outcome gives the value of on each:
| Outcome | |
|---|---|
Practice questions
4 questions
A die is rolled twice, and is the first number minus the second. Which of these is true?
Select the correct answer:
+ 3 more questions
Events described by a random variable
Suppose we toss two fair coins, and let be the number of heads. How likely is exactly one head, that is, ?
It is tempting to write or , but neither makes sense. gives probabilities to events, which are sets of outcomes. is a rule that gives each outcome a number, and is a number, so neither is an event. We first have to find the event that "" describes. The diagram shows how.
We want the probability that
Definition
For a random variable and a number , the event that takes the value is
the set of outcomes that assigns the value . Lower-case stands for a number, usually one of the values of .
So . Its probability is written , without the inner braces, and read as "the probability that equals ".
Inequalities work the same way. is the event of at least one head, , and its probability is written .
Two fair dice are rolled, and is the larger of the two numbers, or their shared value if they match. Find .
Solution
We label the dice, so each outcome is an ordered pair with die showing and die showing . The dice are fair, so the outcomes are equally likely.
We first list the event , the outcomes that assigns the value . Neither die can show more than , and at least one must show , so
The event holds of the equally likely outcomes, so by the naive definition of probability
So takes the value with probability .
Practice questions
4 questions
A coin is tossed three times, and is the number of heads. Which set is the event ?
Select the correct answer:
+ 3 more questions