Two coin toss probability with impossible combinations How to calculate probability of combinations of not all possible combination is possible?
For example, given a test that determines the gender of a fetus with 90% accuracy. If somebody takes the test twice, and both said "a boy", what is the probability that it's actually a boy? Using naive coin toss calculation, the probability of both test being accurate is 0.9*0.9 = 0.81, but the possibility of both being false is 0.1*0.1 = 0.01, which doesn't add up to 1 because the outcome where only one of the tests is wrong is impossible in this case.
So, how to calculate probability in this case?
 A: Use conditional probability: $P(A|B) = P(A \& B)/P(B)$. In words: the probability of $A$, given that $B$ is true, is equal to the probability of both $A$ and $B$, divided by the probability of $B$. Here, $A$ is the event that the fetus is a boy and $B$ is the event that both tests predicts a boy. Do you know how to calculate the two probabilities $P(A \& B)$ and $P(B)$? You will need the a priori probability of the fetus being a boy, which you could approximate by 0.5.
A: The tests aren't independent, because they both depend on the actual sex of the unborn child.  Therefore, the probability that both tests are correct is not simply the square of the probability that a single test is correct.  Instead, you need to use Bayes' theorem:
$$
\begin{eqnarray}
P[\text{boy}\;|\;T_{1}=\text{boy}\wedge T_2=\text{boy}]&=&\frac{P[T_1=\text{boy}\wedge T_2=\text{boy} \;|\; \text{boy}]\cdot P[\text{boy}]}{P[T_1=\text{boy}\wedge T_2=\text{boy}]} \\
&=& \frac{0.9^{2}\cdot 0.5}{0.9^{2}\cdot 0.5 + 0.1^{2}\cdot 0.5} =\frac{81}{82}.
\end{eqnarray}
$$
The analogous calculation for the probability that the child is a girl yields $1/82$, so the two probabilities do add up to $1$.
