Suppose in the gambler's ruin problem that the probability of winning a bet depends on the gambler's present fortune. Specifically, suppose that $p_{i}$ is the probability that the gambler wins a bet when holding fortune $i$. Given that the gambler's initial fortune is $i$, let $P_{i}$ denote the probability that the gambler's fortune reaches $N$ before $0$.

Derive formulas relating $P_i$ to $P_{i-1}$ and $P_{i+1}$ for $i=1,...,N-1$

I think I have this part: Since $P_0 = 0$, $P_N = 1$. Since the probability depends on $i$, $P_i = p_{i}P_{i+1} + q_{i}P_{i-1}$. And $P_{i+1}-P_i = \dfrac {q_i} {p_i}(P_i -P_{i-1})$.

I am asked next to solve the system of equations, I need a bit of assistance with that.

Thanks!

Repeating what you get, we have $$P_{i+1} - P_i =(P_1 - P_0) \prod_{k=1}^i \frac{q_k}{p_k} = P_1 \prod_{k=1}^i \frac{q_k}{p_k}$$ since $P_0 = 0$
Then we have $$P_n = \sum_{i=0}^{n-1}(P_{i+1}-P_i) + P_0 = P_1 \sum_{i=0}^{n-1}\prod_{k=1}^i \frac{q_k}{p_k}, \forall n = 1,2,\cdots, N$$
At last, use the fact $P_N = 1$ to see $P_1 = 1/(\sum_{i=0}^{N-1}\prod_{k=1}^i \frac{q_k}{p_k})$