Algebra tricks to simplify expression I have a proof about the gambler's ruin problem and I get stuck in the last part of it which is:
$1=\ P_N= \begin{cases}
P_1 \frac{1-(p/q)^N}{1-(p/q)},  & \text{if } p \neq q \\
P_1 N, & \text{if }p=q=1/2
\end{cases}$
$ \Rightarrow P_1=\begin{cases}
\frac{1-(q/p)}{1-(q/p)^N},  & \text{if } p \neq q \\
1/N, & \text{if } p=q=1/2
\end{cases}$
$ \Rightarrow P_k=\begin{cases}
\frac{1-(q/p)^k}{1-(q/p)^N},  & \text{if }p \neq q \\
k/N, & \text{if }p=q=1/2
\end{cases}$
NOTE: $P_k = p P_{k+1} + q P_{k-1}$
I don't understand why 1=$P_N$={ implicates the next equalities.
:(
 A: The expression for $P_{k}$ involves the unknown $P_{1}$. This unknown value $P_{1}$ can be obtained on using the fact that $P_{N}=1$. By letting $k=N$ in the expression for $P_{k}$, we obtain the value of $P_{1}$. Now substituting the value of $P_{1}$ into the expression for $P_{k}$, we get an expression $P_{k}$ that involves only known quantities.
$P_{0}=0$ and $P_{N}=1$ are initial conditions of the problem.
EDIT:
You have started your derivation for $P_{k}$, with the equation $P_{k}=pP_{k+1}+qP_{k-1}$ and after some simplification, you have arrived at 
 the expression for $P_{k}$ as follows:
$(1)------  P_k= \begin{cases}
P_1 \frac{1-(p/q)^N}{1-(p/q)},  & \text{if } p \neq q \\
P_1 N, & \text{if }p=q=1/2
\end{cases}$
which involves an unknown, $P_{1}$. We can calculate $P_{k}$, if we know $P_{1}$.  The value of $P_{1}$ is to obtained on invoking the initial/boundary conditions. Here, the relevant condition is $P_{N}=1$. This what you are doing in the very first equation. From this, you have obtained the expression for $P_{1}$. This is your second equation. Substituting $P_{1}$  into the equation (1) above, you have obtained your third equation.   
