Discrete Probability

Learn to calculate probabilities in finite and countably infinite sample spaces, from card hands and the birthday problem to conditional probability, independence and Bayes' theorem. Work with random variables and the uniform, Bernoulli, binomial and geometric distributions, find expected values quickly with linearity of expectation, and measure spread with variance. Bound unlikely outcomes with Markov's and Chebyshev's inequalities and the Chernoff bound, then apply these tools to randomized algorithms, hashing and quicksort.

BeginnerLesson 9 of 10 in Discrete Mathematics Course

What you will learn

  1. Describe a random experiment by its outcomes, events and probability function, then calculate event probabilities with the basic rules and with counting.
    • Set up a sample space and assign probabilities
      Identify the outcomes of an experiment, write events as sets of outcomes, and check that a probability function is valid, for equally likely and for countably infinite sample spaces.
    • Combine events with the rules of probability
      Use the complement rule, the addition rule and inclusion–exclusion to find probabilities of combined events, and bound the probability of a union with the union bound.
    • Count equally likely outcomes to find probabilities
      Compute probabilities in uniform sample spaces with permutations and combinations, including card hands, sampling with and without replacement, and the birthday problem.
  2. Update probabilities when new information arrives, decide whether events are independent, and reverse a conditional probability with Bayes' theorem.
    • Calculate and interpret conditional probabilities
      Compute the probability of an event given another, build products along a tree with the multiplication rule, and split a problem into cases with the law of total probability.
    • Decide whether events are independent
      Test events for independence with the product rule, tell independence apart from disjointness, and use mutual independence for repeated trials.
    • Update beliefs with Bayes' theorem
      Use Bayes' theorem with the law of total probability to turn the probability of evidence given a cause into the probability of the cause given the evidence, as in medical tests and spam filters.
  3. Represent numerical results of experiments as random variables, describe them by their distributions, and recognize the uniform, Bernoulli, binomial and geometric distributions.
    • Define random variables and their distributions
      Treat a random variable as a function on the sample space, find its probability mass function and cumulative distribution function, and decide whether two random variables are independent.
    • Recognize and use common discrete distributions
      Choose and apply the uniform, Bernoulli, binomial and geometric distributions, checking the conditions each one needs.
  4. Calculate and interpret the expected value of a discrete random variable, and find expectations of counts quickly with linearity of expectation and indicator variables.
    • Calculate and interpret expected values
      Compute expected values from a distribution, of functions of a random variable and by conditioning, and interpret them as long-run averages.
    • Use linearity of expectation and indicator variables
      Find expected counts by writing a random variable as a sum of indicators, without working out its distribution, and know where linearity does and does not apply.
  5. Quantify how far a random variable tends to fall from its mean, and bound the probability of large deviations with Markov's, Chebyshev's and Chernoff's inequalities.
    • Calculate variance and standard deviation
      Compute variance and standard deviation, use the rules for shifted, scaled and summed random variables, and apply the standard results for common distributions.
    • Bound the probability of large deviations
      Use Markov's and Chebyshev's inequalities and the Chernoff bound to guarantee that large deviations are unlikely, check the conditions of each, and derive the weak law of large numbers.
  6. Analyze randomized algorithms, control their error probability, and use expectation, indicators and the probabilistic method to study algorithms and data structures.
    • Analyze randomized algorithms and their error
      Distinguish Las Vegas from Monte Carlo algorithms, reduce one-sided error by repetition, and bound running times and failure probabilities.
    • Use expectation and indicators to analyze algorithms and data structures
      Derive the expected number of comparisons in randomized quicksort, analyze collisions in hashing, and prove that objects exist with the probabilistic method.

Discrete Probability study guide

6 chapters

1

Build a probability model

A probability calculation begins with a precise description of what can happen. Outcomes give the detail; events collect the outcomes that answer a question. You will assign probabilities, combine events, and use counting to calculate chances in card hands and repeated draws. The main modeling choice is how to describe one outcome: that choice controls both what you count and whether those outcomes are equally likely.

1.1 Describe outcomes and assign their probabilities

Start with one complete result

An experiment is a random process with a well-defined set of possible results. One complete result is an outcome. The sample space S contains all outcomes: exactly one occurs on each run. For two die rolls, an outcome can be the ordered pair (2,5), meaning 2 first and 5 second. The reversed pair describes another outcome.

An event is a subset of the sample space. For one roll, the event “even” is E={2,4,6}. The event occurs when the outcome belongs to that set. The empty set is impossible; the whole sample space is certain.

Set notation describes combined events. The union A∪B means “A or B, or both”; the intersection A∩B means “A and B.” The complement A‾=S∖A means “not A,” and A∖B means “A but not B.” Disjoint events have no outcome in common.

Give each outcome a weight

A probability function assigns a nonnegative probability to each outcome, with total 1:

∑s∈SP(s)=1,P(E)=∑s∈EP(s).

Thus every event probability lies between 0 and 1, with P(S)=1 and P(∅)=0. The notations Pr⁡[E] and p(E) are also used for event probabilities.

For a finite sample space of equally likely outcomes, every outcome has probability 1/∣S∣, giving P(E)=∣E∣/∣S∣. A fair die supports this model. A loaded die requires different outcome weights.

Two independent fair dice give 36 equally likely ordered pairs. Six pairs have sum 7, so that event has probability 6/36=1/6. Only (1,1) has sum 2, giving probability 1/36. The eleven possible sums are therefore not equally likely. Likewise, the unordered result “a 1 and a 2” collects two pairs, while “two 1s” collects only one.

Build a tree when the process has stages

Draw a branch for each possible next result and label it with its probability at that stage. A leaf represents a complete outcome. Multiply branch probabilities along a path to get its weight, then add the weights of leaves in the event. This separates two jobs that are easy to mix up: multiplying to describe one path and adding to collect alternative paths.

Allow infinitely many possible stopping times

Flip a fair coin until the first head. The terminating outcomes are H,TH,TTH,…. The probability of the first head on flip k is 2−k, and the geometric series sums to 1. The event “first head on an even flip” has probability

14+116+164+⋯=1/41−1/4=13.

These outcomes can be listed, so the space is countably infinite. They cannot all receive the same probability: a common positive weight would make the sum diverge, while a common zero weight would make it zero.

Key Takeaways

  • An event is a set of outcomes; an outcome is one complete result.
  • Outcome probabilities are nonnegative and sum to 1; add them to find an event probability.
  • Use P(E)=∣E∣/∣S∣ only for a finite space with equally likely outcomes.
  • Multiply along a tree path and add across the event’s leaves.
  • A countably infinite space cannot assign equal probability to every outcome.

1.2 Combine events without double counting

Use the complement for “at least one”

An event and its complement split the sample space, so P(A‾)=1−P(A). If the event is “at least one failure,” its complement is “no failures.” This can replace a long list of possible failure counts with one calculation.

For two independent fair die rolls, the probability of no six is (5/6)2. Therefore the probability of at least one six is 1−25/36=11/36. Adding 1/6+1/6 gives too much because it includes the outcome with two sixes twice.

Subtract the overlap once

The addition rule is

P(A∪B)=P(A)+P(B)−P(A∩B).

The two single probabilities each include their shared outcomes. Subtracting one copy leaves each outcome in the union counted once. If the events are disjoint, the intersection is empty and the probabilities simply add.

Draw one card from a standard deck with 52 distinct cards, 13 in each suit and four of each rank. Let the event be “a heart or a king.” There are 13 hearts, four kings and one king of hearts. Thus

P(heart or king)=13+4−152=413.

For “A but not B,” keep only the part of A outside the intersection:

P(A∖B)=P(A)−P(A∩B).

For example, “a heart but not a king” has probability 12/52. This is a different question from “a heart or a king.”

Track three-way overlap

For three events, inclusion–exclusion gives

P(A∪B∪C)=P(A)+P(B)+P(C)−P(A∩B)−P(A∩C)−P(B∩C)+P(A∩B∩C).

An outcome in all three events was added three times and subtracted three times. Adding its triple intersection restores one copy. The same alternating pattern continues for more events.

Choose an integer uniformly from 1 through 100. The counts divisible by 2, 3 and 5 are 50, 33 and 20. Their pairwise intersections contain 16, 10 and 6 numbers, and the triple intersection contains 3. The count divisible by at least one is 50+33+20−16−10−6+3=74, giving probability 0.74.

Bound a union when overlaps are unknown

The union bound drops all overlap corrections:

P(A1∪⋯∪An)≤∑i=1nP(Ai).

It holds for any events and needs no independence. If ten components each fail with probability at most 0.001, the chance of some failure is at most 0.01. This is an upper limit; it need not equal the true chance. If the sum exceeds 1, replace it by the trivial upper limit 1.

Set containment provides quick checks. If A⊆B, then P(A)≤P(B). In particular, an intersection cannot be more likely than either event, and a union cannot be less likely than either event. These checks catch errors such as reporting a probability of “both” that exceeds the probability of A alone.

Key Takeaways

  • P(A‾)=1−P(A) often makes “at least one” calculations shorter.
  • The addition rule subtracts the intersection once.
  • Three-event inclusion–exclusion adds back the triple intersection.
  • The union bound is an upper limit that needs no independence.

1.3 Count the event and the sample space consistently

Choose an ordered or unordered model

In a uniform sample space, probability is a ratio of counts. The numerator and denominator must describe outcomes in the same way. For k ordered draws from n equally likely items, replacement gives nk sequences. Without replacement there are n(n−1)⋯(n−k+1) sequences. If order is ignored, sampling without replacement gives (nk) subsets.

For two draws from six distinct items, each unordered pair has two possible orders. Dividing both counts by the same factor leaves the probability unchanged. Counting an ordered event over an unordered sample space leaves that factor in only the numerator and gives a wrong probability.

Count a hand by its parts

A five-card hand is an unordered five-element subset of a standard 52-card deck. There are (525)=2,598,960 hands. To get exactly two aces, choose two of the four aces and three of the 48 non-aces:

P(exactly two aces)=(42)(483)(525)=103,7762,598,960≈0.0399.

