Two switches are tested, and each one either works or fails. You could record the full result for both switches, or only how many of them work. Both records describe the same experiment, but they answer different questions and keep different amounts of information. This lesson makes the second kind of record precise. A random variable is a fixed rule that turns each outcome into a number, and its distribution says how probability is spread over the numbers that rule can produce.
Key terms
Random variable
Definition Let be the sample space of an experiment with probability . A random variable is a function that assigns a real number to each outcome in . For a set of real numbers, the event is the set of outcomes
at which takes a value in . So expressions such as or are probabilities of events in . On a finite or countably infinite sample space in which every set of outcomes is an event, every real-valued function on is a random variable. When not every set of outcomes is an event, which is typical on larger sample spaces, a technical condition called measurability is added so that these sets are events.
In plain words The rule itself is not random. What is uncertain before the experiment is which outcome will occur, and therefore which number the rule will produce.
Example Inspect switch one and then switch two, writing W for working and F for failed. The sample space has four ordered outcomes. In this constructed model each switch works with probability and the two results are independent, so each outcome has probability . Let be the number of working switches.
| Outcome | WW | WF | FW | FF |
|---|---|---|---|---|
| Probability | ||||
| Value of |
The event is , so . The event leaves out only FF, so .
Realization
Definition A realization of a random variable is the number for the outcome that actually occurs. A capital letter such as names the random variable, and a lowercase letter such as stands for a possible or observed value. The event is the set of outcomes at which the rule produces the number .
In plain words The random variable is the rule, and the realization is the number the rule gave this time. A single realization is one number. It does not say how likely that number was.
Example Suppose the test of the two switches produces WF. The realization of is then . Another run might produce FF, with realization . Neither run changes the function or the model probabilities , and . Notice also that the realization does not reveal which switch works, because WF and FW give the same value.
Discrete random variable
Definition A random variable is discrete if there is a finite or countably infinite set of real numbers with . A set is countably infinite when it is infinite and its elements can be listed as a sequence in which every element appears. Every random variable on a finite or countably infinite sample space is discrete, because it takes at most countably many values. Whether the values are whole numbers plays no role.
In plain words With probability , a discrete random variable takes one of a list of values that can be written one after another, even when the list never ends. Fractions and negative numbers are allowed in that list.
Example Suppose each working switch earns half a token, and let . The possible values of are , and . They are not all integers, but there are only three of them, so is discrete. By contrast, if a random variable gives probability to every single real number, it cannot be discrete. For any finite or countably infinite set , countable additivity would give as a sum of zeros, which is and not . Such variables appear later in the course.
Support
Definition The support of a discrete random variable is the set of values that have positive probability,
It is finite or countably infinite, lies in it with probability , and every real number outside it has . A countably infinite support is a support with infinitely many values, which can still be listed in a sequence.
In plain words The support lists the values that can actually turn up with positive probability. A countably infinite support cannot be written as a finite list, but its values can still be counted off one at a time.
Example For the two switches the support of is . The value is outside it, since two switches cannot give three working switches, so . For a countably infinite support, toss a fair coin repeatedly with independent tosses, and let be the number of tosses up to and including the first head. On the one sequence with no head at all, set , so that has a value at every outcome. The event means tails followed by a head, so independence gives
for every positive integer . The event that no head ever appears is contained in the event that the first tosses are all tails, so its probability is at most for every , which forces it to be . So the value chosen on that sequence affects no probability, and with probability the value of is one of . The support is the countably infinite set of positive integers. No finite list would do, because for every .
Distribution of a random variable
Definition The distribution of a random variable is the rule that gives the probability for each set of real numbers. For a discrete it is determined by the support together with the probabilities of its values, because the probability of any statement about is found by adding those probabilities over the support values that satisfy it. Two discrete random variables have the same distribution when they give every real number the same probability, even if they are different functions on .
In plain words The distribution is the full pattern of chances before anything is observed. A realization is one number produced by a single run. Having the same distribution does not make two random variables the same.
Example The switch count has , and . Its three values are not equally likely, because the value has two outcomes behind it and the others have one each. Now let if switch one works and otherwise, and define in the same way for switch two. Then at every outcome. The variables and have the same distribution, each equal to with probability and with probability . They are still different random variables, since at the outcome WF the value of is and the value of is .
Check yourself
- Three switches are tested, and each works with probability , independently of the others. Let be the number of working switches. Find the support and the distribution of , and find .
Show the answer
There are ordered outcomes such as WWF, and by independence each has probability . The numbers of outcomes with , , and working switches are , , and . So the support is and the distribution is
The probabilities add to . The event contains WWF, WFW, FWW and WWW, so .
- A classmate says that has four possible values, so each value has probability . Explain the mistake. Then suppose you are told only that the realization of is . What can you say about which switch failed?
Show the answer
The probabilities of the values come from the outcomes behind them, not from the number of values. The value is produced by three of the eight equally likely outcomes, so its probability is , while the value is produced by only FFF and has probability .
The realization is consistent with WWF, WFW and FWW, so the failed switch could be any of the three. In this model each of those outcomes has conditional probability given . The count records how many switches work and forgets which ones.
- With three switches as above, let if switch one works and otherwise, and define in the same way for switch three. Do and have the same distribution? Are they the same random variable?
Show the answer
Switch one works in of the equally likely outcomes, so and . The same count holds for switch three, so the two variables have the same distribution.
They are not the same random variable. At the outcome WWF the value of is and the value of is . In fact the two values differ in the outcomes where switches one and three disagree, so .