Solution
Runs in a Row
Show the problem again
Six items of type A and four of type B are arranged in a row, all $\binom{10}4=210$ arrangements being equally likely (the null hypothesis of the runs test for randomness). A run is a maximal block of consecutive identical letters, so AABBBAAAAB has 4 runs. What is the probability of observing at most 3 runs? Give a reduced fraction.
Worked solution
Two runs: AAAAAABBBB or BBBBAAAAAA, 2 arrangements. Three runs have shape ABA or BAB. For ABA, the 6 A's split into two nonempty blocks ($\binom51=5$ ways) and the B's form one block: 5 arrangements. For BAB, the A's form one block and the 4 B's split into two nonempty blocks ($\binom31=3$ ways): 3 arrangements. Total $2+5+3=10$ of 210, so the probability is $1/21\approx0.048$.
Source: Wald-Wolfowitz runs test (1940). Numbers written for AxiomIQ. Statement written for AxiomIQ.