I need some support with this homework exercise: An urn contains at most $N$ balls. Let $X_n$ be the number of balls in the urn after the $n$-th execution of the following procedure: If the urn is not empty, we take a ball and flip a coin, having a probability $p =1/2$ of landing with heads. If heads appears, we put the ball back into the urn, otherwise not. If the urn is empty, we flip a coin again and if heads appears, the urn remains empty, ortherwise we fill the urn with $N$ balls.
The goal is to describe this game with a Markov chain and to determine the transition matrix. How is $X_n$ for $n \in \mathbb{N}$ distributed?
My approach:
Concerning the transition probablities, I am having a hard time to unterstand this. I know that we have to consider the urn for $n$, $0 < n < N$ and for $N$ balls...
Can anyone help me?
The transition matrix is an $N \times N$ matrix given by
$\mathbf{P} = \begin{pmatrix} 1/2 & 0 & 0 & \cdots & 0 &1/2 \\ 1/2 & 1/2 & 0 &\cdots &0 &0 \\ 0 & 1/2 & 1/2 & \cdots &0&0 \\ \vdots & & \ddots & \ddots && \vdots \\ \vdots &&&\ddots&\ddots &\vdots\\ 0 & \cdots & \cdots &0&1/2&1/2\end{pmatrix} \\$
Then $X_n$ has the distribution given by the row vector $\mathbf{\pi} \cdot \mathbf{P}^n$ where $\mathbf{\pi}= \begin{pmatrix} \pi_0 & \pi_1 & \cdots & \pi_N \end{pmatrix}$ represents the distribution for the starting state. i.e. you interpret that there are $i$ balls in the urn when you start with probability $\pi_i$.