The word “exactly” matters: choosing the other three cards from all 52 would allow extra aces and repeated cards. Choosing the two aces in 4⋅3 ways would also count each selected pair twice.

A full house has three cards of one rank and two of another. Choose the triple’s rank in 13 ways and its suits in (43) ways. Choose a different pair rank in 12 ways and its suits in (42) ways. The count is

13(43) 12(42)=3,744.

Dividing by the number of hands gives about 0.00144. The ranks play different roles, so choosing an unordered pair of ranks without assigning those roles would lose a factor of 2.

Count what does not happen

In four independent fair die rolls there are 64=1,296 equally likely sequences. Exactly 54=625 avoid a six. Therefore

P(at least one six)=1,296−6251,296=6711,296≈0.518.

This avoids separately counting one, two, three and four sixes.

Compare any birthday match with a match to one person

Model birthdays as independent and uniform across 365 days, leaving out February 29. For n≤365 people, the first birthday is unrestricted, the next must avoid one day, the next must avoid two, and so on. Hence

P(all different)=∏i=0n−1365−i365.

Subtract this from 1 to find a shared birthday. The chance is about 0.507 for 23 people and 0.970 for 50. For more than 365 people, a match is certain in this model.

A different event is “someone shares my birthday.” Among 22 other people its probability is 1−(364/365)22≈0.059. A group of 23 contains 253 pairs, and any pair can provide a match; requiring a match with one specified person is much narrower.

Key Takeaways

  • Both counts in a probability ratio must use the same ordering convention.
  • Sampling without replacement uses distinct items and changing available choices.
  • “Exactly” restricts both selected target items and the remaining items.
  • Assign different roles when counting a triple rank and a pair rank.
  • Count “none” and subtract from 1 for many “at least one” events.
  • Any pair sharing a birthday differs from matching one specified person.
2

Use new information to update probabilities

New information changes which outcomes remain relevant. Conditioning gives that change a precise meaning, and tree diagrams keep the order of events visible. You will test when information leaves a probability unchanged, distinguish pairwise from mutual independence, and use Bayes’ theorem to reason backward from evidence to a possible cause. Examples include sampling, reliability, diagnostic tests, and message filtering.

2.1 Condition on an event and split into cases

Restrict the space, then rescale

The conditional probability of A given B is

P(A∣B)=P(A∩B)P(B),P(B)>0.

Keep the outcomes in B and measure what fraction of their probability lies in A. Conditioning on an event of probability zero leaves this ratio undefined. Within a fixed positive-probability condition, the usual rules still work; for example, P(A‾∣B)=1−P(A∣B).

Suppose two fair coin flips contain at least one head. Of the four equally likely ordered outcomes, only HH, HT and TH remain. The chance of two heads is therefore 1/3. If instead the first flip is known to be heads, only HH and HT remain, giving 1/2. Precise information determines the denominator.

Multiply along a path

Rearranging the definition gives the multiplication rule:

P(A∩B)=P(A)P(B∣A).

Draw two cards without replacement. The chance of an ace first is 4/52. After that ace, three aces remain among 51 cards, so

P(two aces)=452351=1221.

For a third event, multiply by its probability given both preceding events. A tree’s later branches carry these conditional probabilities. Using the original denominator at every branch would model replacement instead.

Add over a partition

A partition consists of disjoint cases that exhaust the sample space. If the cases Bi all have positive probability, the law of total probability says

P(A)=∑iP(Bi)P(A∣Bi).

Machine 1 makes 60% of a factory’s chips with a 2% defect rate; machine 2 makes 40% with a 5% defect rate. A randomly selected chip is defective with probability 0.6(0.02)+0.4(0.05)=0.032. The rates are weighted by output shares, so taking their simple average would give the wrong answer.

Follow the information-producing process

In the Monty Hall problem, one of three doors hides a car. After your initial choice, a host who knows the location always opens another door hiding a goat and offers a switch. Switching wins exactly when your original choice was wrong. That happens with probability 2/3; staying wins with probability 1/3. The host’s action is governed by a rule, so two unopened doors need not have equal winning chances.

Keep subgroup weights visible

Simpson’s paradox is a reversal between subgroup comparisons and the pooled comparison. Here is a numerical illustration using easy and hard jobs:

MethodEasy jobs passedHard jobs passedAll jobs passed
A9/1036/9045/100
B72/903/1075/100

A has the higher pass rate in both groups: 90% versus 80%, and 40% versus 30%. B has the higher pooled rate because it receives many more easy jobs. Report a rate with its condition and compare how the cases are distributed.

Key Takeaways

  • Conditioning keeps the given event and rescales its probability to 1.
  • Use P(A∩B)=P(A)P(B∣A) to multiply dependent stages.
  • Total probability weights each case’s rate by its probability.
  • The rule producing information matters in Monty Hall.
  • Different subgroup weights can reverse a pooled comparison.

2.2 Test independence and distinguish it from disjointness

Use the product test

Events A and B are independent exactly when

P(A∩B)=P(A)P(B).

For P(B)>0 this is equivalent to P(A∣B)=P(A): learning B gives no change in the chance of A. The product form also handles probability-zero events, which are independent of every event.

Independence can occur between events about the same experiment. On a fair die, let A mean “even” and B mean “at most 4.” Their probabilities are 1/2 and 2/3; their intersection is {2,4}, with probability 1/3. The product is also 1/3, so the events are independent.

Do not confuse “no overlap” with “no change”
RelationshipWhat it saysConsequence
DisjointThe events have no shared outcomes.If one occurs, the other cannot occur.
IndependentThe intersection probability equals the product.Learning one leaves the other’s chance unchanged.

Two disjoint events of positive probability are dependent: their intersection probability is zero but the product is positive. For example, “roll a 1” and “roll a 6” cannot occur together. Independence would give a positive chance to both.

If A and B are independent, complementing either or both preserves independence. To see one case, subtract the intersection from A:

P(A∩B‾)=P(A)−P(A∩B)=P(A)(1−P(B)).
Check more than pairs for a collection

Pairwise independence checks every pair. Mutual independence checks the product rule for every subcollection, including triples and larger groups.

Flip two independent fair coins. Let A be “first is heads,” B be “second is heads,” and C be “the coins match.” Each event has probability 1/2. Every pair occurs together with probability 1/4, so the events are pairwise independent. But all three occur only for HH:

P(A∩B∩C)=1/4≠(1/2)3.

The three events are not mutually independent. Knowing both coin results determines whether they match, even though either result alone leaves the matching chance unchanged.

Apply independence to repeated trials

Three servers are each up with probability 0.9, mutually independently. The chance all are down is 0.13=0.001, so the chance at least one is up is 0.999. A shared power supply can make simultaneous failures more common than that product predicts. Dependence alone does not determine the direction of the difference; the joint probability must be compared with the product.

The gambler’s fallacy treats independent trials as if they compensate for past results. After five heads from a fair coin, the next head still has probability 1/2. The specific sequence of six heads was unlikely before flipping began, but once the first five results are known, only the last flip remains uncertain.

Key Takeaways

  • Independence means P(A∩B)=P(A)P(B).
  • Disjoint positive-probability events are dependent.
  • Complementing independent events preserves independence.
  • Pairwise independence checks pairs; mutual independence checks every subcollection.
  • Independent trials do not compensate for past outcomes.

2.3 Reverse a conditional probability with Bayes’ theorem

Follow the joint probability in both directions

A test’s sensitivity answers “How often is a person with the condition positive?” It does not answer “How often does a positive person have the condition?” These questions condition on different groups. Bayes’ theorem connects them:

P(A∣B)=P(B∣A)P(A)P(B).

Both numerator forms equal P(A∩B) before division by P(B). Here P(A) is the prior, P(B∣A) the likelihood, and P(A∣B) the posterior. The denominator gathers all ways to observe B.

Count true and false positives

A condition affects 1% of a population. A diagnostic test has 99% sensitivity and a 5% false-positive rate. In a group of 10,000 people, the model gives 100 with the condition and 9,900 without it. The positive groups are 99 true positives and 495 false positives. Thus

P(D∣+)=9999+495=16≈0.167.

The formula calculation is identical:

0.99(0.01)0.99(0.01)+0.05(0.99).

The specificity is the chance of a negative result among people without the condition: 95% here. Subtract specificity from 1 to obtain the false-positive rate. Substituting 95% where the denominator needs 5% reverses that branch.

Base-rate neglect drops the small prior and treats sensitivity as the posterior. The large group without the condition can supply most positive results even when its positive rate is small. Reversing “evidence given innocence” into “innocence given evidence” makes the same error in legal reasoning, often called the prosecutor’s fallacy.

Update again with fresh evidence

A posterior can become the next prior. If a second test is conditionally independent of the first given disease status, the same likelihoods apply within each status group. Two positive results give

0.99(1/6)0.99(1/6)+0.05(5/6)=0.991.24≈0.798.

Conditional independence is essential here: a repeated test that copies the first result supplies no fresh information.

Allow several possible causes

For a partition B1,…,Bn of positive-probability causes,

P(Bj∣A)=P(A∣Bj)P(Bj)∑iP(A∣Bi)P(Bi).

If 60% of chips come from a machine with a 2% defect rate and 40% from one with a 5% rate, the total defect probability is 0.032. A defective chip came from the second machine with probability 0.4(0.05)/0.032=0.625.

Message filtering works the same way. If “offer” appears in 25% of spam and 2% of legitimate messages, equal priors give spam probability 0.25/(0.25+0.02)≈0.926 after observing that word. A spam prior of 0.8 raises it to about 0.980. Naive Bayes combines several word clues by modeling them as conditionally independent given the message class.

Key Takeaways

  • Bayes’ theorem reverses conditioning by using the prior and the likelihood.
  • The denominator includes evidence from every possible cause.
  • Sensitivity and the posterior after a positive test answer different questions.
  • Specificity is one minus the false-positive rate.
  • Repeated evidence needs its correct conditional likelihoods.
3

Turn outcomes into numerical distributions

An outcome may contain much more detail than a question needs. A random variable extracts a number, such as a count of lost packets or the number of trials before a success. You will collect probabilities for those values, read cumulative probabilities, and examine two variables together. Choosing a standard distribution then becomes a question about the process: what is fixed, what changes, and which trials are independent?

