The title problem is just one specific example of a more generalized problem that I'm trying to solve. I'm trying to write an efficient algorithm for calculating the probability of at least k occurrences each of several dependent events occurring in a particular sample space. It is the presence of wildcards and multiple types of events here that is making the problem difficult for me.
I originally asked a simpler version of the problem here: What is the probability of of drawing at least one king and one ace in a five card poker hand?
This led me to conclusion that inclusion-exclusion is the way to go here. I think seeing the answer to the title problem (without any reductions) will help me design my algorithm for the general case. This is what I have so far:
$D := $ the set of all 9-card hands $$|D| = {\binom{52}{9}}.$$
$Q := $ the set of all 9-card hands containing zero Queens: $$|Q| = {\binom{4}{0}\binom{48}{9}}.$$
$Q_a := $ the set of all 9-card hands containing at least one Queen: $$|Q_a| = {|D|-|Q|}$$
$K := $ the set of all 9-card hands containing zero or one King: $$|K| = {\binom{4}{0}\binom{48}{9}+\binom{4}{1}\binom{48}{8}}$$
$K_a := $ the set of all 9-card hands containing at least two Kings: $$|K_a| = {|D|-|K|}$$
$A := $ the set of all 9-card hands containing zero, one or two Aces: $$|A| = {\binom{4}{0}\binom{48}{9}+\binom{4}{1}\binom{48}{8}+\binom{4}{2}\binom{48}{7}}$$
$A_a := $ the set of all 9-card hands containing at least three Aces: $$|A_a| = {|D|-|A|}$$
$X := $ the set of all 9-card hands containing at least 1 Queen, 2 Kings and 3 Aces: $$|X| = |D|-[|Q|+|K|+|A|-|Q\cap K|-|K\cap A|-|Q\cap A|+|Q\cap K\cap A|]$$
And of course, the probability of drawing one such hand is just: $$\frac{|X|}{|D|}$$
Is that correct so far? This is where I feel it's getting complicated. How do you calculate for example $|K\cap A|$? What does it mean to be a hand with "(zero or one King) AND (zero, one or two Aces)"? This smells like we would need to find all valid sets of $k$ Kings and $a$ Aces and add their cardinalities together.
$S(k,a) := $ the set of 9-card hands containing exactly $k$ Kings and $a$ Aces
$S(q,k,a) := $ the set of 9-card hands containing exactly $q$ Queens, $k$ Kings and $a$ Aces
First, are the following correct?
$$|S(k,a)| = \binom{4}{k}\binom{4}{a}\binom{44}{9-k-a}$$ $$|S(q,k,a)| = \binom{4}{q}\binom{4}{k}\binom{4}{a}\binom{40}{9-q-k-a}$$
If so, are the following true?
$$|K\cap A| = \sum\limits_{a=0}^{2}\sum\limits_{k=0}^{1} |S(k,a)|$$ $$|Q\cap K\cap A| = \sum\limits_{a=0}^{2}\sum\limits_{k=0}^{1}\sum\limits_{q=0}^{0} |S(q,k,a)|$$
Is there a simplication that perhaps I'm missing? I feel like I've over-complicated this problem (or at least I hope I have).
Any help is appreciated. Feel free to reference in your response any sets or functions defined here.
I would work this problem forward, not backward. Still messy.
Case 1: hand contains three non-{q,k,a} cards.
Case 2: Hand contains two non-{q,k,a} cards. Subcases: extra q, extra k, extra a
Case 3: Hand contains one non-{q,k,a} card. Subcases: 2 extra q, extra q+extra k, etc.
Case 4: All cards are q,k,a.