The chapter's opening move: instead of asking for the probability of one event, ask how probability is distributed across every value a quantity can take. A random variable attaches a number to each outcome of an experiment, and a discrete probability distribution function lists each value the variable can take beside the probability of taking it. Such a function has exactly two characteristics — each probability lies between zero and one inclusive, and the probabilities sum to one — and a table failing either is not a distribution at all. Because distinct values are mutually exclusive, every range question is a plain sum, and because the variable takes isolated values the distribution is drawn as separated stems rather than a curve.
Subject: Statistics · 65 slides · symbolic lesson
Open the interactive version of this deck
Title
Statistics · Chapter 4 — Discrete Random Variables
Attach a number to every outcome, then say how likely each number is
Objectives
Chapter 3 asked for the probability of one event at a time: this card is a heart, this student is a woman. Chapter 4 changes the question. It takes a quantity that varies from one repetition to the next, such as the number of heads or the number of days someone attends class, and asks how probability is shared out over every value that quantity can take, all at once.
The whole lesson hangs on one table with two columns: the values on the left, their probabilities on the right. Everything in the rest of the chapter, from expected value to the binomial and Poisson distributions, is a way of filling in or summarising a table of exactly this shape. So the habits you build here, naming the variable carefully and checking the two properties, pay off in every section that follows.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, pp. 227-230 — the chapter introduction and Section 4.1
Warm-up
In Chapter 1 you turned counts into relative frequencies by dividing by the sample size. That one move is most of this lesson. Answer from memory before you look.
Discussion prompt
Twenty students each record how many siblings they have. What does the relative frequency column of their table add up to, and why can it never add up to anything else? Then list the sample space for tossing two coins.
Keep the reason, not just the fact. The column adds to one because every individual lands in exactly one row. That same reason, applied to repetitions of an experiment instead of people in a sample, is the second characteristic of a probability distribution you will meet in Part 2.
And keep the four coin outcomes in mind. In Part 1 you will ask a different question about them: not which outcome happened, but how many heads it has. That question is a random variable.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — the collaborative exercise's relative frequency column
Section
Part 1
Concept
Toss three fair coins. The sample space has eight outcomes, written as strings of H and T. Those strings are not numbers, and you cannot average them or add them. Very often, though, you only care about one number from each outcome, such as how many heads it has.
\[ S = \{TTT,\ HTT,\ THT,\ TTH,\ THH,\ HTH,\ HHT,\ HHH\} \]
Define the random variable by saying, in words, what number it records. The book writes it with a capital letter.
\[ X = \text{the number of heads in three tosses of a fair coin} \]
Figure (svg): Eight boxes on the left, one per outcome of tossing three coins (TTT, HTT, THT, TTH, THH, HTH, HHT, HHH). A line runs from each box to one of four circles on the right labelled 0, 1, 2, 3, the number of heads in that outcome: one line to 0, three to 1, three to 2, one to 3.
Now each outcome is sent to one number. TTT gives 0; HTT, THT and TTH each give 1; the three outcomes with two heads give 2; HHH gives 3. Eight outcomes collapse onto four values, and that collapse is the whole point: you traded a list of strings for a quantity you can count.
random variable — A description, in words, of a numerical outcome of a statistical experiment. Its value can vary from one repetition of the experiment to the next.
It is called random because you do not know which value you will get until you run the experiment, and variable because the value changes from run to run. It is not a formula you solve; it is a question you ask of every outcome.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4, p. 227 — Random Variable Notation: three fair coins
Notation
The book is strict about letters, and it matters, because two different objects are in play. One is the random variable, a sentence. The other is a particular value it might take, a number.
Annotate
On: \( P(X = 2) = \frac{3}{8} \)
Read the whole line aloud as a sentence: the probability that the number of heads is two equals three eighths. If you cannot turn a line into a sentence like that, one of the letters has lost its meaning.
The book shortens this to P(x), meaning the probability that X takes the value x. So P(x) is a column of numbers, one for each value, and P(2) is one entry in it. Whenever you see a lower-case x, expect a number; whenever you see a capital X, expect words.
\[ P(x) = P(X = x) \quad \text{for each value } x \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4, p. 227 — X is in words, and x is given as a number
Worked example
List every value of the number of heads in three tosses and find the probability of each. The eight outcomes are equally likely, so each probability is a count of outcomes over 8.
Name the variable
Why: in words, with what is being counted.
\[ X = \text{number of heads in three tosses} \]
List the values
Why: the fewest heads is none, the most is three, and every whole number between is possible.
\[ x = 0,\ 1,\ 2,\ 3 \]
Count outcomes for each value
Why: read them off the map on the last slide: one line arrives at 0, three at 1, three at 2, one at 3.
\[ 1,\quad 3,\quad 3,\quad 1 \]
Divide each count by 8
Why: equally likely outcomes, so a probability is a count over the size of the sample space.
\[ P(0) = \tfrac18,\ P(1) = \tfrac38,\ P(2) = \tfrac38,\ P(3) = \tfrac18 \]
| x | P(x) |
|---|---|
| 0 | 1/8 = 0.125 |
| 1 | 3/8 = 0.375 |
| 2 | 3/8 = 0.375 |
| 3 | 1/8 = 0.125 |
Notice the table has four rows, not eight. A row is a value of X, and several outcomes can share a row. Getting the rows right is the first thing to do on any problem like this one.
Look at the shape of the column: small, large, large, small. The middle values are more likely because more outcomes lead to them, not because the coins prefer them. Every single outcome is exactly as likely as every other; it is the grouping into values that makes the column uneven.
Check the total
Why: every outcome was counted in exactly one row, so the counts must add to 8 and the probabilities to 1.
\[ \tfrac18 + \tfrac38 + \tfrac38 + \tfrac18 = \tfrac88 = 1 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4, p. 227 — the sample space for three fair coins
Intuition
A random variable is a question you ask of each outcome, so the same experiment supports many of them. Toss three coins again, and this time ask different questions of the same eight outcomes.
| outcome | X: heads | Y: tails | W: heads minus tails |
|---|---|---|---|
| TTT | 0 | 3 | −3 |
| HTT, THT, TTH | 1 | 2 | −1 |
| THH, HTH, HHT | 2 | 1 | 1 |
| HHH | 3 | 0 | 3 |
Each column is a different random variable, with its own list of values. The number of tails runs from 0 to 3 like the number of heads, but in the opposite order. The difference between heads and tails takes the values minus 3, minus 1, 1 and 3, and can never be zero or even, since three coins cannot split evenly.
\[ W = X - Y = 2X - 3 \]
That is why the book insists you write the variable in words. The sentence is what tells a reader which column you mean. Two people handed the same coins can build two perfectly good distributions that look nothing alike, simply because they asked different questions.
It also explains why the first step of every problem is naming X. Until the question is fixed, there is no list of values to write down, and no table to fill.
Concept
The number of heads in three tosses can only be 0, 1, 2 or 3. You could write down every possible value before tossing anything. A random variable whose values can be listed like that, with gaps between them, is called discrete.
Figure (svg): Two number lines. The top one has eleven separate yellow dots at 0 through 10, labelled heads in ten tosses, with a red mark at 2.5 saying it is not possible. The bottom one has a solid cyan bar from 5 to 13 minutes, labelled time to run a mile, with 7.37 minutes marked as possible.
Compare the two lines. Heads in ten tosses can be 2 or 3, never 2.5, so its values are isolated points. The time it takes to run a mile can be 7 minutes, 7.3, 7.37 or anything in between, so its values fill an interval. That second kind is continuous, and it is the subject of Chapter 5.
discrete random variable — A random variable whose possible values can be counted, such as 0, 1, 2, 3. Between two neighbouring values there are no others.
A quick test: ask whether the answer comes from counting or from measuring. Counts of heads, days, calls, cars, or batches are discrete. Measurements of time, weight, height, or distance are continuous, however few decimal places your ruler prints.
Some variables are discrete even though their values are not whole numbers. The amount of change in a pocket, counted in dollars, takes values like 0.25 and 1.10; they can still be listed, one cent apart, so the variable is discrete. What matters is the gaps, not the decimal point.
The list of values need not stop at a small number. A count of cars sold in a year could be 0, 1, 2, and so on without an obvious ceiling; it is still discrete because you can list the values one after another.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4, p. 227 — the x values are countable outcomes
Sorting
Decide for each variable whether its values can be listed, with gaps between them, or whether they fill an interval. Say to yourself whether you would count it or measure it.
Sort into buckets
Place each random variable in the right group.
Every discrete variable here starts with the words the number of. That is a strong hint, though not a rule you should trust blindly: the number of kilograms of flour is a measurement in disguise, and can be 2.37.
Waiting time is the one people most often misfile, because clocks show whole minutes. The minutes shown are a rounding of a quantity that really can take any value, so the variable itself is continuous. Rounding a measurement does not make it a count.
Prediction
The book asks a class to toss a coin ten times each and tabulate the number of heads. Then it asks what happens with a thousand tosses. Predict before reading on.
Predict first
Let X be the number of heads in 1000 tosses of a fair coin. Which statement is right?
Correct: X can be any whole number from 0 to 1000, and values near 500 are the most likely
Why: The possible values are the whole numbers from 0 to 1000, and the most likely ones cluster around half the tosses. But no single value is likely: even exactly 500 heads happens only about 2.5 percent of the time, computed exactly in node. It is the neighbourhood of 500 that carries the probability.
The values are easy: anything from no heads to all heads, 1001 possibilities. Which is most frequent is subtler. Exactly half is the single most likely value, yet it is still unlikely, about one time in forty. The probability is spread thinly over the many values close to 500.
\[ P(X = 500) \approx 0.025, \qquad P(X = 5 \text{ in ten tosses}) \approx 0.246 \]
With only ten tosses, exactly five heads happens about a quarter of the time. More tosses means more values to share the probability among, so each single value gets less. Both of those numbers come from the binomial distribution in Section 4.3; for now they are here only to calibrate your intuition.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — Collaborative Exercise, part b
Trap
Asked to define the random variable for Nancy's classes, a common first line:
\[ X = 3 \]
or, just as often,
\[ X = \text{Nancy} \]
Wrong. The first is a value; the second is a person. Neither is a quantity that varies from week to week.
It is tempting because 3 is the number that appears most in the problem, and Nancy is what the problem is about.
A random variable is a sentence that names a count, what is counted, and the unit of repetition. Only then do you list its values:
\[ \begin{aligned} X = {}& \text{the number of days Nancy} \\ & \text{attends class per week} \end{aligned} \]
\[ x = 0,\ 1,\ 2,\ 3 \]
Test your definition by asking: could I record this number, for a single week, if I watched? For the correct sentence, yes; for 3, the question makes no sense. The words per week also matter, because a month would give different values.
A good definition has three parts, and you can tick them off: what is counted (days attended), whose (Nancy's), and over what stretch (one week). Leave out any one and the values become ambiguous.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4, p. 227 — X is written in words, and x is given as a number
Step zero
Ellen has music practice three days a week. She practises on all three days 85 percent of the time, two days 8 percent of the time, one day 4 percent of the time, and no days 3 percent of the time. One week is selected at random.
Discussion prompt
Before building anything, write the random variable in words and list the values it can take. What single phrase in your definition decides what the values are?
This is the step that every later calculation leans on. With X written down, the four percentages have somewhere to go: one beside each value. Without it, 85 percent is just a number floating in a paragraph.
Notice that you did not need to compute anything to list the values; they came straight from the definition. That is a good sign the definition is complete. You will build Ellen's full table in Part 3.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 265 — Practice 10
Section
Part 2
Concept
Once you have listed the values of X, you attach a probability to each. The resulting list of values and probabilities is a probability distribution function, or PDF. The book is precise about what makes a list qualify: exactly two characteristics, and both must hold.
\[ \text{(1)}\quad 0 \le P(x) \le 1 \quad \text{for every value } x \]
The first is inherited from Chapter 3. Each P(x) is the probability of an event, the event that X lands on that value, and no probability can be negative or exceed one.
\[ \text{(2)}\quad \sum_{x} P(x) = 1 \]
The second is the new demand. Every time you run the experiment, X lands on exactly one value. The values are therefore mutually exclusive, since no week has both two and three attended days, and exhaustive, since every week has some number. So their probabilities must share out the whole of one, with nothing missing and nothing counted twice.
probability distribution function (discrete) — A list of every value a discrete random variable can take, each with its probability, such that each probability is between zero and one inclusive and the probabilities sum to one.
Other textbooks call this a probability mass function. The name differs; the two characteristics do not.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — the two characteristics of a discrete PDF
Intuition
The word function in probability distribution function is meant literally. Feed it a value of X and it hands back one number, the probability of that value. Every value gets exactly one output, which is what a function does.
\[ x \;\longmapsto\; P(x) \]
The same function can be written down in three ways, and you should be able to move between them. As a table, which is how the book presents Examples 4.1 and 4.2. As a picture, with one stem per value, as throughout this deck. And sometimes as a formula, when the probabilities follow a rule.
\[ \text{one fair die: } P(x) = \frac{1}{6} \quad \text{for } x = 1,\ 2,\ 3,\ 4,\ 5,\ 6 \]
That one line is a whole six-row table. For coins the rule is less obvious, and Section 4.3 gives the single formula that produces a whole column of heads probabilities. For survey data like Example 4.1, there is no formula; the table is the function, and each entry is a count divided by fifty.
Whichever form you are given, the two characteristics are questions about the outputs only: is each output a legal probability, and do the outputs add to one? The inputs, the values of x, can be any numbers at all.
Notation
The second characteristic uses a capital sigma. If you have not met it before, it is only shorthand for adding a column.
Annotate
On: \( \sum_{x} P(x) = P(0) + P(1) + \cdots + P(5) = 1 \)
Always check which column the sigma runs over. It adds the probability column, never the x column. Adding the values 0 through 5 gives 15, which means nothing; adding their probabilities gives the total probability, which must be one.
When the probabilities are fractions with a common denominator, as in Example 4.1, the check is fastest in the numerators: they must add to the denominator.
\[ \frac{a_0 + a_1 + \cdots + a_5}{50} = 1 \iff a_0 + a_1 + \cdots + a_5 = 50 \]
Picture it
Example 4.1 surveyed 50 mothers of newborns and recorded how many times a week the baby's crying woke the mother after midnight. Here every mother is drawn as one dot, stacked above her value.
Figure (svg): A dot plot of the 50 mothers of Example 4.1. Stacks of orange dots above x = 0 to 5 with 2, 11, 23, 9, 4 and 1 dots; the stack of 23 at x = 2 is yellow.
Every mother appears in exactly one stack: she cannot have been woken both two and three times in the same week. So the six stacks together hold all fifty dots, no more and no fewer.
\[ 2 + 11 + 23 + 9 + 4 + 1 = 50 \]
Now turn each stack into a probability by dividing by fifty, the chance that a mother picked at random from this sample sits in that stack. Dividing every stack by fifty divides the total by fifty, so the six probabilities add to exactly one.
This is the second characteristic seen in a picture. It is not an extra rule someone imposed; it is the fact that each repetition, here each mother, lands in exactly one place. If a table's probabilities do not add to one, either an outcome is missing or one has been counted in two rows.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — Example 4.1
Worked example
Let X be the number of times per week a newborn baby's crying wakes its mother after midnight. For the 50 mothers sampled, x takes the values 0 to 5 with the counts shown. Show that the table is a discrete PDF.
| x | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| P(x) | 2/50 | 11/50 | 23/50 | 9/50 | 4/50 | 1/50 |
Convert to decimals
Why: each count divided by 50, so it can be compared with 0 and 1 at a glance.
\[ 0.04,\ 0.22,\ 0.46,\ 0.18,\ 0.08,\ 0.02 \]
Test the first characteristic
Why: the smallest entry is 0.02 and the largest is 0.46, both inside the allowed range.
\[ 0 \le 0.02 \le P(x) \le 0.46 \le 1 \]
Add the numerators
Why: a common denominator lets you add the counts directly.
\[ 2 + 11 + 23 + 9 + 4 + 1 = 50 \]
Divide by the common denominator
Why: the total probability.
\[ \sum_x P(x) = \frac{50}{50} = 1 \]
Figure (svg): A stem plot of Example 4.1: stems at x = 0 to 5 with heights 0.04, 0.22, 0.46, 0.18, 0.08, 0.02.
The stem plot shows the same table: six stems, each as tall as its probability, the tallest at two wakings. Nearly half of these mothers were woken exactly twice a week.
Where do these probabilities come from? Not from a model, as the coins did, but from data: each is the share of the 50 sampled mothers at that value. So the table describes this sample, and it serves as an estimate of the distribution for all mothers of newborns. A different sample of 50 would give slightly different stems.
Check with the decimals
Why: an independent addition of the decimal column must also give exactly one, and it does, to the last digit.
\[ 0.04 + 0.22 + 0.46 + 0.18 + 0.08 + 0.02 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, pp. 228-229 — Example 4.1
Worked example
A hospital researcher records how many times each of 50 post-op patients rings the nurse during a 12-hour shift. Let X be that number, with values 0 to 5. Give the two reasons the table is a discrete PDF.
| x | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| P(x) | 4/50 | 8/50 | 16/50 | 14/50 | 6/50 | 2/50 |
The question says two reasons because there are exactly two characteristics. Name each one and then show it holds; a bare yes is not an answer.
Reason one: every probability is between 0 and 1
Why: the counts run from 2 to 16, all between 0 and 50, so every fraction is between 0 and 1.
\[ \frac{2}{50} = 0.04 \le P(x) \le 0.32 = \frac{16}{50} \]
Reason two: add the numerators
Why: the same common-denominator shortcut as Example 4.1.
\[ 4 + 8 + 16 + 14 + 6 + 2 = 50 \]
So the probabilities sum to one
Why: fifty over fifty.
\[ \sum_x P(x) = \frac{50}{50} = 1 \]
Figure (svg): A stem plot of Try It 4.1: stems at x = 0 to 5 with heights 0.08, 0.16, 0.32, 0.28, 0.12, 0.04.
Compared with the babies, the calls are spread more evenly: 2 and 3 calls are nearly as common as each other. The shape is a fact about this hospital; the two characteristics are what make it a distribution at all.
A two-reason answer should read like this, in full sentences: each probability is between zero and one inclusive, because each is a count out of fifty that is at least zero and at most fifty; and the probabilities sum to one, because every patient was counted exactly once. The reasons are the two characteristics, each tied to this data.
Check in decimals
Why: the six decimal probabilities, added separately, must reach exactly one.
\[ 0.08 + 0.16 + 0.32 + 0.28 + 0.12 + 0.04 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 229 — Try It 4.1
Picture it
A table of numbers beside values is not automatically a distribution. Here are three proposed tables for a variable with values 0 to 3, drawn as bars so you can see what goes wrong.
Before reading on, run the two tests yourself on each panel: is any bar below zero or above one, and do the four bars total one? It takes ten seconds, and it is exactly what you will do on every table from now on.
Figure (svg): Three bar charts side by side over x = 0 to 3. Left, green: bars 0.1, 0.2, 0.3, 0.4, total 1, marked valid. Middle: bars 0.2, 0.4, 0.5, 0.1, total 1.2, marked too much. Right: bars 0.3, 0.4, -0.1 (drawn below the axis in red) and 0.4, marked negative.
The left table passes both tests: every bar is between 0 and 1, and the four bars total one. The middle table has sensible-looking bars, but they add to 1.2. It claims the four possible values together happen more than always, which is impossible.
\[ 0.2 + 0.4 + 0.5 + 0.1 = 1.2 \ne 1 \]
The right table is the sneaky one. Add it up and you get exactly one, so a quick sum check passes. But one bar sits below zero, and no event has a negative chance. It fails the first characteristic, which is why you must test both, every time.
\[ 0.3 + 0.4 + (-0.1) + 0.4 = 1, \quad \text{but } P(2) = -0.1 < 0 \]
A total below one fails too, in the other direction: it means some possible value was left out, or its probability was forgotten. You will use exactly that gap on the next worked example.
Discrimination
Each table lists probabilities for the values 0, 1, 2, 3 in order, or 0, 1, 2 where only three are given. Sort each one by the first test it fails, or as valid if it passes both.
Sort into buckets
Sort each proposed table.
The table 0, 0, 1 surprises people. It is a legal distribution: the variable always takes the value 2. A distribution with no uncertainty is dull, but nothing in the two characteristics forbids it, and zero and one are both inside the inclusive range.
The table with 1.2 and two negative entries sums to exactly one, which shows once more why the sum test alone is never enough.
Counterexample
A classmate claims that if a column of probabilities adds to one, it must be a distribution. Refute the claim with a single table.
Discussion prompt
Write a table for a variable with values 0 and 1 whose probabilities add to exactly one but which is not a discrete PDF. Say which characteristic it breaks.
One counterexample is enough to kill a general claim. That is why the book lists two characteristics and not one: the sum condition controls the total, but only the range condition controls each entry.
Could you do the reverse, a table with every entry in range that is still not a distribution? Easily: 0.5 and 0.4. Each is a fine probability, but together they account for only nine-tenths of the possibilities. So neither characteristic implies the other, and you really do need to check both.
Worked example
A company knows how many years new hires stay. Let X be the number of years a new hire stays, with values 0 to 6. The entry for 4 years is missing. Find it.
| x | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| P(x) | 0.12 | 0.18 | 0.30 | 0.15 | ? | 0.10 | 0.05 |
You have one unknown and one equation, because the second characteristic says the whole column must total one. Write that equation first, then solve it.
Write the sum condition
Why: every value of X appears once.
\[ 0.12 + 0.18 + 0.30 + 0.15 + P(4) + 0.10 + 0.05 = 1 \]
Add the known entries
Why: six numbers, added in node.
\[ 0.90 + P(4) = 1 \]
Subtract
Why: move the known total to the other side.
\[ P(4) = 1 - 0.90 = 0.10 \]
Figure (svg): A horizontal bar of total length 1 cut into seven pieces labelled with x = 0 to 6. Six pieces are filled blue and labelled 0.12, 0.18, 0.30, 0.15, 0.10 and 0.05. The piece for x = 4 is a dashed yellow outline with a question mark.
In context: one new hire in ten stays exactly four years. Note that the answer passes the first characteristic as well; if the known entries had totalled more than one, the missing entry would have come out negative, and that would be evidence that the table itself was wrong.
Check the completed column
Why: add all seven entries, including the one you found; the total must be exactly one.
\[ 0.12 + 0.18 + 0.30 + 0.15 + 0.10 + 0.10 + 0.05 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 264 — Practice 1-2 and 5
Fill the middle
A variable takes the values 0, 1 and 2. You are told the probability of 0 is 0.35 and the probability of 1 is 0.45. Fill in the blanks.
Fill in the blanks
P(2) = 1 - (0.35 + 0.45) = 1 - 0.80 = 0.20
Why: The two known probabilities add to 0.80, and the three must add to one, so the value 2 gets the remaining 0.20. It lies between zero and one, so the completed table is a valid distribution.
This is the attrition calculation in miniature. The bracket collects everything you know; one minus the bracket is everything you do not.
Get into the habit of glancing at the answer before moving on. A missing probability must itself be between zero and one; 0.20 is. If you ever find a negative leftover, stop: the given numbers cannot all be right.
Error analysis
Someone was asked for the probability distribution of Example 4.1 and handed in this, straight from the survey sheet.
Annotate
On: \( P(2) = 23, \quad \sum_x P(x) = 2 + 11 + 23 + 9 + 4 + 1 = 50 \)
The work fails the first characteristic in every row except the zero rows, and the second characteristic as well. Yet it contains all the right information; it is simply on the wrong scale.
\[ P(2) = \frac{23}{50} = 0.46, \qquad \sum_x P(x) = \frac{50}{50} = 1 \]
The quickest detector is the total. If the probability column adds to the sample size, you have a frequency table. If it adds to one, you have relative frequencies, which is what a probability distribution built from data is.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — Example 4.1 gives each P(x) as a count over 50
Section
Part 3
Concept
Every table in this chapter is built the same way, whether the probabilities come from a survey, from equally likely outcomes, or from percentages in a paragraph. Learn the four moves once and you can build any of them.
Figure (svg): Four boxes joined by arrows: 1. Name X, in words, with units; 2. List x, every value X can take; 3. Attach P(x), one probability per value; 4. Check, each in 0 to 1, total 1. Under each box, Nancy's version: the number of days Nancy attends per week; 0, 1, 2, 3; 0.01, 0.04, 0.15, 0.80; the sum equal to 1.
The first move turns a paragraph into a quantity. The second lists what that quantity can be, which fixes the rows. The third fills the probability column, and that is where the source of the numbers matters. The fourth is the two characteristics, run as a check rather than as a definition.
The check is not decoration. It is how you find out that you misread a percentage, forgot a value, or listed an outcome where a value belonged. A table that fails the check is telling you which move to redo.
Where do the probabilities come from? There are three common sources, and you will see each in this Part.
| source of the numbers | how you get P(x) | example |
|---|---|---|
| a description in words | read each percentage and write it as a decimal | Nancy, Jeremiah, Ellen |
| equally likely outcomes | count outcomes giving x, divide by the total | two or three coins |
| a sample of data | count individuals at x, divide by the sample size | Example 4.1, Try It 4.1 |
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 229 — Example 4.2 asks for a table like the one in Example 4.1
Worked example
Nancy has classes three days a week. She attends all three days 80 percent of the time, two days 15 percent of the time, one day 4 percent of the time, and no days 1 percent of the time. One week is chosen at random.
(a) Name the variable
Why: complete the book's sentence with what is counted and the unit of repetition.
\[ X = \text{the number of days Nancy attends class per week} \]
(b) List the values
Why: she has three class days, so she can attend none, one, two or all three.
\[ x = 0,\ 1,\ 2,\ 3 \]
(c) Attach a probability to each value
Why: each percentage becomes a decimal beside its value; the paragraph lists them from the top, so put them in order carefully.
\[ P(0) = 0.01,\ P(1) = 0.04,\ P(2) = 0.15,\ P(3) = 0.80 \]
| x | P(x) |
|---|---|
| 0 | 0.01 |
| 1 | 0.04 |
| 2 | 0.15 |
| 3 | 0.80 |
The paragraph gives the percentages from largest to smallest, three days first, while the table runs from 0 upward. Matching each number to its value, rather than copying them in the order read, is the one place this example can go wrong.
Every entry is between zero and one, which is the first characteristic. The book's last question asks what the P(x) column sums to, and that is the second characteristic, run as a check.
It is worth asking what one would mean if the paragraph had said 80, 15 and 4 percent and stopped. The column would total 0.99, and the missing hundredth would have to be a value not yet listed, here the weeks with no attendance. The sum check would have told you a row was missing.
Check: what does the P(x) column sum to?
Why: every week has exactly one attendance count, so the column must total one, and it does.
\[ 0.01 + 0.04 + 0.15 + 0.80 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, pp. 229-230 — Example 4.2
Picture it
Draw the table and its shape jumps out. One stem for each value of X, each as tall as its probability.
Figure (svg): A stem plot of Example 4.2 over x = 0 to 3 with heights 0.01, 0.04, 0.15 and 0.80.
Four fifths of the probability is piled on three days. The other three stems together make up only one fifth. Nancy is a reliable student, and the picture says so faster than the table does.
Read the picture as a long-run statement. Over many weeks, about 80 in every 100 would see her at all three classes, about 15 at two, about 4 at one, and about 1 at none. A single week can be any of these; the distribution tells you how often each happens.
\[ \text{in 100 weeks: } \approx 1,\ 4,\ 15,\ 80 \text{ weeks at } x = 0,\ 1,\ 2,\ 3 \]
A skewed shape like this is perfectly legal. The two characteristics say nothing about symmetry or spread; they only fix that each stem is between zero and one tall and that all the stems together total one.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Table 4.4
Worked example
Jeremiah has basketball practice two days a week. Ninety percent of the time he attends both, eight percent of the time one, and two percent of the time neither. What is X, what values does it take, and what is the distribution?
Name the variable
Why: a count of practices, per week.
\[ X = \text{the number of practices Jeremiah attends per week} \]
List the values
Why: two practices a week, so the count runs from none to both.
\[ x = 0,\ 1,\ 2 \]
Match each percentage to its value
Why: neither is 0, one is 1, both is 2.
\[ P(0) = 0.02,\ P(1) = 0.08,\ P(2) = 0.90 \]
| x | P(x) |
|---|---|
| 0 | 0.02 |
| 1 | 0.08 |
| 2 | 0.90 |
Only three rows this time, because only two practices are scheduled. The number of rows always comes from the definition of X, never from the number of percentages that happen to appear in the problem.
Words like both and neither are where values hide. Translate each into the count it means before you write any probability.
Put Jeremiah beside Nancy and the pattern of the whole Part appears. The description changes, the number of rows changes, but the four moves are identical: name, list, fill, check. Once you see that, every new paragraph of percentages is the same problem in different clothes.
Check both characteristics
Why: each entry is a legal probability, and the three share out all of the weeks.
\[ 0.02 + 0.08 + 0.90 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Try It 4.2
Worked example
Back to Ellen, whose variable you defined in Part 1: the number of days she practises in a randomly selected week. She practises all three days 85 percent of the time, two days 8 percent, one day 4 percent and no days 3 percent.
Values from the definition
Why: three practice days a week.
\[ x = 0,\ 1,\ 2,\ 3 \]
Fill the column from zero upward
Why: read none, then one day, then two, then all three.
\[ P(0) = 0.03,\ P(1) = 0.04,\ P(2) = 0.08,\ P(3) = 0.85 \]
| x | P(x) |
|---|---|
| 0 | 0.03 |
| 1 | 0.04 |
| 2 | 0.08 |
| 3 | 0.85 |
Compare Ellen with Nancy. Both have three days a week and both usually attend all three, so the two tables have the same rows and a similar shape. What differs is where the small probabilities fall: Ellen misses entire weeks three times as often as Nancy.
\[ P_\text{Ellen}(0) = 0.03 \quad \text{vs} \quad P_\text{Nancy}(0) = 0.01 \]
Practice 12 asks for the other characteristic, given that one of them is the sum. The answer is the range condition: every probability between zero and one inclusive. Ellen's table meets it, since the largest entry is 0.85.
Check the sum
Why: all four weeks' types together must cover every week.
\[ 0.03 + 0.04 + 0.08 + 0.85 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 265 — Practice 10-12
Worked example
Toss two fair coins and let X be the number of heads. This time no percentages are given, so the probabilities have to come from the four equally likely outcomes.
Name the variable
Why: heads in two tosses.
\[ X = \text{the number of heads in two tosses of a fair coin} \]
List the outcomes
Why: each coin is H or T, and the tree multiplies one-half by one-half for each path.
\[ HH,\ HT,\ TH,\ TT \quad \text{each with probability } \tfrac14 \]
Figure (svg): A two-stage tree for tossing two fair coins, each branch labelled H: 1/2 or T: 1/2. The four leaves are HH, HT, TH, TT, each 1/4, with arrows to x = 2, x = 1, x = 1 and x = 0.
Group outcomes by value
Why: HT and TH both have exactly one head, so they go in the same row.
\[ x = 2: HH, \quad x = 1: HT, TH, \quad x = 0: TT \]
Add the probabilities in each group
Why: outcomes in the same row are mutually exclusive, so their probabilities add.
\[ P(1) = \tfrac14 + \tfrac14 = \tfrac12 \]
| x | P(x) |
|---|---|
| 0 | 1/4 = 0.25 |
| 1 | 1/2 = 0.50 |
| 2 | 1/4 = 0.25 |
Three rows, not four. A row in a PDF table is a value of X, and the two mixed outcomes produce the same value. This is exactly the three-coin collapse from Part 1, on a smaller scale.
Adding within a row is the new move here. Whenever several outcomes produce the same value of X, the probability of that value is the sum of their probabilities. You are allowed to add because the outcomes are mutually exclusive: a single toss of two coins cannot be both HT and TH.
Check the total
Why: the three rows must share out all four outcomes.
\[ 0.25 + 0.50 + 0.25 = 1 \]
Trap
Asked for the distribution of the number of heads in two tosses, a common table:
| x | P(x) |
|---|---|
| HH | 1/4 |
| HT | 1/4 |
| TH | 1/4 |
| TT | 1/4 |
Wrong. It passes both characteristics, which is what makes it dangerous, but it is the distribution of the outcome, not of X.
It is tempting because the outcomes are what you listed first, and they really are equally likely.
The left column must hold values of X, the numbers of heads. Two outcomes share the value 1, so their probabilities combine:
| x | P(x) |
|---|---|
| 0 | 1/4 |
| 1 | 1/2 |
| 2 | 1/4 |
\[ P(1) = P(HT) + P(TH) \]
\[ = \tfrac14 + \tfrac14 = \tfrac12 \]
The check that catches this is not the sum; it is reading the left column. If its entries are not numbers, or if two of them are the same number, the table is not yet a distribution of X.
Ranking
Here are the moves for building a PDF table from a description, shuffled. Put them in the order you would do them, first at the top.
Put in order
Order the steps, first to last.
Why: The definition decides the values, the values decide the rows, the rows receive the probabilities, and only a finished column can be checked. Converting to probabilities comes after matching because data arrive as counts or percentages, and each has to be put on the zero-to-one scale.
The order is forced, not a matter of style. You cannot list values for a variable you have not defined, and you cannot check a sum before every row has an entry.
If your check fails, walk the list backwards. A total of fifty points to the conversion step; a total below one points to a missing value in the list; a repeated or non-numeric row points all the way back to the definition.
Worked example
Javier volunteers at community events each month, never more than five. He attends exactly five events 35 percent of the time, four 25 percent, three 20 percent, two 10 percent, one 5 percent, and none 5 percent.
Practice 13: name the variable
Why: a count of events, per month.
\[ X = \text{the number of events Javier volunteers for in a month} \]
Practice 14: list the values
Why: the sentence never more than five sets the ceiling.
\[ x = 0,\ 1,\ 2,\ 3,\ 4,\ 5 \]
Practice 15: fill the column from zero up
Why: the paragraph again runs from the top down, so reverse it.
\[ 0.05,\ 0.05,\ 0.10,\ 0.20,\ 0.25,\ 0.35 \]
| x | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| P(x) | 0.05 | 0.05 | 0.10 | 0.20 | 0.25 | 0.35 |
Six values, six probabilities. Without the phrase never more than five you could not close the list, and the table would have an open-ended row that the data say nothing about.
You will use this table twice more in Part 4 to answer range questions, so it is worth checking it now rather than later.
Before you check, look at the shape. The probabilities climb steadily from 0.05 to 0.35, so Javier's most likely month is the busiest one. A stem plot of this table would rise from left to right, the mirror image of a distribution piled up near zero.
Check the sum
Why: add the six entries in node.
\[ 0.05 + 0.05 + 0.10 + 0.20 + 0.25 + 0.35 = 1.00 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 265 — Practice 13-15
Section
Part 4
Concept
Most questions about a distribution ask about several values at once: at most two days, at least one event, more than one batch. The answer is always the same kind of calculation.
\[ P(X \le 2) = P(0) + P(1) + P(2) \]
You are allowed simply to add, because the values are mutually exclusive: a single week cannot have both one and two attended days. So the addition rule from Chapter 3 applies with nothing to subtract.
Figure (svg): Nancy's stem plot with the stems at 0, 1 and 2 in yellow and the stem at 3 in grey. A label reads P(X ≤ 2) = 0.01 + 0.04 + 0.15 = 0.20.
For Nancy, at most two days collects the three short stems. Their heights add to one fifth, so in about one week in five she misses at least one class.
Why is subtraction never needed here, when the addition rule in Chapter 3 usually subtracts an overlap? Because two different values of X can never happen together, the overlap between any two stems is empty, and there is nothing to take away.
\[ P(X \le 2) = 0.01 + 0.04 + 0.15 = 0.20 \]
This is where the stem picture earns its keep. Colour the stems the question is about, and the answer is the total height of the coloured ones. You can see at a glance whether the answer should be large or small before you add anything.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Table 4.4
Concept
The phrases in range questions are precise, and each one decides whether a boundary value is in or out. Getting one word wrong changes the answer by a whole stem.
Figure (svg): Four number lines over the values 0 to 5. At most 2 fills 0, 1, 2. Fewer than 2 fills 0 and 1. At least 2 fills 2, 3, 4, 5. More than 2 fills 3, 4, 5. A dashed mark sits at 2 on every line.
| words | symbol | includes 2? | values from 0 to 5 |
|---|---|---|---|
| at most 2, no more than 2 | X ≤ 2 | yes | 0, 1, 2 |
| fewer than 2, less than 2 | X < 2 | no | 0, 1 |
| at least 2, no fewer than 2 | X ≥ 2 | yes | 2, 3, 4, 5 |
| more than 2, greater than 2 | X > 2 | no | 3, 4, 5 |
A reliable trick: say the boundary value out loud and ask whether it satisfies the phrase. Is two at most two? Yes, so it is in. Is two fewer than two? No, so it is out. Doing this on every problem takes one second and prevents the most common error in this Part.
Notice that at most 2 and more than 2 are complements: between them they cover every value exactly once. The same is true of fewer than 2 and at least 2. That pairing is what makes the shortcut two slides from now work.
Matching
Javier's variable takes the values 0 to 5. Match each phrase to the set of values it describes.
Match the pairs
Why: Fewer than and more than leave the boundary out; at least and at most keep it in. So fewer than three stops at 2, more than three starts at 4, at least one starts at 1, and at most one stops at 1.
Test the boundary each time. Is three fewer than three? No, so fewer than three is 0, 1 and 2. Is three more than three? Also no, so more than three is 4 and 5 only.
If you mismatched one pair, look at which phrase it was. Mixing up at most and fewer than, or at least and more than, is the single most common source of wrong answers in this Part, and the boundary test is the cure.
Notice that at least one event is five values long, while its complement, no events at all, is a single value. When a range is long and its complement is short, the complement is the faster route, which is the next slide's idea.
Worked example
Use Nancy's table to find the probability that she attends at most two days, and then fewer than two days, in a randomly chosen week.
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| P(x) | 0.01 | 0.04 | 0.15 | 0.80 |
Translate at most two
Why: two is at most two, so it is included.
\[ X \le 2 \iff x = 0,\ 1,\ 2 \]
Add those stems
Why: the values are mutually exclusive, so their probabilities add.
\[ P(X \le 2) = 0.01 + 0.04 + 0.15 = 0.20 \]
Translate fewer than two
Why: two is not fewer than two, so it is left out.
\[ X < 2 \iff x = 0,\ 1 \]
Add those stems
Why: one stem fewer than before.
\[ P(X < 2) = 0.01 + 0.04 = 0.05 \]
In context: in about one week in five Nancy misses at least one class, but in only about one week in twenty does she attend fewer than two. The whole gap between the two answers is the stem at 2, which is 0.15.
Check with the difference of the two answers
Why: the two ranges differ only by the value 2, so their difference must equal P(2) exactly.
\[ 0.20 - 0.05 = 0.15 = P(2) \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Table 4.4
Concept
Because all the stems together total one, any range and its complement add to one. So if a range is long and its complement is short, compute the short one and subtract.
\[ P(X \ge 1) = 1 - P(X = 0) \]
This is the complement rule from Chapter 3, and it works here for a reason you have already seen: at least one and none are mutually exclusive and between them cover every value, so their probabilities make up the whole of one.
Figure (svg): A bar of length 1 cut into Nancy's four probabilities: a thin red sliver 0.01 for x = 0, then green pieces 0.04, 0.15 and 0.80. A bracket over the green part reads at least one day, 0.99; an arrow to the red sliver reads no days, 0.01, so at least one day is 1 minus 0.01.
For Nancy, at least one day is three stems, while none is a single stem. One subtraction beats two additions, and there are fewer chances to drop a digit.
\[ P(X \ge 1) = 1 - 0.01 = 0.99 \]
The shortcut is only as good as the table it uses. If the column does not sum to one, the complement gives a wrong answer silently, which is one more reason to run the sum check before using any table.
Worked example
Find the probability that Nancy attends at least one day in a randomly chosen week. Do it directly, then through the complement, and compare.
Translate at least one
Why: one is at least one, so it is in; the values run up to 3.
\[ X \ge 1 \iff x = 1,\ 2,\ 3 \]
Route 1: add the three stems
Why: the direct sum.
\[ P(X \ge 1) = 0.04 + 0.15 + 0.80 \]
Add
Why: in node.
\[ P(X \ge 1) = 0.99 \]
Route 2: name the complement
Why: the only value not in the range is zero.
\[ P(X \ge 1) = 1 - P(X = 0) \]
Subtract
Why: one stem, one subtraction.
\[ P(X \ge 1) = 1 - 0.01 = 0.99 \]
In context: in 99 weeks out of 100 Nancy makes it to at least one class. The two routes agree because the table satisfies the second characteristic; that agreement is itself a small check on the table.
Check that the two routes agree
Why: the direct sum and the complement must give the same number, and they do.
\[ 0.04 + 0.15 + 0.80 = 0.99 = 1 - 0.01 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Table 4.4
Worked example
With the completed attrition table from Part 2, find the probability that a new hire stays exactly four years, and then five or more years.
| x | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| P(x) | 0.12 | 0.18 | 0.30 | 0.15 | 0.10 | 0.10 | 0.05 |
Practice 2: read one entry
Why: exactly four years is a single stem, the one you found by subtraction.
\[ P(X = 4) = 0.10 \]
Practice 3: translate five or more
Why: five is included, and the values stop at six.
\[ X \ge 5 \iff x = 5,\ 6 \]
Add the two stems
Why: direct is shorter here: two stems in the range against five in the complement.
\[ P(X \ge 5) = 0.10 + 0.05 = 0.15 \]
In context: about 15 percent of new hires stay at least five years. Only the direct route makes sense here, since the complement, four or fewer years, has five stems to add.
Practice 4 asks how long, on average, a new hire stays. That is the expected value, the subject of Section 4.2, and it uses exactly this table.
Check through the complement anyway
Why: the five stems for four or fewer years must total the rest of the probability.
\[ 1 - (0.12 + 0.18 + 0.30 + 0.15 + 0.10) = 1 - 0.85 = 0.15 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 264 — Practice 2-3
Worked example
A baker has worked out how many batches of muffins he sells in a day. Let X be the number of batches sold, with values 1 to 4. Find the probability he sells more than one batch, and exactly one.
| x | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| P(x) | 0.15 | 0.35 | 0.40 | 0.10 |
Practice 6: name the variable
Why: a count of batches, per day.
\[ X = \text{the number of batches of muffins sold in a day} \]
Practice 7: translate more than one
Why: one is not more than one, so it is out.
\[ X > 1 \iff x = 2,\ 3,\ 4 \]
Use the complement
Why: the only value left out is 1.
\[ P(X > 1) = 1 - P(1) = 1 - 0.15 = 0.85 \]
Practice 8: read exactly one
Why: a single stem.
\[ P(X = 1) = 0.15 \]
Figure (svg): The baker's stem plot over x = 1 to 4 with heights 0.15, 0.35, 0.40, 0.10. Stems at 2, 3 and 4 are yellow, the stem at 1 is grey.
Notice the values start at 1, not 0. The baker has observed that he always sells at least one batch, so zero was left out of the table. That is allowed: a value with probability zero may simply be omitted.
Why take the complement here? More than one batch covers three stems, while its complement, exactly one batch, is a single stem. With the complement you read one number and subtract once, and the check below confirms that the direct sum gives the same 0.85.
Check the complement by direct addition
Why: the three highlighted stems must add to 0.85.
\[ 0.35 + 0.40 + 0.10 = 0.85 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, pp. 264-265 — Practice 6-8
Worked example
Using Javier's table from Part 3, find the probability he volunteers for fewer than three events in a month, and for at least one event.
| x | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| P(x) | 0.05 | 0.05 | 0.10 | 0.20 | 0.25 | 0.35 |
Practice 16: translate fewer than three
Why: three is not fewer than three.
\[ X < 3 \iff x = 0,\ 1,\ 2 \]
Add the three short stems
Why: direct is quickest: three stems against three.
\[ P(X < 3) = 0.05 + 0.05 + 0.10 = 0.20 \]
Figure (svg): Javier's stem plot over x = 0 to 5 with heights 0.05, 0.05, 0.10, 0.20, 0.25, 0.35. Stems at 0, 1 and 2 are yellow.
Practice 17: at least one event
Why: the book writes this as more than zero; the complement is the single value 0.
\[ P(X > 0) = 1 - P(0) = 1 - 0.05 = 0.95 \]
In context: one month in five, Javier does fewer than three events; nineteen months in twenty, he does at least one. The book's symbol for at least one, more than zero, is the same set of values as at least one, since there is nothing between 0 and 1.
Compare the two parts. Fewer than three is a short range on the left of the table, so you added directly. At least one is a long range whose complement is a single stem, so you subtracted. The phrase alone does not decide the route; counting the stems does.
Check at least one by the direct sum
Why: the five stems from 1 to 5 must reach 0.95.
\[ 0.05 + 0.10 + 0.20 + 0.25 + 0.35 = 0.95 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 265 — Practice 16-17
Intuition
You now have two routes to any range probability, and they always agree on a valid table. Which to take is a question of effort and of error risk, and it is decided by counting stems before you add anything.
| question (values 0 to 5) | stems in the range | stems in the complement | take |
|---|---|---|---|
| at least 1 | 5 | 1 | complement |
| fewer than 3 | 3 | 3 | either |
| more than 3 | 2 | 4 | direct |
| at most 4 | 5 | 1 | complement |
Each addition is a chance to slip a digit, so the route with fewer stems is usually the safer one. The phrases at least one and at most the largest-but-one almost always favour the complement, because the complement is a single stem.
\[ P(X \le 4) = 1 - P(5) \]
There is a second reason to know both routes: doing the other one is the natural check. If direct and complement disagree, either the arithmetic slipped or the table does not sum to one, and both are worth knowing about before you report an answer.
In the worked examples that follow, each one takes the shorter route and then checks by the longer one. That habit costs a few seconds and turns every range question into a self-checking one.
Estimation
Look back at the newborn stem plot from Part 2: heights 0.04, 0.22, 0.46, 0.18, 0.08 and 0.02 for 0 to 5 wakings. Without adding carefully, estimate the chance that a mother is woken three or more times a week.
Predict first
Roughly what is the probability that X is at least 3?
Correct: about 0.3
Why: The stems at 3, 4 and 5 are 0.18, 0.08 and 0.02 tall. The first is a bit under a fifth and the other two add about a tenth, so the total is near 0.3. Exactly, it is 14 out of 50, which is 0.28.
The skill here is reading heights, not arithmetic. The stem at 3 alone is nearly a fifth, which rules out the smallest option at once. The big stem at 2, almost half of all the mothers, is not included, which rules out the larger options.
\[ P(X \ge 3) = \frac{9 + 4 + 1}{50} = \frac{14}{50} = 0.28 \]
Estimating before computing protects you against the endpoint error. If you had accidentally included the stem at 2, your answer would be 0.74, and a glance at the picture would tell you that is far too much.
Worked example
For the 50 mothers of Example 4.1, find the probability that a randomly selected mother is woken at least twice a week. Use counts, since they are exact, and then convert.
| x | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| count | 2 | 11 | 23 | 9 | 4 | 1 |
Translate at least two
Why: two is included.
\[ X \ge 2 \iff x = 2,\ 3,\ 4,\ 5 \]
Choose the shorter route
Why: four stems in the range, only two in the complement.
\[ P(X \ge 2) = 1 - P(X \le 1) \]
Add the complement's counts
Why: mothers woken fewer than two times.
\[ P(X \le 1) = \frac{2 + 11}{50} = \frac{13}{50} \]
Subtract from one
Why: in fiftieths.
\[ P(X \ge 2) = 1 - \frac{13}{50} = \frac{37}{50} = 0.74 \]
Figure (svg): The Example 4.1 stem plot with the stems at 2, 3, 4 and 5 in yellow and the stems at 0 and 1 in red. Labels read 37 of 50 mothers and 13 of 50 mothers.
In context: about three in four of these mothers were woken at least twice a week after midnight. Because the probabilities came from a sample of 50, this is a statement about the sample, and a new sample would give a somewhat different figure.
Working in counts rather than decimals has a real advantage with survey data: the counts are exact whole numbers, so the check below can be done without any rounding at all, and you convert to a probability only once, at the very end.
Check by counting the yellow stems directly
Why: the mothers at 2 or more must number 37.
\[ 23 + 9 + 4 + 1 = 37, \quad \frac{37}{50} = 0.74 \]
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — Example 4.1
Trap
Asked for the probability that Nancy attends fewer than two days, a common line:
\[ P(X < 2) = P(0) + P(1) + P(2) \]
\[ = 0.01 + 0.04 + 0.15 = 0.20 \]
Wrong. That is the answer to at most two days, a different question.
It is tempting because two is the number in the question, and it feels like it should be in the sum.
Test the boundary: is two fewer than two? No. So the stem at 2 is left out:
\[ P(X < 2) = P(0) + P(1) \]
\[ = 0.01 + 0.04 = 0.05 \]
One stem makes the answer four times bigger. Before adding, write the list of qualifying values in full and check the boundary against the words. That list is the step that catches this.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 230 — Table 4.4
Tweak it
A variable takes the values 0, 1, 2 and 3 with probabilities 0.3, 0.2, an unknown c, and 0.4. The slider sets c. The four stems on the left are the table; the lone stem at 5 is the total of all four.
Parameter explorer
Move c until the total stem at 5 reaches exactly 1. What value of c does that, and what goes wrong for values of c above it?
\[ 0.3 + 0.2 + c + 0.4 = 0.9 + c \quad \text{with } c = {c} \]
The total stem starts at 1.2, too tall. As you lower c it shrinks one for one with the stem at 2, and it lands on the grid line at 1 when c is 0.1. That is the sum condition solved by eye.
\[ 0.9 + c = 1 \implies c = 0.1 \]
Push c higher and the table claims more than all of the outcomes; pull it toward zero and a tenth of the probability goes missing. Only one setting satisfies the second characteristic. And that setting also passes the first, since 0.1 is between zero and one, so the completed table is a genuine distribution.
Notice the flat line at height zero between the spikes. That is the picture of the next Part: between the whole-number values, a discrete variable has no probability at all.
Section
Part 5
Concept
Every picture in this lesson has drawn a distribution as separate vertical stems. That was deliberate. A discrete random variable takes only its listed values, so the probability of any number in between is zero.
\[ P(X = 2.4) = 0 \quad \text{when } X \text{ counts wakings} \]
Figure (svg): Two plots of the Example 4.1 probabilities. Left, green: six separate stems at x = 0 to 5, labelled right. Right, red: the tops of the same stems joined by line segments, labelled wrong, with a hollow yellow point on the line at x = 2.4 marked with a question mark.
On the left, the stems say exactly what the table says and nothing more. On the right, someone joined the tops with line segments. The line looks tidy, but it draws a height above 2.4, as though a mother could be woken two and four-tenths times, and it suggests the probability changes smoothly between values when in fact it jumps.
Joining the dots is a habit carried over from line graphs of data over time, where the points really are connected by what happened in between. Here there is no in between. The values are the only places the variable can land.
So stems are not a style choice. A joined curve is the picture of a continuous variable, where every value in an interval is possible. Using it for counts makes a false claim about which values can occur.
You will meet curves soon enough, in Chapter 5, and there the height means something different: a density rather than a probability. Keeping the two pictures distinct now saves real confusion then.
Concept
Read a stem plot the way you read the table: the position on the horizontal axis is a value x, and the height of the stem is P(x). Nothing more is encoded, not the width of the stem nor the space between stems.
Figure (svg): A stem plot with stems at x = 0, 1, 2, 3 of heights 0.125, 0.375, 0.375, 0.125.
For three coins, the stems at 1 and 2 are each three eighths tall, and the ones at 0 and 3 are one eighth. So the chance of exactly one head is read straight off: 0.375.
\[ P(X = 1) = 0.375 = \tfrac38 \]
That is why the stems add to one: the heights are the probabilities, and the probabilities add to one. It also means a stem can never be taller than 1, since that would be a probability over 1, nor hang below the axis.
Contrast this with a histogram of data in Chapter 2, where bars touch and the area can carry the meaning. A stem has no width to speak of, so only its height counts. When a problem asks you to sketch a discrete PDF, draw stems or thin separated bars, label the axis with the values, and label the heights.
Concept
The collaborative exercise asks each person in a class to toss a coin ten times and record the number of heads. Tabulate the class's results and you get relative frequencies, not probabilities. How do the two connect? Watch them converge.
Figure (svg): A plot over x = 0 to 10 heads. For each x, a thin orange stem shows the relative frequency in a simulated class of 30, a thin cyan stem beside it shows the relative frequency among 1000 simulated people, and a yellow dash marks the long-run probability. The cyan stems sit almost exactly on the yellow dashes; the orange stems scatter around them, reaching 0.367 at x = 5.
With a class of 30, the relative frequencies are ragged: none of the thirty got fewer than three heads, and eleven got exactly five, more than a third of the class. With 1000 people the cyan stems sit almost on top of the yellow long-run heights.
\[ \text{class of 30: } \tfrac{11}{30} \approx 0.367, \quad \text{1000 people: } 0.245, \quad \text{long run: } 0.246 \]
That is the sense in which a PDF built from a survey, like Example 4.1, is an estimate. The relative frequency of each value approaches its true probability as the number of repetitions grows. Section 4.2 names this the Law of Large Numbers.
The simulations here were run once in node with a fixed seed, so the numbers are real draws rather than invented ones. Try the exercise with a real coin, and your class's orange stems will be ragged in a different way, and still add to exactly one.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 228 — Collaborative Exercise, Table 4.1
Comparison
A frequency table, a relative frequency table and a probability distribution all have two columns and look alike on the page. Fill in the blanks to pin down what distinguishes them, using the newborn data where a number is needed.
Comparison matrix
| frequency table | relative frequency table | discrete PDF | |
|---|---|---|---|
| right-hand column adds to | the sample size, 50 | 1 | 1 |
| entry for x = 2 (newborns) | 23 | 0.46 | 0.46, as an estimate |
| each entry lies between | 0 and the sample size | 0 and 1 | 0 and 1 |
| describes | one sample | one sample | the long run |
The first two rows are the conversion you did in the error-analysis slide: divide by the sample size. The relative frequency table and the PDF satisfy the same two characteristics, which is why a relative frequency table is the natural estimate of a distribution.
The difference is in the last row. Relative frequencies describe the sample you happened to draw; a probability distribution describes what happens over many repetitions. Example 4.1's table is a relative frequency table serving as an estimate of the distribution for all such mothers.
Real world
Survey results are often printed as rounded percentages, and the columns frequently add to 99 or 101 percent. A poll of three equally popular answers might print 33, 33 and 33.
Discussion prompt
A report shows three answers at 33 percent each, totalling 99 percent. Is the underlying distribution invalid? What would you check, and what would make you suspect a real error rather than rounding?
This is the second characteristic used as an audit tool. When a published table adds to much less than one, some outcome was dropped; when it adds to much more, some respondents were counted twice, perhaps because they could choose several answers. In that second case the table is not a distribution of a single random variable at all.
So a small rounding gap is fine, a large gap is a finding. Keep the exact fractions when you have them, as the book does in Example 4.1, and the check is exact.
Section
Part 6
Pattern
Every problem in this section, and most of the chapter, follows one routine. The first four steps build the table; the fifth uses it.
| phrase | boundary | route that is usually shorter |
|---|---|---|
| at most k | in | direct if k is small |
| fewer than k | out | direct if k is small |
| at least k | in | complement if k is small |
| more than k | out | complement if k is small |
Two free checks catch most errors. The column adds to one, so a range and its complement add to one; and every answer must lie between zero and one. An answer of 23, or of 1.2, tells you at once that something upstream went wrong.
Check
Test both characteristics on each option before you choose. One passing test is not enough.
Check your understanding
Each table gives the probabilities for x equal to 0, 1, 2 and 3 in that order. Which one is a discrete probability distribution function?
Answer: C
Why: Each entry of that table lies between zero and one, and 0.15 plus 0.25 plus 0.35 plus 0.25 is exactly one, so both characteristics hold.
Run the range test first, because it is quicker: it rules out the table with a negative entry and the table of whole numbers at a glance. Then add what is left.
The table that totals 0.9 is the common trap: nothing looks wrong with any single entry. Only the sum reveals the missing tenth, which is why the sum check is never optional.
Check
Use Ellen's table: 0.03, 0.04, 0.08 and 0.85 for 0 to 3 days. Translate the phrase before you add.
Check your understanding
What is the probability that Ellen practises at least two days in a randomly selected week?
Answer: A
Why: At least two means two or three days, so add those stems: 0.08 plus 0.85 is 0.93. Through the complement, one minus the sum of 0.03 and 0.04 is also 0.93.
Every wrong option here is a correct answer to a different phrase. That is the lesson of Part 4: the arithmetic is trivial, and all the difficulty is in deciding which stems to include.
Writing the qualifying values out as two and three, before any addition, makes the choice obvious. Checking that direct and complement routes agree confirms it.
Check
Homework 69 gives a PDF for the number of years it takes to earn a B.S. degree, with values 3, 4, 5, 6 and 7 and probabilities 0.05, 0.40, 0.30, 0.15 and 0.10.
Check your understanding
The values zero, one and two are not included in this table. What does that mean?
Answer: A
Why: The listed probabilities already add to exactly one, so there is no probability left for any other value. Values that are not listed have probability zero: in this model, nobody earns the degree in under three years.
The deciding fact is the sum. Add the column: 0.05, 0.40, 0.30, 0.15 and 0.10 total exactly one, so the listed values carry all the probability there is.
A model can exclude values that are possible in principle. Someone might finish a degree in two years with enough transfer credit, but this table describes a population where that does not happen, or is rare enough to be rounded away.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, p. 270 — Homework 69
Explain it to yourself
The sum condition is easy to state and easy to apply. Explaining why it must hold is what shows you understand what a distribution is.
Discussion prompt
In two or three sentences, explain why the probabilities in a discrete PDF must add to exactly one. Use the words mutually exclusive in your answer, and say what a total below one would tell you.
A strong answer has two halves: no overlap, so the probabilities can be added with nothing subtracted; and nothing missing, so the total is everything. Each half matches one failure mode, too much and too little.
If your answer only restated the rule, try again with the fifty mothers in mind. Each mother is in exactly one stack; that single fact is the whole explanation.
Exit ticket
Ellen once more: she practises all three days 85 percent of the time, two days 8 percent, one day 4 percent, and none 3 percent.
Discussion prompt
Write her random variable in words, give its PDF table, show it is a discrete PDF, and find the probability that she practises fewer than three days in a randomly selected week, by the shorter route. Finish with one sentence in context.
Fewer than three is 0, 1 and 2: three stems. Its complement, exactly three, is one stem, so subtracting is shorter. Either way the answer is 0.15, which you can confirm by adding 0.03, 0.04 and 0.08.
Every part of the lesson is in this one problem: the definition fixes the values, the two characteristics validate the table, and the boundary test chooses the stems. If any step felt shaky, the matching Part is the one to revisit.
Recap
A random variable turns every outcome into a number; a discrete PDF lists each value it can take with the probability of taking it. Two characteristics make a list a distribution, and one routine answers every question about it.
| idea | in symbols | in words |
|---|---|---|
| random variable | X; its values x | X in words, x a number |
| first characteristic | 0 ≤ P(x) ≤ 1 | every entry is a legal probability |
| second characteristic | Σ P(x) = 1 | the values share out all of the probability |
| range of values | P(X ≤ 2) = P(0) + P(1) + P(2) | add the qualifying stems |
| complement | P(X ≥ 1) = 1 − P(0) | subtract the short side from one |
\[ \text{Nancy: } P(X \le 2) = 0.20, \quad P(X < 2) = 0.05, \quad P(X \ge 1) = 0.99 \]
Draw a discrete distribution as separate stems, because nothing lives between the values, and read each height as a probability. Next, Section 4.2 condenses a whole table into one number, its long-run average or expected value, using exactly the tables you built here.
OpenStax Introductory Statistics 2e, §4.1 Probability Distribution Function (PDF) for a Discrete Random Variable §4.1, pp. 228-230 — Section 4.1
Want this taught 1-on-1? Alexander tutors Statistics — $55/session, free consultation.