1. **Problem statement:**
We have a spam detection system with the following probabilities:
- Probability an email is spam: $P(S) = 0.002$
- Probability an email is legitimate: $P(L) = 1 - P(S) = 0.998$
- The system always catches spam emails, so $P(\text{flagged} | S) = 1$
- The system falsely flags legitimate emails $0.004$ of the time, so $P(\text{flagged} | L) = 0.004$
We want to find:
(i) $P(S | \text{flagged})$ the probability an email is truly spam given it was flagged.
(ii) $P(L | \text{not flagged})$ the probability an email is legitimate given it was not flagged.
2. **Formulas and rules:**
We use Bayes' theorem:
$$
P(A|B) = \frac{P(B|A)P(A)}{P(B)}
$$
where $A$ and $B$ are events.
Also, total probability rule:
$$
P(B) = P(B|A)P(A) + P(B|A^c)P(A^c)
$$
3. **Step (i): Calculate $P(S | \text{flagged})$**
- Calculate $P(\text{flagged})$:
$$
P(\text{flagged}) = P(\text{flagged}|S)P(S) + P(\text{flagged}|L)P(L) = 1 \times 0.002 + 0.004 \times 0.998
$$
$$
= 0.002 + 0.003992 = 0.005992
$$
- Apply Bayes' theorem:
$$
P(S|\text{flagged}) = \frac{P(\text{flagged}|S)P(S)}{P(\text{flagged})} = \frac{1 \times 0.002}{0.005992}
$$
- Simplify:
$$
P(S|\text{flagged}) = \frac{0.002}{0.005992} \approx 0.3336
$$
4. **Step (ii): Calculate $P(L | \text{not flagged})$**
- Calculate $P(\text{not flagged})$:
$$
P(\text{not flagged}) = 1 - P(\text{flagged}) = 1 - 0.005992 = 0.994008
$$
- Calculate $P(\text{not flagged}|L)$:
$$
P(\text{not flagged}|L) = 1 - P(\text{flagged}|L) = 1 - 0.004 = 0.996
$$
- Apply Bayes' theorem:
$$
P(L|\text{not flagged}) = \frac{P(\text{not flagged}|L)P(L)}{P(\text{not flagged})} = \frac{0.996 \times 0.998}{0.994008}
$$
- Simplify:
$$
P(L|\text{not flagged}) = \frac{0.994008}{0.994008} = 1
$$
5. **Interpretation:**
- If an email is flagged, there is about a 33.36% chance it is truly spam.
- If an email is not flagged, it is almost certainly legitimate (probability very close to 1).
**Final answers:**
(i) $P(S|\text{flagged}) \approx 0.3336$
(ii) $P(L|\text{not flagged}) \approx 1$
Conditional Probability Spam D87Dd1
Step-by-step solutions with LaTeX - clean, fast, and student-friendly.