3.1 Build a PMF, a CDF, and a joint distribution

A random variable assigns a number

A random variable is a function X:S→ℝ. Its rule is fixed; the random outcome determines which value is observed. In three fair coin flips, let X count heads. Both HHT and HTH map to 2, although they are different outcomes.

Each value defines an event: {X=x} contains all outcomes mapped to x. The probability mass function, or PMF, is pX(x)=P(X=x). Collect the outcome weights for each value, then check that the masses are nonnegative and sum to 1.

For three independent fair flips:

Heads, x0123
P(X = x)1/83/83/81/8

The values are not equally likely: three sequences give one head but only one gives no heads. A random variable can collect equal-weight outcomes into unequal-weight groups.

Add masses to get cumulative probabilities

The cumulative distribution function, or CDF, is FX(x)=P(X≤x). It is nondecreasing, approaches 0 and 1 at the two extremes, and includes the mass at its argument. In the table, FX(1)=1/8+3/8=1/2. For 1≤x<2 it remains 1/2; at 2 it jumps to 7/8. The jump at a possible value equals its PMF mass.

To extract an interval probability, subtract cumulative totals:

P(a<X≤b)=FX(b)−FX(a).

Subtracting the total through a removes a itself. For example, P(1<X≤3)=1−1/2=1/2. Endpoint symbols tell you which masses to retain.

Use indicators for yes/no events

The indicator of A, written IA, equals 1 when A occurs and 0 otherwise. A count of successful checks can be written as a sum containing an indicator for each check. This makes each event’s contribution explicit even when the whole count has a complicated distribution.

Keep two variables together

A joint distribution lists P(X=x,Y=y) for every pair. Sum a row or column to get a marginal distribution: P(X=x)=∑yP(X=x,Y=y). X and Y are independent if every joint entry equals the product of its two marginal probabilities.

For two independent fair dice, the individual results are independent. The first die and their sum are dependent: a first die of 1 cannot occur with a sum of 12, although both single events have positive probability. A failed product equality establishes dependence; independence requires all pairs to pass.

Transform values by collecting outcomes

Let M be the maximum of two independent fair dice. There are k2 pairs with both values at most k, and (k−1)2 with both at most k minus 1. Subtract to find

P(M=k)=k2−(k−1)236=2k−136.

At k = 6 this gives 11/36. Applying a function to outcomes creates another random variable, but it does not make its distinct values equally likely.

Key Takeaways

  • A random variable maps outcomes to numbers.
  • A PMF collects the probability of each value and must sum to 1.
  • A CDF includes all mass at or below its argument.
  • Joint distributions yield marginals by summation.
  • Independence of variables requires the product rule for every value pair.
  • To find a transformed distribution, group outcomes that give the same value.

3.2 Choose a distribution from the experiment

Match the question to the process
ModelWhat is measuredRequired structure
UniformOne of n equally likely valuesA finite set with equal masses
BernoulliA single success indicatorValues 1 and 0 with success chance p
BinomialSuccesses in n trialsFixed n, independent trials, same p
GeometricTrials through the first successIndependent trials, same positive p
HypergeometricSuccesses in a sampleUniform sampling without replacement

Uniform on {1,…,n} gives probability 1/n to each value. A Bernoulli variable has P(X=1)=p and P(X=0)=1−p. The label “success” names the counted result; it need not describe a desirable outcome.

Count successes in a fixed number of trials

For X∼Bin⁡(n,p),

P(X=k)=(nk)pk(1−p)n−k,k=0,…,n.

A particular sequence with k successes has probability pk(1−p)n−k. The coefficient counts which trial positions contain them. Leaving it out gives only one sequence’s probability. The binomial theorem verifies that all masses sum to 1.

Ten packets are lost independently with probability 0.3 each. Exactly three losses have probability

(103)(0.3)3(0.7)7≈0.267.

“At most one” adds the masses for zero and one: 0.710+10(0.3)(0.7)9≈0.149. A fixed trial count does not by itself justify a binomial model; equal success probabilities and independence are also needed.

Wait until a first success

For a geometric variable X counting trials through the first success,

P(X=k)=(1−p)k−1p,P(X>k)=(1−p)k.

The first expression requires k minus 1 failures followed by a success. The second requires k failures and says nothing about trial k plus 1. For the first six on a fair die, P(X=3)=25/216≈0.116 and P(X>3)=(5/6)3≈0.579.

Some books count failures before success instead. That variable is X minus 1, starts at zero, and has mean one less. Identify the counting convention before choosing an exponent.

The geometric distribution is memoryless:

P(X>m+n∣X>m)=P(X>n).

After m failures, the chance of another n failures remains (1−p)n. Geometric distributions are the memoryless distributions on positive integers.

Handle sampling without replacement

A batch contains four defective and 16 working items. Draw five uniformly without replacement. Each selection changes what remains, so a binomial count is inappropriate. The hypergeometric formula is

P(X=k)=(4k)(165−k)(205).

The numerator chooses k defective items and the remaining five minus k from the working items. Values of k must be feasible for both groups. This is the same consistent unordered counting used for card hands.

Key Takeaways

  • Binomial counts successes in a fixed number of independent trials with the same success probability.
  • The binomial coefficient counts all successful position patterns.
  • Geometric counts trials through the first success and starts at 1.
  • Sampling without replacement leads to a hypergeometric count.
4

Find average outcomes without listing every case

Expected value turns a distribution into a probability-weighted average. It can describe a game’s net gain, a waiting time, or the number of events that occur, even when that average is not a possible result of one run. You will calculate expectations directly and by conditioning, then use linearity and indicators to avoid difficult distributions. Dependence matters for products, but it does not prevent adding finite expectations.

4.1 Calculate means, transformed values, and conditional means

Weight each value by its probability

The expected value, or mean, of X is

E[X]=∑xxP(X=x).

Equivalently, sum X(s)P(s) over outcomes s. Values with greater probability contribute more weight. A fair die has mean 3.5, even though no face shows that value. Expectation describes the long-run average of repeated independent runs with a finite mean; it is not a prediction that the next result will equal the mean.

A game costs two tokens and pays ten tokens when a fair die shows six. The net gain is eight on a win and minus two otherwise:

E[gain]=8(1/6)−2(5/6)=−1/3.

The expected loss is one-third of a token per game. Averaging the payout alone gives 10/6, but that leaves out the fee. Subtracting the fee once from expected payout gives the same net result.

Average the function you actually need

For a function g,

E[g(X)]=∑xg(x)P(X=x).

You can use the original distribution without first constructing the distribution of g(X). Squaring values before averaging differs from squaring their average. On a fair die,

E[X2]=1+4+9+16+25+366=916,(E[X])2=494.

Nonlinear operations such as squaring or taking reciprocals generally cannot be moved through expectation.

For a nonnegative integer-valued X, the tail-sum formula is

E[X]=∑k≥1P(X≥k).

A value x contributes one unit to each of the first x tails, so those contributions add to x. For a fair die the sum is (6+5+4+3+2+1)/6=3.5.

Condition on a useful first case

For an event A of positive probability,

E[X∣A]=∑xxP(X=x∣A).

If positive-probability events Ai form a partition, the law of total expectation weights their conditional means:

E[X]=∑iP(Ai)E[X∣Ai].

For geometric waiting with success chance p, let the finite mean be m. A first-trial success uses one trial. After a failure, one trial is used and an independent copy of the same waiting process remains. Thus

m=p+(1−p)(1+m),pm=1,m=1/p.

This agrees with the tail sum 1+(1−p)+(1−p)2+⋯=1/p, which also establishes finiteness for positive p.

Check convergence for infinite ranges

A finite expectation requires ∑x∣x∣P(X=x)<∞. Infinite support alone does not cause trouble: geometric waiting has a finite mean. But in the St. Petersburg game, a first head on flip k pays 2k tokens with probability 2−k. Every k contributes one token to the expectation series, so the total diverges to positive infinity. The game has no finite mean payout.

Key Takeaways

  • Expectation is a probability-weighted average and need not be an attainable value.
  • Use net gain when a game charges a fee.
  • Apply a function to each value before averaging it.
  • Total expectation weights conditional means by case probabilities.
  • An infinite-range variable needs a convergence check for a finite mean.

4.2 Use indicators and linearity for expected counts

Add expectations even with dependence

For variables with finite expectations and constants a and b,

E[X+Y]=E[X]+E[Y],E[aX+b]=aE[X]+b.

Linearity of expectation needs no independence. In the outcome-by-outcome sum, distributing addition separates the contributions from X and Y. The same argument works for any finite sum.

A count often becomes easy after defining one indicator per possible event. If Ii is 1 when event Ai occurs and 0 otherwise, then E[Ii]=P(Ai). Therefore

X=∑iIi⟹E[X]=∑iP(Ai).

You need each event’s probability, not the distribution of the total count. A binomial count has n indicators of mean p, giving E[X]=np.

Count correct returns in a random permutation

Suppose n hats are returned uniformly at random. Let Ii indicate that person i gets their own hat. Each person’s hat is equally likely to be any of the n hats, so P(Ii=1)=1/n. The expected number of correct returns is

E[X]=∑i=1n1n=1.

The indicators are dependent: if all but one hats return correctly, the last one must also be correct. That dependence does not affect this calculation. An expected count of one also does not mean that exactly one match occurs in every return.

Count pairs, not people

Among 23 people with independent uniform birthdays on 365 days, define an indicator for each pair sharing a birthday. There are (232)=253 pairs, each matching with probability 1/365. The expected number of matching pairs is 253/365≈0.693.

This is not the probability of a birthday match. A group can contribute more than one matching pair. Expected counts can exceed 1, while event probabilities cannot.

Break a long wait into phases

In the coupon collector problem, each draw independently gives one of n equally likely types. After i distinct types have appeared, the chance of a new type is (n−i)/n. The waiting time for the next new type is geometric with mean n/(n−i).

The full collection time is the sum of these phase lengths:

E[T]=n(1+12+⋯+1n)=nHn.

