A shop is equipped with an alarm system which in case of burglary alerts police with probability $0.99$. During a night without a burglary, a false alarm is set off with probability $0.002$. The probability of a burglary on a given night is $0.0005$. An alarm has just gone off. What is the probability a burglarly is going on?
What I've got so far (not much):
$A:=$ "burglary alerts police" $\Rightarrow P(A)=0.99$
$B|C^{c}:=$"a false alarm is set off, given that it is a night without a burglarly" $\Rightarrow P(B|C^{c})=\frac{P(B \cap C^{c})}{P(C^{c})}=\frac{P(B \cap C^{c})}{1-P(C)}=\frac{P(B \cap C^{c})}{0.9995}=0.002\Rightarrow P(B \cap C^{c})=0.9995\times 0.002$
$C:=$"The probability of a burglary on a given night" $\Rightarrow P(C)=0.0005$
I this sense, I do not know how to define "Given that an alarm has just gone off, a burglarly is going on" set-theoretically.
Let $A$ be the event in which a burglary is going on, $B$ the event in which the alarm is triggered. We then find:
$$P(B) = P(A) P(B | A) + P(\lnot A) P(B | \lnot A) = 0.0005 \cdot 0.99 + 0.9995 \cdot 0.002 = 0.002494$$
Using Bayes' theorem, we find:
$$P(A | B) = \frac{P(A \cap B)}{P(B)} = \frac{0.0005⋅0.99}{0.0005 \cdot 0.99 + 0.9995 \cdot 0.002} = \frac{0.000495}{0.002494} = 0.1985$$