I have a lot of problems with the following scenario, for example,
Given 3 boxes $A$, $B$ and $C$.
- The box $A$ contains 2 identical cards $x$, 4 identical cards $y$ and 1 card $z$.
- The box $B$ contains 2 identical cards $x$, 3 identical cards $y$ and 1 card $z$.
- The box $C$ contains 4 identical cards $x$, 4 identical cards $y$ and no card $z$.
The following actions are performed in the following order
- Randomly move 2 cards from $A$ to $B$.
- Randomly move 2 cards from $B$ to $C$.
- Randomly move 3 cards from $C$ to $A$.
Find the probability for the events in which the boxes $A$ and $B$ each still has one card $z$ after performing the three actions above. The cards $z$ are also identical. More precisely, the cards $z$ may move or may not move.
Solving a lot of problems of this kind with bare hands is really error prone.
Attempt
I have no idea how to program this. Does it need graph representations?
There are only two possible disjoint cases:
- Case 1: The $z$ cards never move.
- Case 2: A single $z$ card moves from $A$ to $B$ to $C$ and returns to $A$.
Without loss of generality, the $x$ and $y$ cards can actually be considered as $\star$ cards for example.
The initial states for these boxes are
- $A=\{6\star, 1m\}$
- $B=\{5\star, 1m\}$
- $C=\{8\star, 0m\}$
Now calculate the probability for each case.
Case 1:
- When moving 2 $\star$ cards from $A=\{6\star,1m\}$, the probability is $\frac{{6 \choose 2}}{{7\choose 2}}=\frac{5}{7}$. The current state of the involved boxes are $A=\{4\star,1m\}$ and $B=\{7\star,1m\}$.
- When moving 2 $\star$ cards from $B=\{7\star,1m\}$, the probability is $\frac{{7 \choose 2}}{{8\choose 2}}=\frac{3}{4}$. The current state of the involved boxes are $B=\{5\star,1m\}$ and $C=\{10\star,0m\}$.
- When moving 3 $\star$ cards from $C=\{10\star,0m\}$, the probability is $\frac{{10 \choose 3}}{{10\choose 3}}=1$. The current state of the involved boxes are $C=\{7\star,0m\}$ and $A=\{7\star,1m\}$.
The probability for the first case is $\frac{5}{7}\times \frac{3}{4}=\frac{15}{28}$.
Case 2:
- When moving 1 $\star$ card and 1 $z$ card from $A=\{6\star,1m\}$, the probability is $\frac{{6 \choose 1}{1 \choose 1}}{{7\choose 2}}=\frac{2}{7}$. The current state of the involved boxes are $A=\{5\star,0m\}$ and $B=\{6\star,2m\}$.
- When moving 1 $\star$ card and 1 $z$ card from $B=\{6\star,2m\}$, the probability is $\frac{{6 \choose 1}{2\choose 1}}{{8\choose 2}}=\frac{3}{7}$. The current state of the involved boxes are $B=\{5\star,1m\}$ and $C=\{9\star,1m\}$.
- When moving 1 $\star$ card and 1 $z$ card from $C=\{9\star,1m\}$, the probability is $\frac{{9 \choose 2}{1\choose 1}}{{10\choose 3}}=\frac{3}{10}$. The current state of the involved boxes are $C=\{7\star,0m\}$ and $A=\{7\star,1m\}$.
The probability for the second case is $\frac{2}{7}\times \frac{3}{7} \times \frac{3}{10}=\frac{9}{245}$.
The total probability is $\frac{15}{28}+\frac{9}{245}=\frac{561}{980}$.
MultivariateHypergeometricDistributionin this case, however it would make a lot more sense to simulate it. $\endgroup$