For six die faces this is 6H6=14.7 rolls. The final missing type alone takes six rolls on average, explaining why completion takes longer than six rolls. Linearity adds the phase means without requiring a separate independence proof for the phases.

Treat products separately

For independent variables with finite expectations, E[XY]=E[X]E[Y]. This can fail with dependence. Let X and Y both be the indicator of heads on the same fair flip. Their product equals that same indicator, so E[XY]=1/2, whereas E[X]E[Y]=1/4.

Key Takeaways

  • Finite expectations add regardless of dependence.
  • An indicator’s expectation equals the probability of its event.
  • Choose indicators for exactly what is being counted, such as pairs.
  • Coupon collection has mean n times the nth harmonic number.
  • Expected counts and probabilities are different quantities.
  • Factoring the expectation of a product needs additional conditions, such as independence.
5

Measure spread and bound rare outcomes

Two random variables can have the same mean and behave very differently on individual runs. Variance measures squared distance from the mean, while standard deviation expresses spread in the original units. You will track how shifts, scaling, and dependence affect spread, then use Markov, Chebyshev, and Chernoff bounds to limit rare outcomes. These bounds trade detailed distribution information for guarantees under clear conditions.

5.1 Calculate variance and keep dependence in the formula

Square distances before averaging

If μ=E[X], the variance is

Var⁡(X)=E[(X−μ)2].

Positive and negative deviations cancel when averaged directly. Squaring makes both contribute positively. The standard deviation is σ=Var⁡(X). If X is measured in milliseconds, variance has units of square milliseconds and standard deviation has units of milliseconds.

A sure payout of 50 tokens and an equally likely payout of zero or 100 tokens both have mean 50. The sure payout has variance zero. The random payout is always 50 tokens from its mean, so its variance is 502=2,500. A mean alone hides this difference.

Expanding the square gives a convenient computational formula:

Var⁡(X)=E[X2]−(E[X])2.

For a fair die, E[X]=7/2 and E[X2]=91/6. Thus Var⁡(X)=91/6−49/4=35/12≈2.92, and σ≈1.71. Keep the two second-moment quantities separate: the average of squares is not the square of the average.

Shift and scale the distribution

For constants a and b,

Var⁡(aX+b)=a2Var⁡(X).

A shift moves the values and their mean by the same amount, preserving all deviations. Scaling multiplies each deviation by a and each squared deviation by its square. Standard deviation therefore scales by ∣a∣. Even a negative scale leaves variance nonnegative.

Add the covariance term for sums

Covariance measures joint variation:

Cov⁡(X,Y)=E[XY]−E[X]E[Y].

Expanding a sum’s squared deviation gives

Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y).

Independent variables have covariance zero. For a finite sum of pairwise independent variables, all covariance terms vanish, so the variances add. For independent X and Y, the variance of their difference also adds: the coefficient of Y is squared. Standard deviations themselves generally do not add.

Two copies of the same variable need different treatment. The expression X plus X is exactly twice X, with variance 4Var⁡(X). Two independent copies have sum variance 2Var⁡(X). They may have the same individual distribution while having a different joint relationship.

Use standard results
DistributionMeanVariance
Bernoulli(p)pp(1 − p)
Binomial(n, p)npnp(1 − p)
Geometric(p), trials through success1/p(1 − p)/p²

A binomial variable is a sum of independent Bernoulli indicators, which explains its mean and variance. For 100 independent fair flips, the head count has mean 50, variance 25, and standard deviation 5. For rolls until the first six, the mean is 6 and the variance is 30.

Key Takeaways

  • Variance averages squared distances; standard deviation returns to the original units.
  • Compute variance as E[X2]−(E[X])2.
  • Shifts preserve variance; scaling by a multiplies variance by its square.
  • A sum’s variance includes covariance terms.
  • Pairwise independence is enough for variances to add.
  • Repeated use of the same variable differs from independent copies.

5.2 Choose a bound and check its conditions

Markov: use a nonnegative variable and its mean

For X≥0 and a>0, Markov’s inequality states

P(X≥a)≤E[X]a.

Values at least a contribute at least a times their probability to the mean. This gives the bound without a full distribution. A nonnegative response time averaging 20 ms has probability at most 20/100=0.2 of reaching 100 ms. A result above 1 gives no useful improvement over the probability limit 1. Applying this inequality directly to a variable that can be negative is invalid.

Chebyshev: use squared distance and variance

Apply Markov to the nonnegative variable (X−μ)2. For any d>0 and finite variance,

P(∣X−μ∣≥d)≤Var⁡(X)d2.

When σ>0, setting d=kσ gives the bound 1/k2. If variance is zero, X equals its mean with probability 1. Chebyshev’s inequality controls both tails together and needs no independence for a single variable.

For 100 independent fair flips, the head count has mean 50 and variance 25. Hence P(∣X−50∣≥10)≤25/100=0.25. The exact probability is about 0.057. A guaranteed upper bound can be much larger than the actual probability; it is not an estimate or an equality.

Control an average

For n pairwise independent variables with common mean μ and finite variance σ2, their average Mn has variance σ2/n. Chebyshev gives

P(∣Mn−μ∣≥ε)≤σ2nε2.

The right side tends to zero for every fixed positive tolerance. This proves the weak law of large numbers under these conditions. For fair-flip indicators, requiring error less than 0.05 with probability at least 0.95 is guaranteed by 0.25/(n(0.05)2)≤0.05, giving n≥2,000. This is a sufficient size, not the smallest possible size.

Chernoff: exploit independent bounded summands

Let T=∑iTi, where the summands are mutually independent and each lies in [0,1]. With μ=E[T] and c≥1,

P(T≥cμ)≤e−β(c)μ,β(c)=cln⁡c−c+1.

For 1,000 independent fair flips, μ=500. The threshold 600 corresponds to c=1.2, so the bound is e−500β(1.2)≈8.3×10−5. Chebyshev gives 0.025 for this event by bounding the larger two-sided event. The exact upper-tail probability is about 1.4×10−10.

Chernoff’s exponential form can be far sharper, but its summand conditions must hold. Pairwise independence alone supports the variance calculation for Chebyshev; the stated Chernoff form requires mutual independence.

Key Takeaways

  • Markov needs a nonnegative variable and a positive threshold.
  • Chebyshev bounds both tails using a finite variance.
  • For pairwise independent equal-variance observations, the average’s variance decreases as 1/n.
  • The stated Chernoff bound requires mutually independent summands in [0, 1].
  • Report a bound as an upper limit; a sufficient sample size need not be minimal.
6

Analyze random choices in algorithms

Random choices can make an algorithm fast on average or make an inexpensive check reliable after repetition. The input can remain fixed while those choices vary. You will distinguish random running time from possible output error, reduce one-sided error, and analyze expected comparisons and hash collisions. Indicator arguments also lead to existence proofs: a favorable average can guarantee that at least one useful object exists.

6.1 Separate random running time from random error

Fix the input and vary the random choices

A randomized algorithm uses random choices during its execution. For one fixed input, those choices can change the runtime, the output, or both. An expected runtime averages over the algorithm’s choices on that input. A worst-case expected runtime takes the largest such expectation among inputs of the same size.

TypeCorrectnessRunning time
Las VegasAlways correctRandom
Monte CarloMay be wrong, with a bounded error chanceHas a fixed time bound

Randomized quicksort is Las Vegas. A matrix-product check with a fixed number of random trials is Monte Carlo.

Repeat a one-sided test

Suppose true “yes” inputs always pass, while each fixed “no” input passes with probability at most ε. Run k independent trials and accept only if all pass. A “no” input is wrongly accepted only if every trial misses it, so its error probability is at most εk. True “yes” inputs still always pass.

Independence refers to fresh random choices in the trials. Reusing one random vector repeatedly does not multiply the guarantee. The bound concerns a fixed false input’s chance of passing; it is not the posterior probability that an accepted input is false.

Check primality or a matrix product

A prime always passes Miller–Rabin. For an odd composite n, at most one-quarter of the bases from 1 through n minus 1 let it pass. Uniform independent bases give error at most 4−k on each such composite. Ten trials give about 9.54×10−7. A “composite” verdict is conclusive.

Freivalds’ check tests AB=C for square matrices by choosing a vector r of independent fair bits and comparing A(Br) with Cr. Matrix-vector products use O(n2) arithmetic operations. Equality always passes; a false product passes with probability at most 1/2.

For

A=(1234),B=(5678),C=(19224351),

the last entry should be 50. Vector (1,0) misses the error, while (0,1) exposes it: the second components are 50 and 51. Two of the four bit vectors miss it. Twenty independent trials give miss probability 2−20≈9.54×10−7.

Turn expectations into tail guarantees

If runtime R is nonnegative and E[R]≤T on an input, Markov gives P(R≥10T)≤1/10. A small expected time allows occasional slow runs. It does not assert a fixed time limit for every run.

With high probability means that failure tends to zero as input size n grows, often at a rate n−c for a positive constant c. If each of n steps fails with probability at most 1/n2, the union bound gives total failure at most 1/n. The steps need not be independent for this bound.

Key Takeaways

  • Randomized analysis can fix the input and average over internal choices.
  • Las Vegas guarantees correctness; Monte Carlo allows bounded output error.
  • Independent repetition reduces the stated one-sided error to its kth power.
  • Freivalds’ check uses matrix-vector products and has one-sided error.
  • Markov controls runtime tails; a union bound controls any step failing.

6.2 Count comparisons, collisions, and favorable objects

Define one indicator per quicksort pair

Randomized quicksort selects each pivot uniformly from the current part. For distinct sorted values z1<⋯<zn, a pair zi,zj is compared exactly when the first pivot from zi,…,zj is either endpoint. An interior pivot separates the pair permanently. Each of the j−i+1 values is equally likely to be first, so

P(zi and zj are compared)=2j−i+1.

Let an indicator record each pair’s comparison. Linearity gives the expected total

E[C]=∑i<j2j−i+1=2(n+1)Hn−4n.

Here Hn=∑k=1n1/k lies between ln⁡n and ln⁡n+1. Thus expected comparisons grow like 2nln⁡n, giving O(nlog⁡n). A worst-case run compares every pair, using (n2) comparisons.

