Question:
A program consists of two modules. The first module contains an error with probability $0.2$. The second module is more complex, it has probability of $ \ 0.4$ to contain an error, independently of the first module. An error in the first module alone causes the program to crash with probability $ \ 0.5$. For the second module alone, this probability is $ \ 0.8$. If there are errors in both modules, the program crashes with probability $ \ 0.9$
1). What is the probability of a crash?
2). Suppose the program crashed. What is the probability of errors in both modules.
My attempt:
Let $ \ E_{1}:$ error in first module, $ \ E_{2}:$ error in second module, $ \ C :$ crash.
We know $ \ P(E_{1}) = 0.2, P(E_{2}) = 0.4, P(C|E_{1}) = 0.5, P(C|E_{2}) = 0.8, P(C|E_{1} \cap E_{2}) = 0.9$
$1). $$ \ P(C) = P(C \cap E_{1}) + P(C \cap E_{2}) = P(C|E_{1})P(E_{1}) + P(C|E_{2})P(E_{2}) = 0.42$
Therefore, probability of crash is $ \ 0.42$
$2)$ $P(E_{1} \cap E_{2} | C) = \frac{P[E_{1} \cap E_{2} \cap C]}{P(C)} = \frac{P[C|(E_{1} \cap E_{2})] P(E_{1} \cap E_{2})}{P(C)} = \frac{P[C|(E_{1} \cap E_{2})] P(E_{1}) P(E_{2})}{P(C)} $, since $ \ E_{1}$ and $ \ E_{2}$ are independant $ \ = \frac{(0.9)(0.2)(0.4)}{(0.42)} = 0.1714$
Is my approach and attempt correct? I am not too sure.