I'm currently trying to learn Bayesian statistics and am working through the book "Bayesian Data Analysis". At the end of chapter 1 is a question asking to derive a conditional probability. I can't figure out the answer even though there is a printed solution here (question 1.3).
I'm not going to post the exact text of the question due to fear of copyright issues but it is roughly as follows:
You inherit a trait from your parents based on your genes
| Gene 1 | Gene 2 | Trait |
|--- |--- |---|---|
| X | X | A |
| X | Y | B |
| Y | X | B |
| Y | Y | B |
In particular you are classed as a heterozygote if you have either XY or YX. A proportion $p^2$ of people have trait A and $2p(1-p)$ are heterozygote carriers of a single recessive allele where $0 < p < 1$. There is a 50/50 chance on either gene being passed on from parents to children.
Show that probability of a child being heterozygote given that they are B and their parents are both B is $2p/(1+2p)$
For my attempt so far I have the following:
For ease I've used the following notation
H = child is a heterozygotes
B = child has trait B
P = parents have trait B
$$ \begin{align} P( H | B , P ) &= \frac{P( H , B , P)}{P(B,P)} \\ \\ &= \frac{P( B | H , P ) P(H , P ) }{ P(B | P) P(P) } \\ \\ &= \frac{1 * P(H | P ) P(P) }{ P(B | P) P(P) } \\ \\ &= \frac{P(H | P )}{ P(B | P) } \\ \end{align} $$
Also I calculate that the proportion of the population who are YY should be $(1-p)^2$.
From here I am stuck on where to go; my guess would be to use the law of total probability to calculate each conditional probability but I get lost whenever I attempt the algebra. Additionally when I look at the above linked solution I don't appear to be even on the right line. Any help would be appreciated.