For a simple random walk with absorbing barriers at 0 and N. Let W be the event that the particle is absorbed at 0 rather than N., and let $\displaystyle p_k = \mathbb{P}(W | S_0 = k)$. Show that if the particle starts at k where 0 < k < N, the conditional probability that the first step is rightwards, given W, equals $\displaystyle \frac{pp_{k+1}}{p_k}$. Deduce that the mean duration $\displaystyle J_k$ of the walk, conditional on W, satisfies the equation

$\displaystyle pp_{k+1}J_{k+1} - p_kJ_k + (p_k - pp_{k+1})J_{K-1} = -p_k$

I get:

$\displaystyle \mathbb{P}=("1st step is right" | W, S_0=k) = \frac{\mathbb{P}("1st step is right", W, S_0=k+1)}{p_k}$
$\displaystyle =\frac{pp_{k+1}}{p_k}$

For the next part

$\displaystyle (J_k) = (J_k| right)\mathbb{P}(right) + (J_k| left)\mathbb{P}(left) $
$\displaystyle = (1+J_{k+1})\frac{pp_{k+1}}{p_k} + (1 + J_{k-1})\frac{(1-p)p_{k-1}}{p_k}$

however i get stuck here, i wonder if i have the right idea