Katkat

Find the Color Probability After Discarding Cards

OptiverSoftware Engineer · Technical Screen

Last updated

This problem tests your understanding of conditional probability, combinatorics, and how dependent events (sampling without replacement) impact statistical expectations.

Problem Statement

You are given a standard deck of 52 playing cards, containing 26 red cards and 26 black cards. The deck is shuffled such that every permutation is equally likely. Suppose you draw cards one by one from the top of the deck without replacement.

Tasks

  1. Let R_n be the number of red cards and B_n be the number of black cards remaining in the deck after n cards have been drawn. Calculate the probability that the next card drawn (the n+1-th card) is red, given that you have already observed r red cards and b black cards drawn so far, where r + b = n.
  2. Suppose you discard the first 10 cards without looking at them. Without any knowledge of the colors of the discarded cards, what is the probability that the 11th card is red? Explain your reasoning.
  3. Consider a scenario where the deck is 'rigged': instead of 26/26, the deck contains R red and B black cards. Provide a general formula for the probability that the k-th card is red, given no information about the previous k-1 cards.

Constraints

  • 0 <= n < 52
  • 0 <= r <= 26, 0 <= b <= 26

Example

If you have drawn 2 red cards and 0 black cards (n=2), the probability that the 3rd card is red is (26-2) / (52-2) = 24 / 50 = 0.48.

Hints

Hint 1

Recall that for sampling without replacement, the probability of an event depends strictly on the count of items remaining in the population.

Hint 2

Consider whether the lack of information about the discarded cards implies that the probability 'resets' or remains unchanged due to symmetry.

Hint 3

Use the law of total probability or symmetry arguments to justify why the marginal probability of the k-th card being red remains the same as the first card.

Follow-up questions

  • How does the probability change if you draw cards until you observe 5 red cards and then stop? Is the probability of the next card being red still 0.5?
  • If you know the first card is red, but you do not know the last card, what is the probability that the last card is black?
  • How would you simulate this process for a deck of size N with R red and B black cards to verify your mathematical derivation?