Standard Problem description
In this question The Frog Problem (puzzle in YouTube video) a frog has to jump from leaf to leaf on a row of leaves. And the question is how long it takes on average to reach the end.
In that specific case the frog only jumps to the leaves in front of him with each leaf having equal probability. It is computed that the expectation value for the number of steps to reach the end is $J_n = \sum_{k=1}^n 1/k $, when the frog has $n$ leaves in front of him.
New extended problem
But what is the solution when the frog can also remain still and go one step backwards. (there are infinitely many leaves behind the frog, the game only ends when the frog has no leaves in front of him)
This would lead to a recurrence relation like: $$J_{n} = (n+1) J_{n-1} - n J_{n-2}-1$$
To make the solution final we need to know $J_0$ and $J_1$.
It is trivial that the expected number of steps for a frog with zero leaves in front of him is 0 ($J_0 = 0$).
But what is $J_1$? What is the expected number of steps for a frog that has only one leaf to go?
Derivation/intuition of the recurrence relation:
$$J_{n+1} = (n+2) J_{n} - (n+1) J_{n-1}-1$$
There are $n+2$ leaves to go to. The $n$ leaves in front of the frog and the one leaf on which the frog is sitting is the same situation as the frog who has $n-1$ leaves in front of him/her. The one leaf backwards results in the frog being in the situation of a frog that has $n+1$ leaves in front of him/her but he took an extra step.
$$J_{n} = \frac{n+1}{n+2} {J_{n-1}} + \frac{1}{n+2} {(J_{n+1}+1)}$$
Solution attempt 1
It seems like the solution is close to $J_n = c + \sum_{k=1}^n 1/k$ with some constant $c$... but not exactly. When I fill that expression into the recurrence relation then I get to:
$$\begin{array}{rcl} J_{n} &=& (n+1) J_{n-1} - n J_{n-2}-1 \\ c + \sum_{k=1}^n \frac{1}{k} &=& (n+1) \left(c + \sum_{k=1}^{n-1} \frac{1}{k} \right) - n \left(c + \sum_{k=1}^{n-2} \frac{1}{k} \right) -1 \\ \sum_{k=1}^n \frac{1}{k} &=& (n+1) \left(\sum_{k=1}^{n-1} \frac{1}{k} \right) - n \left(\sum_{k=1}^{n-2} \frac{1}{k} \right) -1 \\ \frac{1}{n} + \frac{1}{n-1} &=& (n+1)\frac{1}{n -1} -1\\ \frac{1}{n} + \frac{1}{n-1} &=& \frac{2}{n -1} \\ \end{array}$$
which is a contradiction.
Solution attempt 2
Simulation by Markov chain (this results into something that looks like $J_n = c + \sum_{k=1}^n 1/k$ but as shown before that can not be true.)
nm <- 50
library(expm)
for (n in 1:40) {
# stochastic Matrix
M <- pracma::Toeplitz(c(rep(1,nm+1)),c(1,1,rep(0,nm-1))) / c(2:(nm+2))
M[1,1:2] <- c(1,0)
# positions of frogs after k steps
V <- c(rep(0,n),1,rep(0,nm-n))
Vm <- sapply(0:nn, FUN = function(k) V %*% (M %^% k))
# mean number of steps by computing 1-F(0)
E <- sum(1-Vm[1,])
ev[n] <- E
}
n <- 1:40
plot(n,ev,xlim=c(0,20))
title("simulated \n expected number of steps",cex.main=1)
H <- cumsum(1/n)
mod <- lm(ev-H~1)
lines(n,H+coef(mod)[1])
coef(mod)
legend(0,6.6, c("simulation","2.325547 + H_n") ,cex=0.7, lty=c(NA,1), pch = c(1,NA))
Jn <- ev[-c(1,2)]
Jn1 <- ev[-c(1,40)]
Jn2 <- ev[-c(39,40)]
np <- n[-c(1,2)]
plot(Jn, (np+1)*Jn1 - (np) * Jn2 -1,
xlab = expression(J[n]),
ylab = expression((n+1)%*%J[n-1]-n%*%J[n-2]-1 ))
lines(c(0,10),c(0,10))
title("testing recurrence relation", cex.main=1)
In this answer to the simpler solution. The motion of the frog is not computed by using the recurrence relation, but instead by writing down the probability distribution where the frog might be after $k$ jumps.
In that case the distribution is like a diffusing wave, which will eventually be absorbed completely in the final leaf. In this case we can not compute it because there is a tiny number of frogs that will never reach the goal. But maybe we solve the puzzle with this starting point by finding some explicit solution or by changing the expression to include the backwards leaves?