Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The student government’s fall fundraiser sets up a table outside the union: a $2 raffle ticket next to it, and the campus coffee cart’s “lucky card” promotion — draw one card from a shuffled deck, win a free drink if it’s a heart. Both games raise the same question a smart customer should ask before playing: what are my actual chances, and what should I expect to walk away with? Last week you learned to read probability as long-run relative frequency and met the complement rule. This week adds two more building-block rules — for combining probabilities with “or” and with “and” — and introduces a new tool, the random variable, that finally lets you answer the second question: not just “will I win?” but “what’s this worth, on average?”

1Combining events with “or”: the addition rule

Every probability lives on the probability scale: a number from 0 (the event never happens) to 1 (it always happens) — you’ll see this written as a decimal or a percent. Recall from last week that the complement of an event AA, written AcA^c, is “AA does not happen,” and P(Ac)=1P(A)P(A^c) = 1 - P(A). This week’s first new idea is combining two events with the word “or.” The union of events AA and BB — written A or BA \text{ or } B — is the event that at least one of them happens.

If AA and BB can never happen on the same outcome, they’re called disjoint (or mutually exclusive), and P(A and B)=0P(A \text{ and } B) = 0. For disjoint events, probabilities simply add:

P(A or B)=P(A)+P(B)(disjoint events)P(A \text{ or } B) = P(A) + P(B) \qquad \text{(disjoint events)}

If AA and BB can happen together, adding P(A)+P(B)P(A)+P(B) double-counts the outcomes where both occur, so the general addition rule subtracts that overlap once:

P(A or B)=P(A)+P(B)P(A and B)P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)

Here P(A and B)P(A \text{ and } B) is the joint probability that both events happen at once.

Worked Example 1 — the coffee cart’s lucky-card game. The cart uses a standard, well-shuffled 52-card deck; a customer draws one card, and every card is equally likely (1/521/52 each). Let AA = “the card is a heart” and BB = “the card is a face card” (jack, queen, or king, in any suit). There are 13 hearts, so P(A)=13/52=0.25P(A) = 13/52 = 0.25. There are 12 face cards, so P(B)=12/520.2308P(B) = 12/52 \approx 0.2308.

Complement. The probability of not drawing a heart: P(Ac)=10.25=0.75P(A^c) = 1 - 0.25 = 0.75 (75%).

Disjoint case. “Heart or spade” — a single card can’t be both suits at once, so these events are disjoint, and P(A and spade)=0P(A \text{ and spade}) = 0:

P(heart or spade)=1352+1352=2652=0.50P(\text{heart or spade}) = \tfrac{13}{52} + \tfrac{13}{52} = \tfrac{26}{52} = 0.50

General case. “Heart or face card” is different — the jack, queen, and king of hearts belong to both events, so P(A and B)=3/520.0577P(A \text{ and } B) = 3/52 \approx 0.0577. Simply adding P(A)+P(B)P(A)+P(B) would count those three cards twice, so the general rule subtracts the overlap:

P(A or B)=1352+1252352=22520.4231P(A \text{ or } B) = \tfrac{13}{52} + \tfrac{12}{52} - \tfrac{3}{52} = \tfrac{22}{52} \approx 0.4231

About 42.3% of draws win at least one prize.

Independence and the multiplication rule. Two events are independent if knowing the outcome of one tells you nothing about the other — like two different customers each drawing from their own separately shuffled deck. For independent events, the probability both happen is the product:

P(A and B)=P(A)×P(B)(independent events)P(A \text{ and } B) = P(A) \times P(B) \qquad \text{(independent events)}

So the probability that two independent customers both draw hearts is 0.25×0.25=0.06250.25 \times 0.25 = 0.0625 (6.25%).

The same rule governs any two independent processes, even something as ordinary as two coin flips. Simulating 1000 pairs of independent fair-coin flips (set.seed(1209)) landed both heads 261 times out of 1000 — an empirical probability of 261/1000=0.261261/1000 = 0.261 — close to the theoretical 0.5×0.5=0.250.5 \times 0.5 = 0.25 the multiplication rule predicts; the small gap is exactly the random noise you’d expect from only 1000 repetitions.

A bar chart of 1000 simulated two-coin-flip repetitions shows three bars -- 0 heads, 1 head, 2 heads -- at heights 243, 496, and 261 out of 1000. The middle bar (exactly one head) is roughly twice as tall as each outer bar, matching the lopsided-in-the-middle shape the multiplication rule predicts for two independent coins.

Figure 1. A bar chart of 1000 simulated two-coin-flip repetitions shows three bars — 0 heads, 1 head, 2 heads — at heights 243, 496, and 261 out of 1000. The middle bar (exactly one head) is roughly twice as tall as each outer bar, matching the lopsided-in-the-middle shape the multiplication rule predicts for two independent coins.

2Random variables and probability distributions

A random variable, usually written XX, assigns a number to the outcome of a random process — dollars won, number of heads, minutes late. A discrete random variable takes on a countable list of specific values (a continuous random variable, coming in two weeks, can take any value in a range). The probability distribution of XX is a table listing every possible value xx alongside P(x)P(x), the probability XX equals that value. Because the table lists every possibility and no two rows overlap, a valid distribution always satisfies P(x)=1\sum P(x) = 1.

