Consider a random walk on the line 1,...,d. You start at point 1. At each step you flip a coin: heads means go left, tails means go right. If you're at 1 and get a heads, just stay where you are (same if you're at d and get a tails). Also known as random walk with reflective barriers.
P(x,y) = 1/2 |x-y|=1 or x=y=1 or x=y=d and =0 otherwise
Trying to get an expression for mean number of steps to reach d given that you start in 1, using conditioning on next move.
I tried this but not sure if its correct. Let Sx be the expected number of steps need to go to x+1 given that you start in x. S0=1, Sx=(1/2) + (1/2) Sx-1 + (1/2) Sx and so,
Sx = 1+ Sx-1