For three values, a middle first pivot uses two comparisons; an endpoint first pivot needs three. The mean is (1/3)2+(2/3)3=8/3. For 1,000 values the formula gives about 10,986 comparisons, compared with 499,500 in the worst case.

Define indicators for colliding key pairs

Under simple uniform hashing, k keys choose independently and uniformly among m slots. Each pair collides with probability 1/m. Therefore

E[colliding pairs]=(k2)m.

The expected number of keys in a specified slot is the load factor k/m. These are different counts: a slot holding three keys contributes three colliding pairs.

For 100 keys and 1,000 slots, the expected colliding-pair count is 4.95. The no-collision probability is

∏i=099(1−i/1,000)≈0.00596.

This is the birthday calculation with slots replacing days. A collision chance near one-half occurs at about 1.18m keys for large m; for 32-bit values it is about 77,000 values. The approximation concerns any matching pair, not a match to one fixed key.

Turn a mean into an existence proof

The probabilistic method builds an object at random and proves a desired outcome has positive probability. If a finite random variable has mean at least t, some outcome has value at least t.

Place each vertex of a graph independently on either side of a cut with equal probability. Each edge crosses with probability 1/2. If there are m edges, the expected crossing count is m/2, so some cut has at least that many edges.

The Ramsey number R(k,k) is the smallest vertex count for which every red–blue coloring of a complete graph’s edges contains a monochromatic k-vertex complete subgraph. To find a lower bound, color each edge of a complete graph on N vertices independently red or blue. A particular k-vertex set is monochromatic with probability 21−(k2). The expected number of such sets is

(Nk)21−(k2).

If this is below 1, some coloring has zero such sets: a nonnegative integer count that were always positive would have mean at least 1. Thus R(k,k)>N. Choosing N=⌊2k/2⌋ yields the lower bound R(k,k)>2k/2 for k≥3. To check the expectation bound, use (Nk)≤Nk/k!. This gives an upper limit 21+k/2/k!. It is below 1 at k = 3 and decreases thereafter: increasing k by 1 multiplies it by 2/(k+1)<1. If the displayed N is below k, there are no k-vertex sets at all. Finally, the integer inequality R greater than N also gives R greater than 2k/2. The argument guarantees a coloring without finding it.

Key Takeaways

  • Quicksort compares a pair when an endpoint is its interval’s first pivot.
  • Sum comparison probabilities to get expected quicksort comparisons.
  • Hash collision pairs have expectation equal to the number of pairs divided by slots.
  • A favorable average guarantees at least one favorable outcome.
  • An integer-valued bad-object count with mean below 1 can be zero.
  • Existence arguments need not construct the promised object.

Discrete Probability examples

6 Walkthroughs

1

Build and check a probability calculation

15 steps
Start with outcomes, combine events, and finish with a consistent count of samples.
  1. 1
    IntroductionDescribe one complete result

    A probability model has to describe a complete result before it can assign a chance. We will distinguish outcomes from events, use event rules to handle overlap, and then count samples without replacement. Watch how the same choice—whether a result records order—affects both the event and the sample space.

  2. 2
    ExplanationChoose the detail in an outcome

    Roll two independent fair dice and record the first result followed by the second. Each outcome is an ordered pair. There are 36 pairs, and each has probability 1/36. The event “sum 7” groups six pairs, while “sum 2” groups only one. Recording just the sum is possible, but those sum outcomes need unequal weights.

  3. 3
    ExampleAssign and add weights

    A sensor reports green, amber, or red with probabilities 0.6, 0.3, and 0.1. These are nonnegative and total 1, so they form a probability assignment. The event “not green” collects amber and red, with probability 0.4. The event is a set of complete results; its probability comes from adding their weights.

  4. 4
    ChallengeCheck a proposed uniform space

    A learner lists the sums 2 through 12 of two independent fair dice and assigns each probability 1/11. Is that the correct distribution?

    ---reveal---

    No. The sums occur through different numbers of ordered pairs. For example, sum 2 occurs only through (1,1), while sum 7 has six pairs. The weights total 1, but they model a different experiment.

  5. 5
    ConnectionLet a wait have infinitely many values

    Flip a fair coin until the first head. Stopping on flip k requires k minus 1 tails and then a head, with probability 2−k. The probabilities 1/2,1/4,1/8,… sum to 1. An infinite list can therefore have valid unequal weights. Equal positive weights would diverge, and equal zero weights would have total zero.

  6. 6
    ExampleUse “none” to find “at least one”

    Two independent sensors each miss a signal with probability 0.2. The probability neither misses it is 0.82=0.64. The event “at least one misses” is its complement, so its probability is 1−0.64=0.36. This collects one miss and two misses in a single calculation without listing the possible patterns separately.

  7. 7
    Key InsightCorrect an overlap

    The sum 0.2+0.2=0.4 counts a double miss twice. The intersection has probability 0.22=0.04, so subtracting one copy gives 0.4−0.04=0.36. This is the addition rule: add the two event probabilities and subtract their intersection. Independence helped find this intersection; the addition rule itself needs no independence.

  8. 8
    ChallengeUse a guarantee with missing overlap data

    Four checks each fail with probability at most 0.03. Their dependence is unknown. What upper limit can you guarantee for at least one failure?

    ---reveal---

    The union bound gives at most 4(0.03)=0.12. It works without independence or intersection data. The sum is an upper limit; the actual union can be smaller if some failures share outcomes.

  9. 9
    ExplanationRestore a three-way overlap

    With three events, inclusion–exclusion adds the single probabilities, subtracts the three pairwise intersections, and adds the triple intersection. Trace one outcome present in all three: it is added three times, then subtracted three times. Without the final addition it would disappear, even though it belongs in the union.

  10. 10
    ExplanationCount unordered samples

    A bag has five green and three purple distinct tiles. Draw three uniformly without replacement and ignore order. The sample space consists of (83)=56 equally likely three-tile subsets. To get exactly two green tiles, choose two of the five green tiles and one of the three purple tiles. Both counts describe subsets.

  11. 11
    ExampleComplete the numerator

    There are (52)(31)=10⋅3=30 favorable subsets. The probability is 30/56=15/28. The purple choice enforces “exactly two green”: choosing the third tile from the entire bag would allow three green tiles and could repeat a tile already chosen. Each factor has a distinct role in the selection.

  12. 12
    ChallengeCheck an ordered numerator

    For the same bag, someone uses 5⋅4⋅3 as the numerator and 56 as the denominator. Why does this fail?

    ---reveal---

    The two green tiles are ordered in the numerator but not in the denominator. Each favorable subset is counted twice. Divide by 2! to recover 30, or rebuild both counts using fully ordered draw sequences.

  13. 13
    TipDistinguish two matching questions

    For n independent uniform birthdays, the chance of no match is the product of the unused-day fractions. Its complement counts a match in any pair. Asking whether someone matches one specified person instead uses a fixed target day. Write the event in words before choosing a count: a fixed-person match and any-pair match collect different outcomes.

  14. 14
    ChallengeCombine counting with a complement

    In the eight-tile bag, what is the probability of at least one purple tile in three draws without replacement?

    ---reveal---

    The complement is three green tiles, with (53)=10 subsets out of 56. The answer is 1−10/56=23/28. Adding the probabilities of purple on individual draws would require correcting their overlaps.

  15. 15
    RecapCheck the model before the arithmetic

    For a new problem, first decide what a complete outcome records. Give its weight, describe the event, and check whether counting or a weighted sum fits. Overlap corrections and complements organize the event calculation; consistent ordered or unordered counts organize sampling. A result outside [0, 1] signals that the model or arithmetic needs another look.

2

Follow information from causes to evidence and back

16 steps
Use conditional groups, test independence, and update a source probability from an observed failure.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep the direction of a question visible
  2. 2
    ExplanationRestrict to the known group
  3. 3
    ExampleMultiply a branch and its condition
  4. 4
    ExampleAdd the alternate route
  5. 5
    ChallengeFind the right conditional denominator
  6. 6
    Key InsightAsk how evidence was selected
  7. 7
    ExplanationCalculate before claiming independence
  8. 8
    ChallengeKeep disjointness separate
  9. 9
    ConnectionTest the whole collection
  10. 10
    ExplanationReverse the route question
  11. 11
    ExampleCalculate the posterior
  12. 12
    ChallengeChange the direction of inference
  13. 13
    AnalogyMake base rates concrete
  14. 14
    TipCheck whether repeated evidence is fresh
  15. 15
    ChallengeConnect the denominator to the model
  16. 16
    RecapSeparate restriction, combination, and reversal
3

Build a distribution and choose a model

14 steps
Map outcomes to values, accumulate their probabilities, and distinguish fixed counts from waiting times.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionExtract the number a question needs
  2. 2
    ExampleMap pairs to a maximum
  3. 3
    ExampleFind each mass by subtraction
  4. 4
    ExplanationAccumulate the masses
  5. 5
    ChallengeRead an interval with endpoints
  6. 6
    Key InsightTest a joint relationship
  7. 7
    ExplanationRecord one trial or count many
  8. 8
    ExampleInclude all success positions
  9. 9
    ChallengeDecide what stopping changes
  10. 10
    ExampleKeep a mass separate from a tail
  11. 11
    ConnectionRestart the remaining wait
  12. 12
    TipRecognize removal from a population
  13. 13
    ChallengeBuild a different sample model
  14. 14
    RecapLet the process select the formula
4

Calculate averages by cases and indicators

13 steps
Work through a net-gain distribution, then count events without constructing their full distribution.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionChoose the quantity to average
  2. 2
    ExampleInclude the fee in every outcome
  3. 3
    ExampleForm the weighted average
  4. 4
    ChallengeTransform before you average
  5. 5
    ExplanationCondition on the first trial
  6. 6
    Key InsightRecognize an infinite average
  7. 7
    ExplanationCount with one indicator per event
  8. 8
    ChallengeKeep dependence out of an additive calculation
  9. 9
    TipChoose the counted object carefully
  10. 10
    ExampleSplit a collection into phases
  11. 11
    ExampleAdd the collection waits
  12. 12
    ChallengeCombine collection and a cost
  13. 13
    RecapUse the easiest representation of the mean