Worked Example 2 — the fundraiser raffle. The raffle sells n=500n=500 tickets at $2 each. Prizes: 1 grand prize of $250, 4 prizes of $50, and 20 prizes of $10; the remaining tickets win nothing. Let XX = the dollar amount a randomly selected ticket wins:

xx (dollars won)P(x)P(x)
2501/500 = 0.002
504/500 = 0.008
1020/500 = 0.040
0475/500 = 0.950
Total1.000

The probabilities sum to exactly 1, confirming this is a valid distribution.

Expected value. The expected value of a discrete random variable is the probability-weighted average of its possible values:

E(X)=xP(x)E(X) = \sum x \cdot P(x)

Here \sum means “add up every row,” xx is each possible value, and P(x)P(x) is its probability. E(X)E(X) (also written μ\mu, “mu”) is the long-run average — not what any single ticket wins, but what the average payout per ticket would settle toward if the same raffle ran over and over. Multiplying and adding row by row:

E(X)=250(0.002)+50(0.008)+10(0.040)+0(0.950)=0.50+0.40+0.40+0.00=1.30E(X) = 250(0.002) + 50(0.008) + 10(0.040) + 0(0.950) = 0.50 + 0.40 + 0.40 + 0.00 = 1.30

So E(X)=$1.30E(X) = \$1.30. Since a ticket costs $2, the expected net result of playing is 1.302.00=$0.701.30 - 2.00 = -\$0.70 per ticket — on average, a player loses about 70 cents per ticket, which is exactly the money that funds the student-government fundraiser. No individual ticket ever actually wins $1.30; the number describes the average over many, many tickets.

A probability-distribution bar chart for the raffle has four bars at x = 0, 10, 50, 250; the bar at x = 0 towers to a height of 0.95, while the other three bars are barely visible slivers at 0.04, 0.008, and 0.002 -- a strongly lopsided distribution where “win nothing” dominates, even though the rare big prize is what pulls E(X) up above zero.

Figure 2. A probability-distribution bar chart for the raffle has four bars at x=0,10,50,250x=0,10,50,250; the bar at x=0x=0 towers to a height of 0.95, while the other three bars are barely visible slivers at 0.04, 0.008, and 0.002 — a strongly lopsided distribution where “win nothing” dominates, even though the rare big prize is what pulls E(X)E(X) up above zero.

See it in R.

suppressMessages({library(mosaic); library(BSDA)})

# Worked Example 1: probability rules on a standard 52-card deck
p_heart <- 13/52
p_face  <- 12/52
p_heart_and_face <- 3/52                                   # J, Q, K of hearts
p_heart_or_face  <- p_heart + p_face - p_heart_and_face    # general addition rule
p_heart_or_spade <- 13/52 + 13/52                          # disjoint -> simple addition
p_not_heart <- 1 - p_heart                                 # complement rule
p_heart^2                                                   # multiplication rule, independent

# empirical check of the multiplication rule: 1000 pairs of independent fair coins
set.seed(1209)
sim <- do(1000) * rflip(2)
tally(~ heads, data = sim)
mean(~ (heads == 2), data = sim)     # empirical P(both heads)

# Worked Example 2: raffle distribution table and expected value
x <- c(250, 50, 10, 0)
p <- c(1/500, 4/500, 20/500, 475/500)
sum(p)            # check the distribution sums to 1
sum(x * p)         # E(X)

Running tally(~ heads, data = sim) prints exactly the 243 / 496 / 261 counts behind Figure 1, and sum(x * p) returns 1.3, confirming E(X)=$1.30E(X) = \$1.30 from Example 2.

3Check your understanding

  1. Using last week’s shelter data, P(Large)=67/2400.279P(\text{Large}) = 67/240 \approx 0.279. What is P(not Large)P(\text{not Large}), the probability a randomly chosen intake is not a Large animal? Which rule did you use?

  2. A fair six-sided die is rolled once. Are “rolling a 2” and “rolling a 5” disjoint events? Find P(2 or 5)P(\text{2 or 5}).

  3. Using the coffee cart’s deck (Worked Example 1), find P(diamond or ace)P(\text{diamond or ace}). Are these two events disjoint? Show the general addition rule step you used.

  4. Recall from Week 3’s coffee_sim data that P(Latte)0.313P(\text{Latte}) \approx 0.313 (94 of 300 orders). If two different customers place their orders independently, what is the probability both order a latte?

  5. A small carnival ring-toss game charges to play. Let XX = dollars a player wins, with this distribution:

    xx$5$1−$1
    P(x)P(x)0.100.300.60

    (a) Verify this is a valid probability distribution. (b) Find E(X)E(X) and interpret it in one plain-language sentence.

  6. Worked Example 2 found E(X)=$1.30E(X) = \$1.30 for the raffle, even though no single ticket can actually win exactly $1.30. Explain what E(X)=$1.30E(X) = \$1.30 means, using the phrase “long-run average.”

4Key terms