Solution (source code)

= Solution

Under <Hardy-Weinberg equilibrium>, the two parental <allele> copies are sampled independently from the same pool. Multiplying their frequencies, and adding the two orderings for a heterozygote, gives
$$
\boxed{\Pr(a/a)=p^2,\qquad\Pr(a/b)=2p(1-p),\qquad\Pr(b/b)=(1-p)^2.}
$$
Their sum is $(p+(1-p))^2=1$. The <genotypes> are unordered even though the paternal and maternal transmissions may be distinguished in the calculation.