5

Turn spread into a probability guarantee

14 steps
Track variance under scaling and averaging, then choose a valid tail inequality.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionAsk what the mean leaves unknown
  2. 2
    ExampleCompare two equal-mean variables
  3. 3
    ExampleUse the second moment
  4. 4
    Key InsightDistinguish a scale from new randomness
  5. 5
    ChallengeHandle a difference of independent times
  6. 6
    ExplanationUse a nonnegative time and its mean
  7. 7
    ExampleUse variance for deviation from a mean
  8. 8
    ChallengeSelect a bound from the information
  9. 9
    ExplanationAverage repeated measurements
  10. 10
    ChallengeChoose a sufficient number of observations
  11. 11
    ExplanationExploit bounded independent trials
  12. 12
    ExampleMatch the threshold to a multiplier
  13. 13
    ChallengeChoose between available guarantees
  14. 14
    RecapMatch the guarantee to its conditions
6

Use random checks and count algorithm events

17 steps
Amplify a matrix check, derive a quicksort pair probability, and turn averages into existence.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionFix the input before taking a probability
  2. 2
    ExplanationSeparate error from runtime
  3. 3
    ExplanationCheck a product through a random vector
  4. 4
    ExampleSee how an error can be missed
  5. 5
    ExampleMultiply independent miss probabilities
  6. 6
    ChallengeDecide how many fresh trials are needed
  7. 7
    ConnectionTurn mean time into a tail bound
  8. 8
    ExplanationFind the quicksort event for one pair
  9. 9
    ExampleCount favorable first pivots
  10. 10
    ChallengeCheck an adjacent pair
  11. 11
    Key InsightSeparate expected work from a worst run
  12. 12
    ExampleCount hashing pairs
  13. 13
    ChallengeCount several keys in one slot
  14. 14
    ConnectionUse a mean to guarantee a cut
  15. 15
    ChallengeUse an integer count below one
  16. 16
    TipCombine small failure risks
  17. 17
    RecapState exactly what the guarantee covers

Discrete Probability practice questions

50 Practice Questions in 5 sets

Set 1: Build models and interpret probabilities10 Practice Questions

Question 1 of 10

A game costs four tokens and pays 18 tokens with probability 1/3, otherwise paying zero. What is its expected net gain?
  1. 6 tokens
  2. 14 tokens
  3. 2 tokens
  4. −2 tokens
Show answerHide answer
Answer: C
Expected payout is 18(1/3)=6 tokens, and the four-token fee is paid on every play, giving net expectation 2. Equivalently, gains are 14 and −4 with probabilities 1/3 and 2/3. Reporting six tokens leaves the entry fee out of the requested net gain.

Question 2 of 10

A random variable has mean 4 and second moment E[X2]=21. What is its variance?
  1. 5
  2. 17
  3. 25
  4. 37
Show answerHide answer
Answer: A
Variance is the mean of the squares minus the square of the mean: 21−42=5. Subtracting the mean itself would give 17 and would mix a first moment with a second moment. The formula requires squaring the entire mean before subtraction.

Question 3 of 10

A device reports state A, B, or C with probabilities 0.20, 0.35, and 0.45. What is the probability it reports B or C?
  1. 0.35
  2. 0.80
  3. 0.1575
  4. 0.55
Show answerHide answer
Answer: B
B and C are distinct complete states, so they are disjoint and their probabilities add: 0.35+0.45=0.80. Multiplying gives the probability of a joint event in an appropriate model; this device reports only one state, so B and C are alternatives, not stages.

Question 4 of 10

Events A and B have probabilities 0.35 and 0.50, with intersection probability 0.20. What is the probability of their union?
  1. 0.85
  2. 0.15
  3. 0.20
  4. 0.65
Show answerHide answer
Answer: D
The addition rule gives 0.35+0.50−0.20=0.65. The intersection has been included in both single probabilities, so one copy must be subtracted. The value 0.85 leaves that overlap counted twice and overstates the union.

Question 5 of 10

Of 80 files, 20 are archived. Eight archived files are encrypted. Given that a uniformly selected file is archived, what is the probability it is encrypted?
  1. 2/5
  2. 1/10
  3. 1/4
  4. 1/2
Show answerHide answer
Answer: A
The condition restricts the group to the 20 archived files. Eight meet the encryption event, giving 8/20=2/5. Dividing by all 80 files would give 1/10, the joint probability of archived and encrypted, which answers a different question.

Question 6 of 10

A job uses server A with probability 0.25 and server B with probability 0.75. Their failure rates are 0.12 and 0.04. What is the overall failure probability?
  1. 0.08
  2. 0.03
  3. 0.06
  4. 0.16
Show answerHide answer
Answer: C
Weight the conditional failure rates by their server shares: 0.25(0.12)+0.75(0.04)=0.06. The simple average 0.08 treats both servers as equally likely, although B handles three times as many jobs. The two weighted contributions here each equal 0.03.

Question 7 of 10

Two percent of components are faulty. A scanner flags 90% of faulty components and 6% of working components. What fraction of flagged components are faulty?
  1. 9/10
  2. 15/64
  3. 3/50
  4. 3/10
Show answerHide answer
Answer: B
The faulty-and-flagged probability is 0.02(0.90)=0.018; working-and-flagged is 0.98(0.06)=0.0588. The posterior is 0.018/(0.018+0.0588)=15/64. The 90% sensitivity conditions on a faulty component, not on an observed flag.

Question 8 of 10

X has masses 0.20, 0.50, and 0.30 at values 0, 2, and 5. What is FX(2)?
  1. 0.70
  2. 0.20
  3. 0.50
  4. 0.80
Show answerHide answer
Answer: A
The CDF includes every value at or below its cutoff, so FX(2)=0.20+0.50=0.70. The mass 0.50 describes equality to 2 alone. Excluding the zero-value mass confuses a cumulative probability with a single PMF entry.

Question 9 of 10

Seven transmissions independently fail with probability 0.20 each. What is the probability exactly two fail?
  1. 7(0.2)2(0.8)5
  2. 21(0.2)5(0.8)2
  3. 21(0.2)2(0.8)7
  4. 21(0.2)2(0.8)5
Show answerHide answer
Answer: D
Choose the two failed positions in (72)=21 ways, then multiply by the probability of each two-failure pattern. Five transmissions must succeed, giving the exponent 5 on 0.8. Using 7 as the coefficient counts single positions, not pairs of failed positions.

Question 10 of 10

A verifier performs six checks. Each check on a false claim misses it with probability at most 1/2 per trial. Trials within each check use independent randomness. Every check is run k times and passes only if all its trials pass. What smallest k guarantees that the probability of any check missing a false claim is at most 0.01, regardless of dependence between checks?
  1. 8
  2. 9
  3. 10
  4. 11
Show answerHide answer
Answer: C
Each false check survives with probability at most 2−k, so the union bound gives 6⋅2−k for any miss. At k = 9 this is about 0.0117; at k = 10 it is about 0.00586. Nine trials control each check separately but do not meet the combined target.
Set 2: Choose models and combine useful rules10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A box contains four red and five blue distinct tiles. Three are drawn uniformly without replacement. What is the probability of exactly two red tiles?
  1. 10/21
  2. 5/21
  3. 5/14
  4. 5/7
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A four-label subset is chosen uniformly from seven distinct labels, one of which is Q. What is the probability the subset contains Q?
  1. 4/7
  2. 1/7
  3. 3/7
  4. 6/7
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Events A and B satisfy P(A)=0.30, P(B)=0.40, and P(A∩B)=0.12. What relationship holds between them?
  1. They are dependent and overlap.
  2. They are independent and disjoint.
  3. They are dependent and disjoint.
  4. They are independent and overlap.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

An anomaly occurs in 5% of records. A detector flags 80% of anomalous and 10% of normal records. Two flags are conditionally independent given anomaly status. After two flags, what is the anomaly probability?
  1. 8/27
  2. 64/83
  3. 4/23
  4. 16/35
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Independent attempts succeed with probability 0.40 each. W counts attempts through the first success. What is the probability W>4?
  1. 0.63(0.4)
  2. 0.64(0.4)
  3. 0.64
  4. 1−0.64
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Nine events each have probability 0.30 and may be dependent. What is the expected number that occur?
  1. 0.3
  2. 0.9
  3. 1.0
  4. 2.7
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A task uses mode A with probability 0.60 and mode B otherwise. Its conditional mean time is 5 ms in A and 15 ms in B. What is the overall expected time?
  1. 9 ms
  2. 10 ms
  3. 12 ms
  4. 8 ms
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A nonnegative waiting time has mean 24 ms. What upper bound does Markov give for a wait of at least 120 ms?
  1. 0.04
  2. 0.20
  3. 0.80
  4. 0.24
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

Twenty keys independently choose uniformly among 500 hash slots. What is the expected number of colliding pairs?
  1. 0.04
  2. 0.38
  3. 0.76
  4. 0.40
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A one-sided test never rejects a true input and accepts each fixed false input with probability at most 1/3. Fresh trials cost 2 ms each. What is the least time for an all-pass repetition rule to make false acceptance at most 0.002?
  1. 8 ms
  2. 10 ms
  3. 14 ms
  4. 12 ms
Show answerHide answer

Save this lesson to see this answer.

Set 3: Combine distributions and conditional reasoning10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Outcomes are positive integers k with P(k)=2/3k. Given that k is even, what is the probability k = 2?
  1. 8/9
  2. 2/9
  3. 1/4
  4. 3/4
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

