Mathematics · Ch 14 — Probability Distributions
Random variables
Random variables
A random variable formalises an idea we already use informally: instead of listing every raw outcome of a random experiment, we are usually interested in a single number derived from that outcome — the number of heads when two coins are tossed, the sum shown by two dice, or the number of defective items in a sample. Formally, a random variable is a real-valued function defined on the sample space of a random experiment: . Its domain is the sample space and its co-domain is the set of real numbers. We abbreviate 'random variable' as r.v., and usually denote it by a capital letter such as , or ; a specific value it takes is written with the corresponding small letter , and the set of every outcome that produces that value is the event .
Three quick illustrations show the idea. Throwing two dice has 36 raw outcomes, but if only the sum of the two numbers matters, there are just 11 distinct values, from 2 to 12. Tossing a coin 10 times has raw outcomes, but the number of heads among the 10 tosses takes only 11 distinct values, from 0 to 10. Choosing 4 items at random from a lot of 20 that contains 6 defectives has many raw outcomes, but the number of defective items among the four chosen takes only 5 distinct values, from 0 to 4. In every case there is a definite rule assigning a unique number to each outcome, and because that number changes from outcome to outcome it is genuinely a variable — a random variable, since it is derived from the outcomes of a random experiment.
A fully worked example makes the mechanics explicit. Suppose three seeds are sown and we record, for each, whether it germinates (Y) or not (N). The sample space has outcomes: . Let count how many times Y appears in an outcome. Then ; ; ; and . So takes exactly four possible values, — this set is called the range of . The four events defined by these values are , , and .
A sample space need not be finite for a random variable to be well defined on it. Consider tossing a coin repeatedly until a head appears for the first time. The sample space is the unending list , which is countably infinite. If is the number of tosses needed to get the first head, then can equal any positive integer, so its range is also countably infinite. This example is picked up again once probability mass functions are introduced (section 7.3.1).