I am faced with this question:
$10$% of all email you receive is spam. Your spam filter is $90$% reliable, that is, $90$% of the mails it marks as spam are indeed spam and $90$% of spam mails are correctly labelled as spam. If you see a mail marked spam by your filter, what is the probability that it is really spam?
This question was posed in a Chennai Mathematical Institute exam. This is how I'm trying it.
$10$% of all email you receive is spam $$ P(\text{spam}) = 0.1 $$
$90$% of the mails it marks as spam are indeed spam $$ P(\text{spam|marked as spam}) = 0.9 $$
$90$% of spam mails are correctly labelled as spam $$ P(\text{marked as spam|spam}) = 0.9 $$
By Bayes' Theorem, we have $$ P(\text{spam|marked as spam}) = \frac{P(\text{marked as spam|spam}) P(\text{spam})}{P(\text{marked as spam})} $$ $$ 0.9 = \frac{0.9 * 0.1}{P(\text{marked as spam})} $$
Which is incorrect. I am not able to figure out what exactly I did wrong. The official solution goes like this
Out of 100 mails, 10 are spam. The filter will label 9 or 10 spam as spam and 9 of 90 non-spam as spam. So 18 are labelled spam, of which 9 are actually spam.
Can somebody show the right way to solve this using conditional probabilities?