Solution (source code)

= Solution

Let $D$ denote having the <disease> and $+$ a positive result. Assume I am sampled uniformly from the stated population, so $\mathbb P(D)=n/N$. By the <law of total probability>, $\mathbb P(+)=a n/N+b(N-n)/N$. Thus <Bayes' theorem> gives
$$
\boxed{\mathbb P(D\mid+)=\frac{an}{an+b(N-n)}.}
$$
The denominator must be positive; otherwise the observed event has zero <probability> in this model and the <conditional probability> is undefined. The answer depends on <disease> prevalence as well as the test's two error rates.