Solution (source code)

= Solution

The two parental chromosomes are independent, with probabilities $1-\theta$ and $\theta$ for alleles $A$ and $B$. Therefore the <Hardy-Weinberg principle> gives
$$
\boxed{
 f(X,\theta)=
 \begin{cases}
 (1-\theta)^2,&X=AA,\\
 \theta^2,&X=BB,\\
 2\theta(1-\theta),&X=AB.
 \end{cases}
}
$$