Five distinct labels are chosen uniformly without replacement from eight red and four blue labels. Given that at least one chosen label is blue, what is the probability exactly two are blue?
  1. 14/33
  2. 14/23
  3. 21/46
  4. 7/11
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Among easy jobs, method A passes 18 of 20 and B passes 64 of 80. Among hard jobs, A passes 42 of 70 and B passes 10 of 20. Which method has the higher pooled pass rate?
  1. A, with 60/90 versus B’s 74/100.
  2. B, with 74/100 versus A’s 60/90.
  3. A, with 90% versus B’s 80%.
  4. B, with 50% versus A’s 60%.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Two components each fail with probability 0.20. Their joint failure probability is 0.08. What is the probability that both work?
  1. 0.64
  2. 0.72
  3. 0.92
  4. 0.68
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A joint table has masses P(0,0)=0.18, P(0,1)=0.12, P(1,0)=0.42, and P(1,1)=0.28 for (X,Y). What is P(X=1∣Y=0)?
  1. 0.42
  2. 0.60
  3. 0.70
  4. 0.28
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A game allows at most three independent attempts, each succeeding with probability 1/4. It stops at the first success, pays 14 tokens if success occurs, and charges three tokens per attempted trial. What is the expected net gain?
  1. 37/32 tokens
  2. 163/32 tokens
  3. −29/32 tokens
  4. 37/16 tokens
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Independent X and Y have variances 2 and 5. What is Var⁡(3X−2Y+7)?
  1. 16
  2. 38
  3. −2
  4. 45
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A variable X has variance 7. What is Var⁡(X+12)?
  1. 19
  2. 49
  3. 151
  4. 7
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A randomized algorithm always returns the correct result and has expected runtime at most 15 ms on every input of a specified size. What runtime-tail guarantee follows?
  1. P(runtime≥75 ms)≤0.20
  2. P(runtime≥75 ms)≤0.04
  3. P(runtime≥75 ms)=0.20
  4. P(runtime≥75 ms)=0.04
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

In randomized quicksort on distinct keys, what is the probability that sorted ranks 3 and 7 are compared?
  1. 1/5
  2. 1/2
  3. 2/5
  4. 2/7
Show answerHide answer

Save this lesson to see this answer.

Set 4: Reason with bounds and dependent counts10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

U and V are independent fair bits. Define W = 1 when U and V differ and W = 0 when they match. What is the probability exactly two of U, V, and W equal 1?
  1. 1/4
  2. 3/8
  3. 3/4
  4. 1/2
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A filter flags 60% of junk messages and 5% of ordinary messages. Junk makes up 20% of all messages. After observing a flag, what is the junk probability?
  1. 3/4
  2. 3/5
  3. 1/5
  4. 2/3
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

X has masses 0.15, 0.25, 0.40, and 0.20 at values 0, 1, 3, and 6. What is the probability 1<X≤6?
  1. 0.85
  2. 0.40
  3. 0.75
  4. 0.60
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Among 100 participants, 60 use tool A, 50 use B, and 40 use C. The pairwise overlap counts are 25 for A and B, 20 for A and C, and 15 for B and C, each including the 10 who use all three. What is the probability a uniformly chosen participant uses exactly one tool?
  1. 0.40
  2. 0.50
  3. 0.70
  4. 0.60
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A discrete sample space has outcomes indexed by positive integers k, with P(k)=c/3k. What value of c makes this a valid assignment?
  1. 1
  2. 2
  3. 1/2
  4. 3
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A sample of six items is selected uniformly without replacement from 30 items containing seven defective ones. What standard distribution models the number of defective items selected?
  1. A binomial distribution.
  2. A hypergeometric distribution.
  3. A geometric distribution.
  4. A Bernoulli distribution.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Ten cards each carry a different owner’s name. They are returned in a uniformly random order. What is the expected number of correct returns?
  1. 1
  2. 0.1
  3. 5
  4. 10
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Pairwise independent observations each have mean μ and variance 9. What smallest n makes Chebyshev guarantee that their average differs from μ by less than 0.30 with probability at least 0.98?
  1. 500
  2. 1,500
  3. 5,000
  4. 15,000
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A variable has mean 30 and variance 9. What bound does Chebyshev give for a distance of at least 6 from the mean?
  1. 1/2
  2. 1/4
  3. 1/6
  4. 1/12
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A randomized construction produces a nonnegative integer count Z of forbidden patterns. The expectation is 0.8. What is the strongest general lower bound on P(Z=0) obtainable from this information?
  1. 0.20
  2. 0.00
  3. 0.80
  4. 1.00
Show answerHide answer

Save this lesson to see this answer.

Set 5: Solve unfamiliar probability problems10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

The eight vertices of a complete graph independently receive a fair red or blue color. What is the expected number of triangles whose three vertices have the same color?
  1. 14
  2. 7
  3. 28
  4. 21
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

Three events have probabilities 0.40, 0.35, and 0.30. Their pairwise intersections have probabilities 0.12, 0.10, and 0.08, and their triple intersection has probability 0.03. What is the probability none occurs?
  1. 0.25
  2. 0.19
  3. 0.22
  4. 0.78
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Four labeled jobs independently choose uniformly among ten time slots. Given that the first two choose different slots, what is the probability all four use different slots?
  1. 63/125
  2. 14/25
  3. 16/25
  4. 49/100
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Events A, B, and C are pairwise independent, each with probability 1/2. Their triple intersection has probability t. What is the largest possible value of t?
  1. 1/8
  2. 1/2
  3. 3/8
  4. 1/4
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A scanner flags 90% of faulty items and 10% of working items. Among flagged items, 60% are faulty. What is the underlying faulty-item proportion?
  1. 1/7
  2. 3/5
  3. 1/5
  4. 2/7
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Independent trials succeed with probability 0.25. W counts trials through the first success. Given W>5, what is the probability W>8?
  1. 243/1,024
  2. 27/64
  3. 6,561/65,536
  4. 9/64
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An urn gives one of three equally likely symbols on each independent draw. A reward is 15 tokens for collecting all three symbols, and each draw costs two tokens. What is the expected net gain when drawing stops at completion?
  1. 9 tokens
  2. 6 tokens
  3. 4 tokens
  4. 3 tokens
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

T counts successes in n mutually independent trials, each with success probability 0.20. Using Markov’s, Chebyshev’s, or the stated Chernoff bound, what smallest integer n can guarantee P(T≥0.40n)≤0.01?
  1. 59
  2. 119
  3. 120
  4. 60
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A randomized solver always returns a correct solution when it finishes, terminates with probability 1, and has a random running time with finite expectation. What type of algorithm is it?
  1. A Monte Carlo algorithm.
  2. A deterministic algorithm.
  3. A Las Vegas algorithm.
  4. A one-sided Monte Carlo test.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

An undirected graph has 37 edges and no loops. Each vertex is independently placed on either side of a cut with equal probability. What is the strongest integer lower bound on the crossing-edge count of some cut given by the expectation argument?
  1. At least 18 edges.
  2. At least 19 edges.
  3. At least 20 edges.
  4. At least 37 edges.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

74 Key Terms, each with its definition

B

Base-rate neglect
Base-rate neglect is the error of ignoring the prior frequency of a cause when interpreting evidence associated with it.
Treating sensitivity as disease probability after a positive test ignores the condition’s prevalence.
Bayes’ theorem
Bayes’ theorem reverses conditioning by combining the likelihood of evidence under a cause with the cause’s prior probability.
A positive test updates the disease probability only after counting both true and false positive results.
Bernoulli distribution
A Bernoulli distribution describes one 0–1 trial, assigning probability p to 1 and probability 1 minus p to 0.
A packet-loss indicator is Bernoulli even though “success” in the counting model represents a loss.
Binomial distribution
A binomial distribution counts successes in a fixed number of mutually independent trials with the same success probability.
The number of losses among independently transmitted packets is binomial when the loss rate stays constant.
Birthday problem
The birthday problem asks for the probability of a shared value among any pair in a group of independent uniform draws.
Hash collisions follow the birthday model when keys choose independently among equally likely slots.

C

Chebyshev’s inequality
Chebyshev’s inequality bounds the chance of a positive-sized deviation from the mean by variance divided by squared distance.
Knowing a variance can bound both tails together even when the full distribution is unavailable.
Chernoff bound
The Chernoff bound here gives an exponential upper-tail limit for sums of mutually independent variables taking values in [0, 1].
For independent success indicators, a Chernoff bound can sharply limit unusually high total counts.
Colliding pair
A colliding pair is a pair of distinct keys assigned to the same hash slot, counted separately from other pairs in that slot.
Three keys in one slot create three colliding pairs, so pair count differs from the number of crowded slots.
Complement
The complement of an event is the set of outcomes in the sample space that are outside the event, written A‾.
The complement of “at least one packet is lost” is “no packets are lost,” not “at least one arrives.”
Conditional expectation
A conditional expectation is a probability-weighted mean calculated within a given positive-probability event.
The mean wait after a first-trial failure can be used as one case in a waiting-time calculation.
Conditional probability
A conditional probability measures an event after restricting to a given positive-probability event and rescaling its weights.
Knowing that a die roll is even changes the group used to calculate the chance that it exceeds 4.
Countably infinite sample space
A countably infinite sample space has infinitely many outcomes that can be listed in a sequence indexed by positive integers.
The possible terminating sequences H, TH, TTH, and so on form a countably infinite sample space.
Coupon collector problem
The coupon collector problem asks how many independent uniform draws are needed to see every type in a finite collection.
Waiting for the last unseen die face takes longer on average than waiting for the first new face.
Covariance
A covariance is the expected product of two centered variables, equal to E[XY]−E[X]E[Y] when these moments are finite.
The variance of a sum includes twice the covariance, which vanishes when the variables are independent.
Cumulative distribution function
A cumulative distribution function gives the probability that a random variable is at or below each specified cutoff.
A jump of 0.3 at a cutoff means the variable equals that particular value with probability 0.3.

D

Disjoint events
Disjoint events are events with no shared outcomes, so their intersection is empty and they cannot occur together.
On one roll, “an odd result” and “a result of 2” are disjoint events, though each has positive probability.

E

Error amplification
Error amplification reduces a randomized test’s failure probability by combining repeated trials with independent random choices.
Requiring all repeated one-sided tests to pass lowers the error bound from ε to its kth power.
Event
An event is a subset of the sample space that occurs when the observed outcome belongs to that subset.
On one die roll, the event “greater than 4” contains outcomes 5 and 6 and no other outcomes.
Expected value
An expected value is a probability-weighted average of a random variable’s values, interpreted as a long-run mean when finite.
A mean of 3.5 for a fair die describes an average over runs even though no single roll can equal it.
Experiment
An experiment is a random process with a well-defined set of possible complete results, such as rolling a die twice.
Recording two die results in order specifies the experiment more precisely than simply recording “a roll.”

