In Chapters 2 and 3, we built the foundations of probability: sample spaces, events, axioms, conditional probability, and counting. Every calculation started with a sample space S and asked about the probability of some event A⊆S. This framework is powerful, but it has a practical limitation: most real questions are about numbers, not about raw outcomes.
Consider the experiment of rolling two fair dice. The sample space contains 36 ordered pairs: (1,1),(1,2),…,(6,6). But when you play a board game, you don’t care which die showed what — you care about the sum. When a gambler bets on the total, the relevant quantity is a single number between 2 and 12, not a pair of faces.
We need a way to go from outcomes to numbers. That is exactly what a random variable does.
The word “random” can be misleading. A random variable is not a variable in the algebraic sense (like solving 3x+1=7 for x), and it is not random in the colloquial sense of “unpredictable.” It is a function — a deterministic mapping — applied to the outcome of a random experiment. The randomness comes from the experiment, not from the function itself.
Notation convention. Throughout this book, we follow a strict convention:
Uppercase letters (Y, X, Z) denote random variables — the function itself.
Lowercase letters (y, x, z) denote particular values that the random variable might take — specific numbers.
So Y is the random variable “the number of heads when you toss three coins,” and y=2 is one particular value it might take. The expression P(Y=y) reads “the probability that the random variable Y takes the value y.”
In plain terms, a discrete random variable counts things. The number of emails you receive in an hour (0, 1, 2, 3, ...), the number of heads in ten coin tosses (0, 1, 2, ..., 10), the number of defective items in a shipment — all of these are discrete. You can list the possible values, even if the list is infinitely long.
A continuous random variable, by contrast, can take any value in some interval of real numbers. The temperature outside, the time until a light bulb burns out, the exact weight of a bag of flour — these quantities can, in principle, take any value in a continuous range. We will study continuous random variables in Chapter 5. For now, our focus is entirely on discrete random variables.
You might wonder: if a random variable is just a function on the sample space, why bother defining it? Why not just work with events directly?
The answer is power. Once we attach numbers to outcomes, we can:
Compute averages (expected values) — what happens on average in the long run?
Measure spread (variance) — how much variability is there around the average?
Derive formulas — named distributions like the Binomial and Poisson give us powerful shortcuts
Build models — we can describe real-world phenomena with compact mathematical expressions
The rest of this chapter develops all of these ideas. We start by asking: given a discrete random variable Y, how do we describe its probability structure completely?
Before moving to formal definitions, let us see a random variable in action. The following R code simulates the playlist experiment from Example 4.1 ten thousand times and counts how many pop songs appear in each selection.
#| label: rv-simulation
#| fig-cap: "Simulated distribution of Y = number of pop songs in a 3-song selection"
set.seed(42)
n_sim <- 10000
# Library: 4 pop songs (labeled 1) and 6 hip-hop songs (labeled 0)
library_songs <- c(rep(1, 4), rep(0, 6))
# Simulate: select 3 songs without replacement, count pop songs
Y <- replicate(n_sim, sum(sample(library_songs, size = 3, replace = FALSE)))
# Display relative frequencies
table(Y) / n_sim
barplot(table(Y) / n_sim,
main = "Simulated Distribution of Y (10,000 Repetitions)",
xlab = "Number of Pop Songs (Y)",
ylab = "Relative Frequency",
col = "steelblue",
border = "white")
Run this code. You will see that Y=1 is the most common outcome, occurring roughly half the time. In the next section, we will compute these probabilities exactly using probability mass functions — and the simulation will confirm our theory.
4.1.1. A rideshare driver completes trips over the course of a day. On a given day, she might complete 0, 1, 2, ..., or as many as 20 trips. Let Y denote the number of trips she completes.
(a) Is Y a discrete or continuous random variable? Explain.
(b) What is the set of possible values for Y?
(c) Give an example of an event expressed in terms of Y and explain what it means in plain language.
4.1.2. Two students are randomly selected from a study group of 5 computer science majors and 3 mathematics majors. Let X denote the number of mathematics majors selected.
(a) List the possible values of X.
(b) Describe the sample space S and explain how X maps each outcome to a number.
(c) Is this an example of a discrete or continuous random variable?
4.1.3. For each of the following, identify the random variable, state whether it is discrete or continuous, and list its possible values (or describe the range if continuous).
(a) A tech company tests 15 newly manufactured circuit boards and records how many pass quality inspection.
(b) A weather station records the exact amount of rainfall (in inches) during a 24-hour period.
(c) A social media post is shared by followers, and a researcher counts the total number of shares after 48 hours.
(d) A runner records her exact finishing time (in minutes and seconds) for a 5K race.
4.1.4. Consider the experiment of tossing a fair coin three times. The sample space is S={HHH,HHT,HTH,HTT,THH,THT,TTH,TTT}.
(a) Define the random variable Y= the number of heads. List the value of Y for each outcome in S.
(b) Define a different random variable W on the same sample space as follows: W=1 if at least two consecutive tosses show the same face, and W=0 otherwise. List the value of W for each outcome in S.
(c) Find P(Y=2) and P(W=1).
24.2 Probability Mass Functions and Cumulative Distribution Functions¶
Once we have a discrete random variable Y, the most natural question is: for each value y that Y can take, what is P(Y=y)?
The PMF p(y) assigns a probability to each possible value of Y. For values that Y cannot take, we have p(y)=0. The following theorem states the two properties that every valid PMF must satisfy.
Property 1 says that probabilities are between 0 and 1 (they are valid probabilities). Property 2 says that the total probability across all possible values is exactly 1 (something must happen). These two properties are the only requirements. Any function satisfying them is a valid PMF.
The PMF tells us the probability of each individual value. But we often need to answer questions like “what is the probability that Y is at most 3?” or “what is the probability that Y is between 2 and 5?” The cumulative distribution function makes these calculations easy.
The CDF accumulates probability from left to right. At any point y, F(y) tells you the total probability that has “piled up” at or below that value.
Key properties of the CDF:
F is non-decreasing: if a<b, then F(a)≤F(b).
limy→−∞F(y)=0 and limy→∞F(y)=1.
For a discrete random variable, F is a step function — it jumps at each value where p(y)>0 and is flat in between.
The PMF can be recovered from the CDF: p(y)=F(y)−F(y−), where F(y−) is the value of F just to the left of y.
A probability distribution can be represented in three equivalent ways:
A table — lists each value and its probability (best for small, finite distributions).
A formula — gives p(y) as a mathematical expression (best for named distributions like the Binomial).
A probability histogram — a bar graph where the height (or area) of each bar equals the probability. This gives a visual picture of where the probability is concentrated.
For the CDF, the graph is always a staircase (step function), climbing from 0 to 1.
4.2.1. A campus coffee shop tracks the number of espresso drinks ordered in the first 10 minutes after opening. Based on past data, the distribution is:
y
0
1
2
3
4
5
p(y)
0.05
0.15
0.30
0.25
0.15
0.10
(a) Verify that this is a valid PMF.
(b) Find P(Y≥3).
(c) Construct the CDF F(y) and write it as a piecewise function.
(d) Find P(1<Y≤4) using the CDF.
4.2.2. The PMF of a random variable X is given by p(x)=cx2 for x=1,2,3.
(a) Find the value of c.
(b) Find P(X≤2).
(c) Find the CDF F(x).
4.2.3. The CDF of a discrete random variable Y is given by:
(a) What are the possible values of Y?
(b) Find the PMF p(y).
(c) Find P(2<Y≤5).
4.2.4. A small bakery sells custom cakes. The number of cake orders per day, Y, has the following PMF: p(y)=k(5−y) for y=0,1,2,3,4.
(a) Find the value of k.
(b) Find P(Y≥2).
(c) Construct and plot the CDF of Y.
(d) Find the most likely number of orders (the mode).
4.2.5. A random variable X has the PMF p(x)=(1/3)(2/3)x for x=0,1,2,….
(a) Verify that this is a valid PMF. (Hint: geometric series.)
(b) Find P(X≤2).
(c) Find P(X>4).
(d) Write a general formula for the CDF F(x) for non-negative integer values of x.
Before diving in, let us recall some foundational tools.
The formula says: multiply each possible value by its probability, and add up all the products. Values with high probability contribute more to the sum; values with low probability contribute less. The result is a weighted average, where the weights are the probabilities.
3.2Why This Makes Sense: The Frequency Interpretation¶
To see why E(Y)=∑y⋅p(y) is the “long-run average,” suppose we repeat an experiment 1,000,000 times. Consider a random variable Y with the following PMF:
y
0
1
2
p(y)
1/4
1/2
1/4
In 1,000,000 repetitions, we would expect approximately 250,000 observations of Y=0, approximately 500,000 of Y=1, and approximately 250,000 of Y=2. The average of all 1,000,000 observations would be:
#| label: ev-simulation
#| fig-cap: "Simulated long-run average converging to E(Y) = 1.95"
set.seed(123)
y_vals <- 0:4
probs <- c(0.10, 0.25, 0.35, 0.20, 0.10)
true_mean <- sum(y_vals * probs) # 1.95
# Simulate 5000 days
n <- 5000
downloads <- sample(y_vals, size = n, replace = TRUE, prob = probs)
# Running average
running_avg <- cumsum(downloads) / (1:n)
plot(1:n, running_avg, type = "l", col = "steelblue", lwd = 1.5,
main = "Running Average Converging to E(Y)",
xlab = "Number of Days", ylab = "Running Average",
ylim = c(0, 4))
abline(h = true_mean, col = "red", lwd = 2, lty = 2)
legend("topright", legend = c("Running Average", paste0("E(Y) = ", true_mean)),
col = c("steelblue", "red"), lwd = c(1.5, 2), lty = c(1, 2))
This plot illustrates the frequency interpretation: the running average of observed values bounces around early on but settles closer and closer to E(Y)=1.95 as the number of repetitions grows.
(a) Find E(Y).
(b) Find E(1/Y).
(c) Is E(1/Y)=1/E(Y)? What does this tell you about expected values of functions?
4.3.2. A coffee roaster packages beans into bags that are supposed to weigh 12 oz. Due to variation in the filling machine, the number of underweight bags in a random sample of 6 bags has the following distribution:
y (underweight bags)
0
1
2
3
p(y)
0.55
0.30
0.10
0.05
(a) Find the expected number of underweight bags.
(b) If each underweight bag must be repackaged at a cost of $0.75, what is the expected repackaging cost per sample?
4.3.3. A game show contestant spins a wheel with four equally likely outcomes: win $0, win $100, win $500, or win $2000. The contestant must pay an entry fee to play. What is the maximum entry fee that makes this game worth playing (i.e., results in a non-negative expected net gain)?
4.3.4. Verify the expected value from Example 4.9 using R simulation. Generate 100,000 simulated values of Y using the given PMF, compute the sample mean, and compare it to the theoretical expected value of 1.95.
44.4 Expected Value of Functions and Properties of Expectation¶
This theorem is so important that it has a name in the probability literature: the Law of the Unconscious Statistician (LOTUS). The humorous name comes from the fact that students often apply this formula “unconsciously” — without realizing that it is a nontrivial shortcut. The remarkable thing LOTUS tells you is: to find the expected value of g(Y), you do not need to derive the distribution of g(Y) first. Instead, evaluate g at each value of Y, multiply by the probability of that value, and sum. The PMF of Y is all you need. This saves enormous work, and we will use LOTUS constantly throughout this course.
Three fundamental properties of expected value follow directly from the definition. These are tools we will use constantly throughout the rest of this course.
This is intuitive: a constant has no variability, so its “average” is just itself. If you earn exactly $50 every day, your average daily income is $50 — no calculation needed.
In plain language: if every outcome is multiplied by the same constant, the average gets multiplied by that constant too. If each repair costs $40 and you average 3 repairs per day, the average daily repair cost is 40×3=$120.
Why this matters: Linearity is arguably the most useful property in all of probability. It says: the expected value of a sum is the sum of the expected values, always, with no conditions on the functions involved.
Combining Theorems 4.3–4.5, we get a result that is used constantly:
E(aY+b)=aE(Y)+b,
for any constants a and b. The expected value is a linear operator — it passes through addition and scalar multiplication.
Knowing the expected value tells us the center of the distribution, but two distributions can have the same center and very different shapes. Consider two investments:
Investment A returns $5 with probability 1 (guaranteed). E(YA)=5.
Investment B returns $0 with probability 0.5 and $10 with probability 0.5. E(YB)=5.
Both have the same expected value, but Investment B is riskier — its outcomes are spread out. We need a measure of this spread.
The variance measures the average squared distance from the mean. Squaring ensures that deviations above and below the mean both contribute positively. The standard deviation σ has the same units as Y, making it easier to interpret.
Notice that adding a constant b shifts the distribution but does not change the variance — spread is not affected by shifting. Multiplying by a constant a scales the spread by ∣a∣, so the variance scales by a2.
(a) Find E(Y), E(Y2), and V(Y).
(b) Find E(3Y−2) and V(3Y−2).
(c) Find E(Y2−2Y+1). (Hint: note that Y2−2Y+1=(Y−1)2.)
4.4.2. A parking garage charges $5 per hour. The number of hours a randomly selected car stays in the garage, Y, has the distribution:
y (hours)
1
2
3
4
5
p(y)
0.20
0.30
0.25
0.15
0.10
(a) Find the expected parking revenue per car.
(b) Find the variance and standard deviation of parking revenue per car.
(c) The garage has 50 spots. If all spots are occupied by independent cars, what is the expected total revenue from all 50 cars?
4.4.3. A travel agency offers trip insurance that costs $120. The coverage pays out $0, $500, $2,000, or $8,000 depending on the severity of a trip disruption, with probabilities 0.85, 0.08, 0.05, and 0.02, respectively. Find the expected payout and determine whether the insurance is a “good deal” for the buyer (i.e., whether the expected payout exceeds the premium).
4.4.4. Let Y be a random variable with E(Y)=10 and V(Y)=4. Without knowing the distribution of Y, find:
(a) E(2Y+3)
(b) V(2Y+3)
(c) E(Y2)
(d) E[(Y−10)2]
4.4.5. Prove that for any random variable Y with mean μ, E[(Y−a)2] is minimized when a=μ. (Hint: expand (Y−a)2=(Y−μ+μ−a)2 and use properties of expectation.)
Important: The label “success” does not mean “good.” If we are counting defective items, a defective is a “success” in the Binomial sense. It is merely the outcome we are counting.
To find P(Y=y), we count the sample points that result in exactly y successes.
Each outcome of the experiment is an n-tuple of S’s and F’s. A specific n-tuple with y successes and n−y failures — for example, ySS⋯Sn−yFF⋯F — has probability:
yp⋅p⋯p⋅n−yq⋅q⋯q=pyqn−y
by independence. Every n-tuple with exactly y successes has this same probability, regardless of where the successes appear.
How many such n-tuples are there? We must choose which y of the n positions are successes. By the combinations formula from Chapter 2, there are C(n,y)=y!(n−y)!n! ways.
Multiplying the number of n-tuples by the probability of each:
The results are elegant: the mean is np (on average, the fraction p of n trials are successes), and the variance is npq. Notice that the variance is maximized when p=0.5 (maximum uncertainty per trial).
4.5.1. A ride-sharing app shows that 75% of ride requests during rush hour are accepted by drivers within 2 minutes. If 20 ride requests come in during a rush hour window:
(a) What is the probability that exactly 16 are accepted within 2 minutes?
(b) What is the probability that at least 18 are accepted within 2 minutes?
(c) Find the expected number and standard deviation of requests accepted within 2 minutes.
4.5.2. In a manufacturing process, each item independently has a 3% probability of being defective. A batch of 25 items is produced.
(a) Find the probability that the batch contains no defective items.
(b) Find the probability that the batch contains more than 2 defective items.
(c) The manufacturer rejects a batch if it contains 3 or more defectives. What is the probability that a batch is rejected?
4.5.3. A multiple-choice exam has 30 questions, each with 4 options (one correct). A student who guesses on every question can be modeled as a Binomial experiment with p=0.25.
(a) Find the expected number of correct answers.
(b) Find the standard deviation.
(c) Find P(Y≥10) using R (command: 1 - pbinom(9, 30, 0.25)). Would you consider 10 or more correct answers “surprisingly good” for a pure guesser?
4.5.4. A certain genetic marker is present in 15% of a large population. In a sample of 12 randomly selected individuals:
(a) Find P(Y=0), P(Y=1), and P(Y=2).
(b) Find P(Y≥4).
(c) Compute μ and σ.
4.5.5. A basketball player has a free-throw percentage of 80%. She shoots 6 free throws in a game.
(a) Find the probability that she makes all 6.
(b) Find the probability that she misses at most 1.
(c) The player claims she is “in the zone” if she makes at least 5 of 6. What is the probability of this happening even without any hot streak (i.e., purely by chance with p=0.80)?
4.5.6. (Proof exercise) Show that the Binomial PMF sums to 1 by using the Binomial Theorem: (p+q)n=∑y=0nC(n,y)pyqn−y, with q=1−p.
Consider an experiment where independent Bernoulli trials (each with success probability p) are performed sequentially until the first success occurs. Let Y = the trial number on which the first success happens.
For Y=y, we need y−1 failures followed by 1 success:
P(Y=y)=y−1q⋅q⋯q⋅p=qy−1p.
Note on parameterization. Some textbooks (and R) define the Geometric as the number of failures before the first success, so Y starts at 0. We follow the Wackerly convention where Y = the trial number of the first success, so Y starts at 1. When using R’s dgeom and pgeom, adjust accordingly: R’s dgeom(k, p) gives P(X=k) where X = number of failures, so P(Y=y)=dgeom(y-1, p).
The probabilities sum to 1 because this is a geometric series:
Before deriving the mean and variance, let us recall a critical calculus tool that students often forget.
The mean makes intuitive sense: if the probability of success on each trial is p=0.20, then on average you need 1/0.20=5 trials. A lower success probability means a longer expected wait.
The Geometric distribution has a remarkable and counterintuitive property: it has no memory.
P(Y>s+t∣Y>s)=P(Y>t),for all s,t≥0.
In words: given that you have already failed s times, the probability of needing more thant additional trials is the same as if you were starting fresh. The past failures provide no information about how much longer you will wait.
4.6.1. A student tries to log into a university portal, but keeps mistyping the CAPTCHA. Each attempt independently has a 70% chance of success. Let Y be the attempt on which the student first succeeds.
(a) Find P(Y=1), P(Y=2), and P(Y=3).
(b) Find P(Y>5).
(c) Find E(Y) and σ.
4.6.2. A fisherman catches a fish on any given cast with probability 0.10. Casts are independent.
(a) What is the probability that the first fish is caught on the 7th cast?
(b) What is the expected number of casts until the first fish?
(c) If the fisherman has already made 12 unsuccessful casts, what is the probability he catches a fish within the next 3 casts? (Use the memoryless property.)
4.6.3. Suppose Y∼Geom(p).
(a) Show that P(Y>k)=qk for k=0,1,2,….
(b) Use part (a) to derive the CDF F(y)=P(Y≤y)=1−qy for positive integers y.
(c) Find the median of Y — the smallest value m such that F(m)≥0.5.
4.6.4. An online retailer finds that 12% of visitors to a product page make a purchase. If visitors arrive independently, what is the probability that the 1st purchase occurs within the first 5 visitors? What is the probability it takes more than 20 visitors?
We perform independent Bernoulli trials with success probability p until we observe the r-th success. Let Y = the trial number on which the r-th success occurs. For Y=y, we need:
Exactly r−1 successes in the first y−1 trials (so the r-th success has not yet occurred), AND
A success on trial y (completing the r-th success).
The number of ways to arrange r−1 successes in y−1 trials is C(y−1,r−1). The probability of any such arrangement followed by a success is pr−1qy−r⋅p=prqy−r.
Why C(y−1,r−1) and not C(y,r)? Because the r-th success is fixed at position y — it must be the last trial. We are only choosing where the first r−1 successes go among the first y−1 positions. This is the key insight that students often miss.
Relationship to Geometric: When r=1, C(y−1,0)=1 and the Negative Binomial reduces to p(y)=p⋅qy−1, which is exactly the Geometric distribution. The Geometric is a special case of the Negative Binomial.
These results make intuitive sense: waiting for the r-th success takes r times as long on average as waiting for the first, and the total variability scales linearly with r.
R functions for the Negative Binomial: R parameterizes using the number of failures, not the trial number. If Y∼NegBin(r,p) in our notation, then the number of failures is Y−r, and:
4.7.1. A sales representative makes cold calls with a 10% chance of making a sale on each call. She needs to make 4 sales today.
(a) What is the probability that her 4th sale comes on the 20th call?
(b) How many calls should she expect to make?
(c) What is the standard deviation of the number of calls?
4.7.2. In a game, a player rolls a fair die repeatedly until they roll three 6’s. Let Y be the total number of rolls needed.
(a) Find P(Y=5).
(b) Find E(Y).
4.7.3. Show that the Negative Binomial PMF reduces to the Geometric PMF when r=1.
We have a population of N items, of which r are “successes” and N−r are “failures.” We draw a sample of n items without replacement. Let Y = the number of successes in the sample.
The probability of getting exactly y successes is found by counting:
Choose y successes from the r available: C(r,y) ways.
Choose n−y failures from the N−r available: C(N−r,n−y) ways.
Choose any n items from N total: C(N,n) ways.
8.2Mean, Variance, and the Finite Population Correction¶
The mean nr/N is identical to the Binomial mean np with p=r/N — on average, the fraction of successes in the sample matches the fraction in the population.
The variance, however, has an extra factor: N−1N−n, called the finite population correction (FPC). This factor is always less than or equal to 1, so the Hypergeometric variance is always less than or equal to the corresponding Binomial variance npq. Sampling without replacement reduces variability because drawing successes early makes failures more likely later (and vice versa).
When N is much larger than n (say, n<0.05N), the FPC is close to 1, and the Hypergeometric is well approximated by a Binomial with p=r/N. Removing a few items from a huge population barely changes the composition.
4.8.1. A jar contains 15 red marbles and 10 blue marbles. You draw 7 marbles without replacement.
(a) Find P(Y=3), where Y = number of red marbles drawn.
(b) Find E(Y) and V(Y).
(c) If the jar instead contained 1500 red and 1000 blue marbles and you drew 7, compute the Binomial approximation to P(Y=3) and compare to the exact Hypergeometric probability.
4.8.2. A box contains 30 USB drives, 6 of which are defective. An inspector randomly selects 5 drives for testing.
(a) Find the probability that the sample contains exactly 1 defective.
(b) Find the probability that the sample contains no defectives.
(c) Find the probability that the sample contains at least 2 defectives.
4.8.3. A hiring committee reviews 25 applicants, of whom 10 have graduate degrees. They randomly select 8 for interviews. Find the expected number with graduate degrees and the standard deviation. Compare the Hypergeometric standard deviation to the Binomial approximation npq.
4.8.4. (Proof exercise) Show that when N→∞ with r/N=p held constant, the Hypergeometric PMF converges to the Binomial PMF C(n,y)py(1−p)n−y. (Hint: use the fact that C(r,y)/C(N,y)→py as N,r→∞ with r/N→p.)
Events occur independently — one event does not make another more or less likely.
Events occur at a constant average rateλ per interval.
In a sufficiently small sub-interval, at most one event can occur (no simultaneous events).
The probabilities sum to 1 because of the Taylor series for eλ:
y=0∑∞y!λye−λ=e−λy=0∑∞y!λy=e−λ⋅eλ=1.
The elegance of the Poisson: the mean and variance are both equal to λ. If you observe data where the sample mean and sample variance are approximately equal, the Poisson may be a good model.
The Poisson distribution arises as a limit of the Binomial when n is large, p is small, and λ=np remains moderate. Intuitively: if you have many trials, each with a tiny probability of success, the count of successes is approximately Poisson.
Rule of thumb: The Poisson approximation to the Binomial is good when n≥20 and p≤0.05, with λ=np.
4.9.1. A hospital emergency department sees an average of 8 patients per hour overnight. Assume arrivals follow a Poisson process.
(a) Find the probability of exactly 5 arrivals in a given hour.
(b) Find the probability of 12 or more arrivals in an hour.
(c) Find the probability of no arrivals in a 15-minute window.
(d) Find the expected number and standard deviation of arrivals per hour.
4.9.2. The number of typos per page in a 300-page manuscript follows a Poisson distribution with λ=0.8 typos per page.
(a) Find the probability that a randomly selected page has no typos.
(b) Find the probability that a page has 3 or more typos.
(c) In a 5-page section, what is the expected number of typos? What distribution does the total follow?
4.9.3. (Poisson approximation) A large website has 50,000 daily visitors, each with a 0.00004 probability of encountering a critical error.
(a) Identify n and p for the Binomial model.
(b) Compute λ=np and use the Poisson approximation to find P(Y=0), P(Y=1), and P(Y≥3).
4.9.4. Earthquakes of magnitude 6.0 or greater occur in a certain region at an average rate of 2.5 per year. Assuming a Poisson process:
(a) Find the probability of no such earthquakes in a given year.
(b) Find the probability of 5 or more in a given year.
(c) Find the probability of no such earthquakes in a 6-month period.
4.9.5. (Proof exercise) Show that for the Poisson distribution, E[Y(Y−1)]=λ2, and use this to confirm that V(Y)=λ.
In particular, μ1′=E(Y)=μ (the mean), and μ2=V(Y)=σ2 (the variance). Higher moments capture other features of the distribution: the third central moment relates to skewness (asymmetry), and the fourth to kurtosis (tail heaviness).
Before proving Tchebysheff’s theorem, we establish a simpler but more general result that it builds on.
Why Markov matters: It says a non-negative random variable cannot frequently be much larger than its mean. For example, if E(Y)=10, then P(Y≥100)≤10/100=0.10. The bound is often loose, but it works with only the mean — no variance needed.
From Markov to Tchebysheff: Tchebysheff’s theorem is simply Markov’s inequality applied to the non-negative random variable (Y−μ)2 with a=k2σ2. This gives us the tighter bound that uses variance information.
What this says in plain language: At least 1−1/k2 of the probability lies within k standard deviations of the mean.
k
At least this fraction is within μ±kσ
2
1−1/4=75%
3
1−1/9≈88.9%
4
1−1/16=93.75%
5
1−1/25=96%
Two critical observations:
It works for any distribution. No assumptions about shape, symmetry, or named families. This is its power.
It is conservative. For most distributions, the actual probability within μ±2σ is much higher than 75%. For a normal distribution, it is 95.4%. Tchebysheff gives a guaranteed floor, not an exact answer.
4.11.1. A random variable Y has mean μ=25 and standard deviation σ=4.
(a) Use Tchebysheff’s theorem to find a lower bound for P(17<Y<33).
(b) Find the value C such that P(∣Y−25∣≥C)≤0.01.
4.11.2. The number of daily transactions at an ATM has μ=120 and σ=18, with unknown distribution. The bank wants at least 90% of days to fall within the staffing plan’s capacity range. What range (centered at μ) guarantees this?
4.11.3.Y∼Bin(100,0.5), so μ=50 and σ=5. Use Tchebysheff to find a lower bound for P(40<Y<60). Then compute the exact probability using R (pbinom(59, 100, 0.5) - pbinom(40, 100, 0.5)) and compare. How conservative is the bound?
This section is optional enrichment. It provides the formal proof that the Poisson distribution arises as a limit of the Binomial. Your instructor may choose to skip this section.
Why this matters: This theorem explains where the Poisson distribution comes from. When you have many opportunities for a rare event (large n, small p), the Poisson emerges naturally. This is why it shows up in so many seemingly unrelated contexts — typos, radioactive decay, server requests, disease cases — all are situations with many “trials” and small individual probabilities.
This section is optional enrichment. It showcases three classic probability problems that illustrate the power of expected value and indicator random variables. Your instructor may assign selected problems or skip this section entirely.
A professor returns n exams to n students completely at random. What is the expected number of students who receive their own exam?
Solution using indicator variables. Let Ij=1 if student j gets their own exam, and Ij=0 otherwise. The total number of matches is Y=I1+I2+⋯+In.
Each student has a 1/n chance of getting their own exam: E(Ij)=1/n.
By linearity of expectation (even though the Ij’s are dependent!):
E(Y)=E(I1)+E(I2)+⋯+E(In)=n⋅n1=1.
The surprising result: No matter how many students there are — 5 or 500 or 5 million — the expected number of matches is always exactly 1. Furthermore, for large n, the number of matches is approximately Pois(1), so the probability of zero matches approaches e−1≈0.368.
A cereal company puts one of n different toy figurines in each box, chosen uniformly at random. How many boxes must you buy, on average, to collect all n figurines?
Solution using Geometric decomposition. After collecting k distinct figurines, the probability that the next box contains a new one is pk=(n−k)/n. The number of additional boxes needed to get the next new figurine is Geom(pk) with mean n/(n−k).
The total number of boxes is T=T0+T1+⋯+Tn−1 where Tk∼Geom((n−k)/n).
A casino offers this game: flip a fair coin repeatedly until the first heads appears on toss k. You win 2k dollars. How much should you pay to play?
Expected value calculation:Y = winnings. P(Y=2k)=(1/2)k for k=1,2,3,…
E(Y)=k=1∑∞2k⋅(21)k=k=1∑∞1=∞.
The expected value is infinite! By naive expected-value reasoning, you should be willing to pay any finite amount to play. Yet no rational person would pay even $100.
Why this matters: The St. Petersburg Paradox shows that expected value alone does not capture everything about a decision. It motivated Daniel Bernoulli to propose expected utility (using E[log(wealth)] instead of E[wealth]) — one of the foundational ideas of economics and decision theory. It is a powerful reminder that while expected value is an essential tool, it has limits.
This chapter introduced discrete random variables — functions that assign numerical values to the outcomes of random experiments — and developed the complete toolkit for describing their probability behavior.
Key takeaways:
A random variable is a function from the sample space to the real numbers. It translates outcomes into numbers we can compute with.
The probability mass function (PMF) p(y)=P(Y=y) provides the probability of each value. The cumulative distribution function (CDF) F(y)=P(Y≤y) accumulates probabilities from left to right.
The expected valueE(Y)=∑y⋅p(y) is the long-run average — the center of gravity of the distribution. More generally, E[g(Y)]=∑g(y)⋅p(y).
The varianceV(Y)=E(Y2)−[E(Y)]2 measures spread. The standard deviation σ=V(Y) has the same units as Y.
Five named distributions capture common experimental patterns. The distribution you choose depends on the story of the experiment:
Distribution
The Story
PMF
E(Y)
V(Y)
Bernoulli(p)
Single trial, two outcomes
pyq1−y
p
pq
Binomial(n,p)
n trials, count successes
C(n,y)pyqn−y
np
npq
Geometric(p)
Trials until 1st success
qy−1p
1/p
q/p2
Neg. Binomial(r,p)
Trials until r-th success
C(y−1,r−1)prqy−r
r/p
rq/p2
Hypergeometric(N,r,n)
n draws without replacement
C(N,n)C(r,y)C(N−r,n−y)
nr/N
nNrNN−rN−1N−n
Poisson(λ)
Events in a fixed interval
y!λye−λ
λ
λ
Moment-generating functionsm(t)=E(etY) uniquely determine distributions and generate moments via μk′=m(k)(0).
Tchebysheff’s theorem provides universal probability bounds: at least 1−1/k2 of the probability is within k standard deviations of the mean, for any distribution.
Note: R parameterizes the Geometric and Negative Binomial by the number of failures, not the trial number. Adjust accordingly (see the notes in Sections 4.6 and 4.7).
The following problems span the entire chapter. They are designed to test your ability to identify the correct distribution, compute by hand, verify in R, and interpret results in context.
4.R.1. A campus IT department records the number of help desk tickets submitted per hour. The distribution is:
y
0
1
2
3
4
5
p(y)
0.08
0.18
0.28
0.22
0.14
0.10
(a) Find E(Y), E(Y2), V(Y), and σ.
(b) Each ticket takes an average of 15 minutes to resolve. Find the expected total resolution time per hour and its standard deviation.
(c) Use Tchebysheff’s theorem to find an interval that contains at least 75% of hourly ticket counts.
4.R.2. A pharmaceutical company tests a new antibiotic. Each patient independently has a 65% probability of showing significant improvement. Fifteen patients are enrolled in the trial.
(a) What distribution does Y (the number who improve) follow? State the parameters.
(b) Find P(Y=10) and P(Y≥12).
(c) Find the expected number who improve and the standard deviation.
(d) If fewer than 8 patients improve, the drug is deemed ineffective. Find this probability.
4.R.3. A venture capital firm reviews startup pitches. Each pitch independently has a 12% chance of receiving funding. The firm reviews pitches until it funds its 3rd startup.
(a) What distribution does Y (the number of pitches reviewed) follow?
(b) Find the expected number of pitches and the standard deviation.
(c) Find the probability that the 3rd funded startup is found on exactly the 15th pitch.
4.R.4. A box contains 40 light bulbs, 8 of which are defective. An inspector randomly selects 6 bulbs for testing.
(a) What distribution does Y (the number of defectives in the sample) follow? Why not Binomial?
(b) Find P(Y=0), P(Y=1), and P(Y≥3).
(c) Find E(Y) and V(Y). Compare the Hypergeometric variance to the Binomial approximation npq with p=8/40.
4.R.5. A regional earthquake monitoring station records an average of 3.2 earthquakes of magnitude 4.0+ per month.
(a) What distribution is appropriate? State the parameter.
(b) Find the probability of exactly 5 earthquakes in a given month.
(c) Find the probability of no earthquakes in a 2-week period.
(d) Find the probability of 8 or more earthquakes in a 2-month period.
4.R.6. A random variable X has MGF m(t)=e7(et−1).
(a) Identify the distribution of X.
(b) Find E(X) and V(X) directly from the distribution.
(c) Verify E(X) by computing m′(0).
4.R.7. An online retailer finds that 8% of packages are delivered late. In a random sample of 30 packages:
(a) Find the probability that exactly 3 are delivered late.
(b) Find the probability that fewer than 2 are delivered late.
(c) Use the Poisson approximation (with λ=np) to approximate P(Y=3) and compare to the exact Binomial answer from part (a).
4.R.8. A student has a 0.40 probability of scoring a bullseye on each dart throw. Throws are independent.
(a) What is the probability that the student’s first bullseye comes on the 5th throw?
(b) What is the expected number of throws until the first bullseye?
(c) Given that the first 3 throws were not bullseyes, what is the probability that the first bullseye comes on throw 6 or later? (Use the memoryless property.)
4.R.9. A random variable Y has mean 50 and standard deviation 6, but its distribution is unknown.
(a) Use Tchebysheff’s theorem to bound P(38<Y<62).
(b) Find C such that P(∣Y−50∣≥C)≤0.05.
(c) If you later learn that Y is approximately normally distributed, how does your answer to (a) change?
4.R.10. (Distribution identification) For each scenario below, identify the appropriate distribution and state its parameters. Do not compute probabilities — just identify and justify.
(a) A roulette wheel has 38 slots (18 red, 18 black, 2 green). A gambler bets on red 20 times. Y = number of wins.
(b) A committee of 5 is randomly selected from a group of 10 men and 8 women. Y = number of women on the committee.
(c) A website receives an average of 200 hits per minute. Y = number of hits in a 30-second window.
(d) A telemarketer calls potential customers. Each call independently has a 3% success rate. Y = the call number on which the 2nd sale occurs.
(e) A student retakes a certification exam repeatedly until passing. Each attempt has a 55% pass rate. Y = the attempt on which the student first passes.
4.R.11. (Proof) Let Y be a discrete random variable with E(Y)=μ and V(Y)=σ2. Prove that E[(Y−a)2] is minimized when a=μ. Interpret this result in plain language.
4.R.12. (Comprehensive R exercise) Using R, generate 100,000 simulated values from each of the following distributions. For each, compute the sample mean and sample variance and compare to the theoretical values.
(a) Bin(20,0.35)
(b) Pois(7.5)
(c) Geom(0.15)
Provide your R code and a brief summary of what you observe.