Find the Expected Number of Consecutive Chosen Pairs
SIG (Susquehanna)Data Scientist · Online AssessmentLast updated
Calculate the expected number of consecutive pairs in a uniformly chosen subset of integers using indicator variables and linearity of expectation.
Problem Description
In a standard lottery draw, 6 distinct integers are chosen uniformly at random without replacement from the set {1, 2, 3, ..., 35}.
We say that a pair of chosen numbers is consecutive if they are of the form {i, i + 1}. For example, if the chosen set is {3, 4, 5, 12, 20, 21}, there are three consecutive pairs: {3, 4}, {4, 5}, and {20, 21}.
Let X be the random variable representing the total number of consecutive pairs present in the chosen 6-element subset.
Tasks
- Define indicator random variables to represent each potential consecutive pair.
- Compute the probability that any specific pair
{i, i + 1}is included in the chosen subset. - Compute the exact expected value
E[X]as a fully simplified fraction. - Derive a general closed-form expression for
E[X]when selectingkdistinct numbers uniformly at random from{1, 2, ..., n}.
Hints
Hint 1
Express the total count of consecutive pairs as a sum of indicator random variables for each adjacent pair in the range.
Hint 2
Recall that linearity of expectation E[X1 + X2 + ...] = E[X1] + E[X2] + ... holds even when the indicator variables are dependent.
Hint 3
To find the probability that a specific pair {i, i + 1} is included, determine how many ways the remaining k - 2 numbers can be selected from the remaining n - 2 integers.
Follow-up questions
- How would you compute the variance of the number of consecutive pairs, and what types of pair overlaps (covariances) would you need to account for?
- How does the expected value change if the numbers are arranged on a circle, such that {35, 1} is also considered a consecutive pair?
- What is the exact probability that no two chosen numbers are consecutive (i.e., P(X = 0))?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.