G

Gambler’s fallacy
The gambler’s fallacy is the mistaken belief that independent future results must compensate for an earlier run of results.
Five heads in independent fair flips do not make a tail more likely on the next flip.
Geometric distribution
A geometric distribution here counts independent equal-probability trials through the first success, starting at 1.
The number of rolls through the first six is geometric, so the successful roll is included in the count.

H

Harmonic number
The harmonic number Hn is the sum of the reciprocals of the first n positive integers, appearing in collection and sorting means.
The six-type coupon collector has expected collection time six times the sixth harmonic number.
Hypergeometric distribution
A hypergeometric distribution counts successes in a uniformly chosen fixed-size sample drawn without replacement from a finite population.
Counting defective items in five draws from a small batch uses a hypergeometric model.

I

Inclusion–exclusion
Inclusion–exclusion calculates a union by adding single-event probabilities and correcting overlaps with alternating signs.
For three events, the triple intersection is added after subtracting all pairwise intersections.
Independence of events
Independence of events means that their joint probability equals the product of their separate probabilities.
For positive-probability conditions, learning an independent event leaves the other event’s chance unchanged.
Independent random variables
Independent random variables have joint masses equal to products of their marginal masses for every possible value pair.
A single joint entry that fails factorization is enough to establish that the variables are dependent.
Indicator variable
An indicator variable equals 1 when its event occurs and 0 otherwise, turning an event into a numerical random variable.
One indicator per colliding key pair makes the total number of collisions a sum of simple variables.
Intersection
The intersection of events A and B, written A∩B, contains exactly the outcomes belonging to both events.
The king of hearts is the only card in the intersection of “a heart” and “a king” in a standard deck.

J

Joint distribution
A joint distribution assigns probabilities to pairs of values taken by two random variables in the same experiment.
A table for two die values records the probability of each ordered value pair, not only their separate totals.

L

Las Vegas algorithm
A Las Vegas algorithm always returns a correct answer, while its running time varies with its internal random choices.
Randomized quicksort sorts correctly even when an unlucky pivot sequence makes a run slow.
Law of total expectation
The law of total expectation finds an overall mean by weighting conditional means across a partition by case probabilities.
If most jobs are quick, their conditional mean receives more weight than the mean for rare slow jobs.
Law of total probability
The law of total probability adds conditional event probabilities over a partition, weighted by the case probabilities.
Production shares weight each machine’s defect rate when computing the overall defect probability.
Likelihood
A likelihood in a Bayes update is the probability of the observed evidence when a particular proposed cause is given.
The fraction of spam messages containing “offer” supplies a likelihood for that word under the spam class.
Linearity of expectation
Linearity of expectation allows finite expectations to be added and scaled by constants, even for dependent variables.
Dependent correct-return indicators still give an expected total of one in a uniformly random hat return.
Load factor
The load factor is the number of stored keys divided by the number of hash slots, giving the mean occupancy under uniform hashing.
With 120 keys and 600 slots, a specified slot has expected occupancy 0.2 under uniform hashing.

M

Marginal distribution
A marginal distribution describes one variable alone, obtained by adding joint probabilities over the other variable’s values.
Summing one row of a joint table gives the probability of that row’s value regardless of the column value.
Markov’s inequality
Markov’s inequality bounds the upper tail of a nonnegative variable by its mean divided by a positive threshold.
A runtime mean gives an upper limit on the chance that a run lasts at least ten times that mean.
Memorylessness
Memorylessness means that after a given wait without success, the remaining waiting-time distribution is unchanged.
After ten unsuccessful independent trials, a geometric wait for the next success starts with the same chances.
Monotonicity
Monotonicity means that an event contained in another event cannot have greater probability than that larger event.
A full house containing three aces is no more likely than a full house of any allowable ranks.
Monte Carlo algorithm
A Monte Carlo algorithm runs within a fixed time bound and may return an incorrect answer with a bounded probability.
A fixed number of randomized matrix-product checks trades computation for a small chance of missing an error.
Multiplication rule
The multiplication rule finds a joint event probability by multiplying one event’s chance by the other’s conditional chance.
The chance of two marked draws without replacement uses the updated marked fraction for the second draw.
Mutual independence
Mutual independence means the probability product rule holds for every subcollection of the events, including larger groups.
Multiplying three server failure probabilities requires the corresponding three-way independence condition.

N

Net gain
A net gain is the payout from an outcome after subtracting its cost, so it can be negative even when the payout is nonnegative.
A game paying ten tokens after a two-token fee produces an eight-token net gain on a winning play.

O

One-sided error
A one-sided error allows a randomized test to err only in one direction, such as accepting a false input while never rejecting a true one.
Freivalds always accepts a correct product, while a false product can occasionally pass a random check.
Outcome
An outcome is one complete possible result of an experiment, distinguished from every other result in the sample space.
For two coin flips, HT and TH are different outcomes because the order of the results differs.

P

Pairwise independence
Pairwise independence means every pair in a collection satisfies the independence product rule, without requiring larger groups to do so.
Two coin results and the event that they match give a three-event example with pairwise independence.
Partition
A partition of the sample space is a collection of disjoint events whose union is the entire sample space.
The machine that produced a chip defines separate exhaustive cases when every chip comes from one machine.
Posterior probability
A posterior probability is the updated probability of a possible cause after conditioning on the observed evidence.
After one piece of evidence, the posterior can become the prior for the next update.
Prior probability
A prior probability is the probability assigned to a possible cause before conditioning on the evidence in an update.
A message filter’s prior spam probability describes the message population before looking for a word clue.
Probabilistic method
The probabilistic method proves that an object exists by showing a random construction has positive probability of a desired property.
A random cut with expected crossing count half the edges guarantees that some cut reaches at least that count.
Probability function
A probability function assigns nonnegative weights to outcomes with total 1 and adds those weights to measure events.
A loaded die can have unequal face weights and still define a valid probability function.
Probability mass function
A probability mass function assigns each possible value of a discrete random variable its probability, with all masses totaling 1.
The head-count PMF for three fair flips puts more mass on 1 and 2 than on 0 and 3.

R

Ramsey number
The Ramsey number R(k,k) is the smallest vertex count forcing a monochromatic k-vertex complete subgraph in every red–blue edge coloring.
A coloring on N vertices with no monochromatic k-set establishes a lower bound greater than N.
Random variable
A random variable is a function assigning a real number to each outcome, allowing numerical questions about an experiment.
Several different three-flip sequences map to 2 when the variable counts the number of heads.
Randomized algorithm
A randomized algorithm makes internal random choices that can affect its running time or output even on a fixed input.
Quicksort can choose different pivot sequences on repeated runs of the same input.

S

Sample space
A sample space is the set of all possible outcomes of an experiment; exactly one outcome occurs on each run.
The 36 ordered pairs form a sample space for rolling two six-sided dice and recording both values.
Sampling with replacement
Sampling with replacement returns each selected item before the next draw, leaving the population unchanged between draws.
Independent uniform draws with replacement from eight labels have eight possible results at each stage.
Sampling without replacement
Sampling without replacement keeps each selected item out of the population, changing which items remain available.
Drawing a marked tile reduces both the number of remaining marked tiles and the total tile count.
Second moment
A second moment is the expected square E[X2], used with the squared mean to calculate variance.
Two distributions with the same mean can have different second moments and therefore different variances.
Sensitivity
The sensitivity of a diagnostic test is the probability of a positive result among individuals who have the condition.
A sensitivity of 90% predicts 90 positive results per 100 people with the condition in the model.
Simple uniform hashing
Simple uniform hashing models each key as choosing a hash slot uniformly and independently of the slots chosen by other keys.
Under this model, any specified pair of keys collides with probability one divided by the slot count.
Simpson’s paradox
Simpson’s paradox is a reversal between subgroup comparisons and an overall comparison caused by different subgroup weights.
A method handling mostly difficult jobs can have a lower pooled success rate while winning in both job groups.
Specificity
The specificity of a diagnostic test is the probability of a negative result among individuals without the condition.
Specificity of 96% leaves a 4% false-positive rate within the group without the condition.
Standard deviation
A standard deviation is the nonnegative square root of variance, expressing spread in the same units as the variable.
If response-time variance is 9 square milliseconds, its standard deviation is 3 milliseconds.

T

Tail-sum formula
The tail-sum formula expresses the expectation of a nonnegative integer-valued variable as the sum of its positive-threshold tail probabilities.
A waiting-time mean can be found by adding the chances that at least one, two, three, and more trials are needed.

U

Uniform distribution
A uniform distribution on a finite set gives each of its possible values the same probability, the reciprocal of the set’s size.
A fair die value is uniform, while the sum of two independent fair dice is not uniform over its sums.
Uniform sample space
A uniform sample space is a finite sample space whose outcomes all have equal probability, so event chances are count ratios.
A well-shuffled deck makes every five-card subset equally likely, even though hand types have different chances.
Union
The union of events A and B, written A∪B, contains outcomes belonging to either event or to both events.
A card that is a heart and a king belongs to the union “heart or king,” and is counted once.
Union bound
The union bound limits the probability of any event in a collection occurring by the sum of their individual probabilities.
A designer can bound any component failure even when the overlaps between failure events are unknown.
Upper bound
An upper bound on an event probability is a guaranteed limit that the true probability cannot exceed, not necessarily its exact value.
A bound of 0.25 can be valid when the event’s actual probability is only about 0.057.

V

Variance
A variance is the expected squared distance of a random variable from its mean, measuring spread in squared units.
A fixed payout has variance zero because its value never differs from its mean.

W

Weak law of large numbers
The weak law of large numbers states that averages approach the common mean in probability under appropriate independence and moment conditions.
For pairwise independent observations of common finite variance, Chebyshev makes a fixed average error unlikely as n grows.
With high probability
The phrase with high probability describes success whose failure probability tends to zero as the input size grows.
Failure at most one divided by input size is a with-high-probability guarantee for growing inputs.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started