todai-math 2023 Q3
Combinatorial PGF for counting problems
Let us randomly place circle stones $\bigcirc$ and square stones $\square$ one by one in a line from left to right. The circle and square stones are placed with probability $1 - q$ and $q$, respectively, according to the independent and identical distribution, where $0 < q < 1$. The placement stops right after $M$ square stones are placed in a row, where $M$ is a positive integer. We show examples of the lines for $M = 4$ as follows.
Let $L$ be a random variable which represents the number of the stones after stopping the placement. For the case of the lines shown above, $L = 5$ and $L = 9$ for lines 1 and 2, respectively.
Here, we consider intermediate states during the placement. Let $k$ be a non-negative integer and let $C_k$ be a state of a line where there are $k$ square stones in a row from the right end. Since we are considering the case of $M = 4$, lines 3 and 4 are not stopped yet. Line 3 is in state $C_2$ since there are 2 square stones in a row from the right end. Line 4 is in state $C_0$ since there is no square stone at the right end. Let $a_{kn}$ be the probability that the stopping condition is met after placing $n$ stones starting from state $C_k$, where $n$ is a non-negative integer. We define the following generating function $A_k(t)$ for $a_{kn}$.
$$A_k(t) = \sum_{n=0}^{\infty} t^n a_{kn}$$
Answer the following questions.
(1) Calculate the mean and variance of $L$ for $M = 1$.
(2) Obtain the recurrence relation that $A_k(t)$ satisfies.
(3) Obtain $A_k(t)$ as a function of $q, M, t$, and $k$.
(4) Calculate the mean of $L$.