It is estimated that 50% of emails are spam emails. Some software has been applied to filter these spam emails before they reach your inbox. A certain brand of software claims that it can detect 99% of spam emails, and the probability for a false positive (a non-spam email detected as spam) is 5%.

If an email is detected as spam, then what is the probability that it is in fact a non-spam email?

Solution

Let $A$ denote the event that an email is detected as spam and $B$ denote the event that an email is spam.

Given that 50% of the emails are spam, i.e., $P(B) = 0.5$. Thus $P(B^\prime) = 1-P(B)=0.50$.

A certain brand of software claims that it can detect 99% of spam emails. That is $P(A|B) = 0.99$.

And the probability for a false positive (a non-spam email detected as spam) is 5%. That is $P(A|B^\prime)=0.05$.

We need to find the probability that the email is non-spam given that it is detected as spam.

Using Bayes' Theorem, required probability is

$$ \begin{aligned} P(B^\prime|A) &=\frac{P(A|B^\prime)P(B^\prime)}{P(A)}\\ &= \frac{P(A|B^\prime)P(B^\prime)}{P(A|B)P(B)+P(A|B^\prime)P(B^\prime)}\\ &=\frac{0.05\times 0.5}{0.05\times 0.5 + 0.99\times 0.5}\\ &=\frac{0.025}{0.52}\\ &=0.0481 \end{aligned} $$

Further Reading