This is essentially a continuation of the problem Random Walk on Clock Hands, where we are told we are doing a random walk on a clock, and we have a 50:50 chance of either going clockwise one step or counterclockwise one step starting at the position $k \in \{1,2,3,4,5,6,7,8,9,10,11,12\}$ The goal is to reach position $12$.
The original problem shows the expected number of steps needed to reach position $12$. I'm interested in a way to calculate the variance.
Obviously if we start at position $12$ the expected number of steps would equal the variance which would be $0$. Its for the other positions I am unsure about.
I understand the basics about Markov Chains and how the answer for expected value was determined by solving a $13\times13$ system, but I really don't know whereabouts to start to find the variance. I know that one could estimate this value using programming and Monte Carlo Simulation, but I'm looking for a more math-based approach.
Thanks for any help given!
We will use same notation as in random walk on clock hands.
The states are as in the picture:
(The end states are final.)
Let $D$ be the set $\{D\}$, and let $\tau_D$ be the first time for the random walk $X=(X_n)$ that a state in $D$ is hit.
We denote by $$ \begin{aligned} t_k &= \text{Mean value of $\tau_D$ conditioned by $X_0=k$} \\ &=\Bbb E[\tau_D|X_0=k]\ , \\[6mm] u_k &= \text{Mean value of $\tau_D^2$ conditioned by $X_0=k$} \\ &=\Bbb E[\tau_D^2|X_0=k]\ . \end{aligned} $$ Then we have $\tau_D=0$ exactly on $X_0\in \{0,12\}$.
Else, $\tau_D\ge 1$, and we can write:
$$ \begin{aligned} t_k &=\Bbb E[\tau_D|X_0=k] \\ &= \frac 12\Bbb E[\tau_D|X_0=k\text{ and }X_1=k-1] + \frac 12\Bbb E[\tau_D|X_0=k\text{ and }X_1=k+1] \\ &= \frac 12\Bbb E[1+\tau_D|X_1=k-1] + \frac 12\Bbb E[1+\tau_D|X_1=k+1] \\ &=\frac 12+\frac 12t_{k-1}+\frac 12+\frac 12t_{k+1} \\ &=1+\frac 12(t_{k-1}+t_{k+1})\ , \\[8mm] u_k &=\Bbb E[\tau_D^2|X_0=k] \\ &= \frac 12\Bbb E[\tau_D^2|X_0=k\text{ and }X_1=k-1] + \frac 12\Bbb E[\tau_D^2|X_0=k\text{ and }X_1=k+1] \\ &= \frac 12\Bbb E[(1+\tau_D)^2|X_1=k-1] + \frac 12\Bbb E[(1+\tau_D)^2|X_1=k+1] \\ &= \frac 12\Bbb E[1+2\tau_D+\tau_D^2|X_1=k-1] + \frac 12\Bbb E[1+2\tau_D+\tau_D^2|X_1=k+1] \\ &= \frac 12+\frac 12\cdot 2t_{k-1}+\frac 12 u_{k-1} + \frac 12+\frac 12\cdot 2t_{k+1}+\frac 12 u_{k+1} \\ &=1 +(t_{k-1}+t_{k+1}) +\frac 12(u_{k-1}+u_{k+1}) \ . \end{aligned} $$ We already have the solution for $(t_k)_{0\le k\le 12}$, the formula is at loc. cit. $$t_k=k(12-k)\ .$$ (We expect a symmetry w.r.t. $k\leftrightarrow 12-k$.)
The system for $(u_k)_{0\le k\le 12}$ can be solved by computer in this century, sage for instance:
Results (with a manual split):
After i calculated some divided differences, there was a good sign that an interpolation with a polynomial of degree $4$ is possible, we have two roots, so...
This leads to the formula $$ P(k) = \frac 13k(12-k)\Big(\ 142+k(12-k)\ \Big)\ . $$ Check:
recovering the solution.
The corresponding variances are: $$ \boxed{\qquad u_k-t_k^2= \frac 23\, k(12-k)\Big(\ 71-k(12-k)\ )\ . \qquad} $$ These values are:
Simulation, sage again:
Results this time: