Consider a symmetric random walk on vertices $\{0,1,2,\ldots,n\}$. Suppose that we are at vertex $1$ initially. At each step, we move left with probability $1/2$ and right with probability $1/2$. We assume that vertices $0$ and $n$ are two absorbing states. For a vertex $i\in[1,n-1]\cap \mathbb{Z}$, what is the expected number of visits to vertex $i$ given that this random walk finally ends up with vertex $n$? Since we are at vertex $1$ initially, this counts as one visit to vertex $1$. Simulation results give $2i(n-i)/n$.
My tentative solution:
Since we condition on that the random walk ends up with $n$, I assume that as long as we are at vertex $1$, we will move to vertex $2$ with probability $1$. Therefore $n$ is the only absorbing state. So I could use the fundamental matrix of an absorbing Markov chain to compute the expected number of visits to each vertex. However, this method did not give the answer consistent with the simulation results.
Many thanks for your help.
The transition matrix for {0,1,2...,9} is
I ran a simple simulation in excel for {0,1,...,9}. Sample size=2500. The formula for C5 would read: =IF(C4=9;9;IF(C4=1;2;IF(C4=0;1;IF(RAND()<0.5;C4+1;C4-1))))
A run of the simulation gave me the following averages for each i, with the fundamental matrix outcomes for i in parenthesis:
These outcomes do not match your formula, suggesting you may have made an error in your simulated model?
Rather, it appears to follow 2n-2(i-1) for i>1 and n for i=1.