Katkat

Calculate the Probability That Two Dice Sum to Seven

OptiverSoftware Engineer · Technical Screen

Last updated

This question tests fundamental understanding of discrete probability, combinatorics, and the impact of conditional dependencies on outcomes.

The Problem

Consider two independent, fair, six-sided dice. Each face is labeled 1 through 6. Calculate the theoretical probability that the sum of the two dice is exactly 7.

Show your derivation clearly and provide the final result as a simplified fraction.

Extension

Suppose the dice are no longer independent because the second die is weighted based on the first die's outcome. If the first die shows an even number, the second die is replaced with a version where the probability of rolling a 1 is 1/2 and all other outcomes are 1/10. If the first die shows an odd number, the second die follows a standard uniform distribution (1/6 for each face). Calculate the new probability that the sum of the two dice is 7.

Constraints & Considerations

  • For the first part, assume independence and fair faces.
  • Provide the step-by-step logic for the sample space enumeration.
  • Consider edge cases: What happens to the probability if the number of sides on the dice increases to N?

Hints

Hint 1

Identify the total size of the sample space for two independent six-sided dice by considering every possible pair (d1, d2).

Hint 2

List all unique ordered pairs (d1, d2) that satisfy the condition d1 + d2 = 7.

Hint 3

For the weighted scenario, use the Law of Total Probability by splitting the calculation into two cases: the first die being even and the first die being odd.

Follow-up questions

  • How would you generalize the calculation of the sum of two dice for N-sided dice?
  • If we roll three dice instead of two, how does the distribution of the sum change (i.e., is it still uniform, or does it shift)?
  • How would you implement a simulation in code to verify your theoretical result, and how many iterations would be required for a 95% confidence interval?