Why is $\frac{p(1-p)}{1−(1−p)^2}=\frac{1-p}{2-p}$? I found this solution in an old exam:

$$\frac{p(1-p)}{1−(1−p)^2}=\frac{1-p}{2-p}$$

Without any further explanation. Could someone explain to me how to do this transition?
 A: You have two basic options to solve this.

First off, you can just write out the denominator to get $$1-(1-p)^2=1-(1-2p+p^2) = -p^2 +2p = p(2-p)$$
and then cancel out the $p$ top and bottom.

Or, you can "cleverly" see that $1-(1-p)^2 = 1^2-(1-p)^2$ and use the equality $$a^2-b^2 = (a-b)(a+b)$$
to get basically the same thing, since
$$1-(1-p)^2 = (1-(1-p))(1+(1-p)) = p(2-p)$$
A: By inspection (or by $(1-p)^2=1$), $p=0$ and $p=2$ are roots of the denominator. As the coefficient of the highest power is $-1$, it factors as $p(2-p)$. The rest is up to you.
A: hint: it is $$1-(1-p)^2=(1-(1-p))(1+1-p)$$
A: \begin{align}
\frac{p(1-p)}{1−(1−p)^2}&=\frac{p(1-p)}{(1+1-p)(1-1+p)}\\
&=\frac{p(1-p)}{p(2-p)}\\
&=\frac{1-p}{2-p}.
\end{align}
A: Perhaps one should say that $p=0$ and $p=2$ are excluded, because then not both terms are defined. For example,
$$
\frac{p(1-p)}{1−(1−p)^2}=\frac{0}{0}\neq \frac{1}{2}= \frac{1-p}{2-p}.
$$
For $p\neq 0,2$ however, both terms are defined and we can cancel, i.e.,
$$
\frac{p(1-p)}{1−(1−p)^2}=\frac{p(1-p)}{p(2-p)}=\frac{1-p}{2-p}.
$$
