1-2p+p2+2rp-2rp2+r2p2 factors to (1-p-rp)2, but how? What is the process to obtaining that simplified form?
Choose one of the two variables and collect together like powers removing common factors on the way. So, choosing p,
\(\displaystyle 1-2p+p^{2}+2rp-2rp^{2}+r^{2}p^{2}\\=p^{2}(1-2r+r^{2})-2p(1-r)+1 \\ =p^{2}(1-r)^{2}-2p(1-r)+1.\)
If you don't see how to simplyfy that directly, let p(1 - r) = X say, and you then have
\(\displaystyle X^{2}-2X+1 = (X-1)^{2}, \\ = \{p(1-r)-1\}^{2}.\)
Alternatively had you chosen r, you get
\(\displaystyle 1-2p+p^{2}+2rp-2rp^{2}+r^{2}p^{2} \\ =r^{2}p^{2}+2rp(1-p)+1-2p+p^{2}\\ = r^{2}p^{2}+2rp(1-p)+(1-p)^{2}.\)
This time, if needed, let rp = X and 1 - p = Y and you get
\(\displaystyle X^{2}+2XY+Y^{2}=(X+Y)^{2} \\=(rp+1-p)^{2}.\)
The two results differ by a negative sign within the brackets, but algebraically they're equivalent.
And btw, they are different from your given result, (which was incorrect).
Choose one of the two variables and collect together like powers removing common factors on the way. So, choosing p,
\(\displaystyle 1-2p+p^{2}+2rp-2rp^{2}+r^{2}p^{2}\\=p^{2}(1-2r+r^{2})-2p(1-r)+1 \\ =p^{2}(1-r)^{2}-2p(1-r)+1.\)
If you don't see how to simplyfy that directly, let p(1 - r) = X say, and you then have
\(\displaystyle X^{2}-2X+1 = (X-1)^{2}, \\ = \{p(1-r)-1\}^{2}.\)
Alternatively had you chosen r, you get
\(\displaystyle 1-2p+p^{2}+2rp-2rp^{2}+r^{2}p^{2} \\ =r^{2}p^{2}+2rp(1-p)+1-2p+p^{2}\\ = r^{2}p^{2}+2rp(1-p)+(1-p)^{2}.\)
This time, if needed, let rp = X and 1 - p = Y and you get
\(\displaystyle X^{2}+2XY+Y^{2}=(X+Y)^{2} \\=(rp+1-p)^{2}.\)
The two results differ by a negative sign within the brackets, but algebraically they're equivalent.
And btw, they are different from your given result, (which was incorrect).