Find the Correlation Between Two Die-Face Counts
SquarepointSoftware Engineer · Technical ScreenLast updated
A fair six-sided die is rolled independently `n` times, where `n` is a fixed positive integer. Explain the assumptions and derivation clearly, check edge cases, and show how the result changes when those assumptions no longer hold.
Find the Correlation Between Two Die-Face Counts
A fair six-sided die is rolled independently n times, where n is a fixed positive integer. Let X be the number of rolls showing 1, and let Y be the number of rolls showing 5. Calculate Corr(X, Y) and explain why the two counts are not independent even though the rolls themselves are independent.
Constraints & Assumptions
- Each roll has exactly one outcome in
{1, 2, 3, 4, 5, 6}. - The die is fair and rolls are mutually independent.
n > 0, so both variances are positive and correlation is defined.
Clarifying Questions to Ask
- Is
nfixed rather than random? - Can one roll contribute simultaneously to both
XandY?
Hints
Hint 1
Check one roll carefully: Contrast dependence between the two face indicators on the same roll with independence across different rolls.
Follow-up questions
- What is the correlation if the two counted categories have unequal probabilities?
- How does the covariance change if `n` itself is random?
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.