Probability Problems 06
Table of Contents
Student Slots
How many different ways could you schedule these four students?
First, let’s arrange slots for this special student who is only able to attend two of the seven slots. We will have $C_7^2=21$ cases.
The rest of the 6 slots will be assigned to A, A, B, B, C, C in any orders. The best way to approach this is to first, permute the sequence regardless of the group (identical A, A), and then divide all the repetitions within groups. We will have $\frac{6!}{2!2!2!}=90$.
So, in all, we have $1890$ cases.
To justify the above logic. Let’s use some python.
a = list(itertools.permutations(['A', 'A', 'B', 'B', 'C', 'C']))
len(set(a))
>> 90
Five Day Trips
First, you can choose how many days you can spend to visits, and these are exclusive events, so we can add up at last. After you choose the days, you can decide how to split number of locations among these days. Finally, all the locations can be permutated. So we have three factors to consider here.
- $C_5^1 \times C_7^0\times8!$
- $C_5^2 \times C_7^1\times8!$
- $C_5^3 \times C_7^2\times8!$
- $C_5^4 \times C_7^3\times8!$
- $C_5^5 \times C_7^4\times8!$
Adding these, we have:$(5+70+210+105+35)\times8!$ which gives $17136000$.
Poker Decks
Consider there are $13$ groups with $4$ slots in each group. To meet the criteria, we need the following:
- The first Ace is free to be in any slot. $\frac{52}{52}$
- The second Ace needs to be in the same group with the first ace. Of the $51$ slots, it has to choose the $3$ slots with in the same group. This gives $\frac{3}{51}$
- The third will choose another group except from the group of first and second ace. $\frac{48}{50}$
- The last will choose the other group different from the first two. $\frac{44}{49}$
The final probability will be the products of the above.
Divisible positive integers
This is an application of inclusion and exclusion principles, but in a counting scenario. Denote $A$ as numbers divisible by 2, and $B$ as numbers divisible by 3, and $C$ as numbers divisible by 5. We need $1000 - (C(A) + C(B)+C(C)-C(AB)-C(AC)-C(BC)+C(ABC))$. And finally we have $266$. Let’s try it out in a program.
A = 0
B = 0
C = 0
AB = 0
BC = 0
AC = 0
ABC = 0
for i in range(1, 1001):
if i % 2 == 0:
A += 1
if i % 3 == 0:
B += 1
if i % 5 == 0:
C += 1
if i % 2 == 0 and i % 3 == 0:
AB += 1
if i % 2 == 0 and i % 5 == 0:
AC += 1
if i % 3 == 0 and i % 5 == 0:
BC += 1
if i % 2 == 0 and i % 3 == 0 and i % 5 == 0:
ABC += 1
print(A)
print(B)
print(C)
print(AB)
print(AC)
print(BC)
print(ABC)
500
333
200
166
100
66
33
Expected number of turns

Suppose there is no obstacle in the bottom right corner, how many paths to you have from A to B?
With $9$ steps, you need $4$ upwards, and $5$ rightwards. Then the number of possible paths is just $C_9^4=126$.
With the Obstacle, how many paths do you have from A to B?
With the obstacle, notice that there is only one way not feasible anymore. That is $R,R,R,R,R,U,U,U,U$. All the others are still. So there are $125$ ways to go from $A$ to $B$.
How many expected turns you need from A to B?
If you still remember the Boys and Girls problem from the probability collection 1. Then without the restrictions at the bottom, we are asking how many “switches” in the combinations. We have $r+u=9$ steps to form a combination. A combinations has $8$ pairs. The probability that the pairs create a new “switch” is $\frac{2ru}{(r+u)(r+u-1)}$.
Thus, the expected number of switches is $\frac{2ru}{r+u}$. In this case we have $\frac{2\times 4\times 5}{4+5}=\frac{40}{9}$.
Now, consider the drawback of the bottom right corner. We should exclude one case with only one turn involved. Thus, the new expectation would be $\frac{\frac{40}{9}\times 126 - 1}{125}=\frac{559}{125}$.
Some numerical verification of the first two questions.
import itertools
candidates = ["U"] * 4 + ["R"] * 5
output = set(itertools.permutations(candidates))
count = 0
for t in output:
if t[0] == 'U' or t[1] == 'U' or t[2] == 'U' or t[3] == 'U' or t[4] == 'U':
count += 1
print(count)