Theorem of total probability and Bayes' theorem apply to any partition. Here two partitions matter: by line (L1, L2) and by condition (faulty D, good D′). Each path through the tree is a product of conditional probabilities.
Given: P(L1)=0.7, P(L2)=0.3; P(D∣L1)=0.04, P(D∣L2)=0.12; scanner: P(S∣D)=0.9, P(S∣D′)=0.1, where S is "flagged". To find: P(S), P(D∣S), P(L2∣S), P(D∣S′).
Step 1 — flag rate for each line. Within each line, partition by faulty / good:
P(S∣L1)=0.04×0.9+0.96×0.1=0.036+0.096=0.132
P(S∣L2)=0.12×0.9+0.88×0.1=0.108+0.088=0.196
Step 2 — part (i). Partition by line:
P(S)=0.7×0.132+0.3×0.196=0.0924+0.0588=0.1512
Step 3 — part (ii). Faulty and flagged boxes come from the paths L1→D→S and L2→D→S:
P(D∩S)=0.7×0.04×0.9+0.3×0.12×0.9=0.0252+0.0324=0.0576
P(D∣S)=0.15120.0576=1512576=218
Step 4 — part (iii). By Bayes' theorem with the partition by line,
P(L2∣S)=P(S)P(L2)P(S∣L2)=0.15120.0588=1512588=187
Step 5 — part (iv). P(S′)=1−0.1512=0.8488. Faulty boxes that are missed by the scanner:
P(D∩S′)=0.7×0.04×0.1+0.3×0.12×0.1=0.0028+0.0036=0.0064
P(D∣S′)=0.84880.0064=848864=10618
Answer: (i) 0.1512; (ii) 218≈0.381; (iii) 187≈0.389; (iv) 10618≈0.0075.
Note: Fewer than half of the flagged boxes are faulty, because good boxes are so much more common that their 10% false flags outnumber the true flags. Line II supplies only 30% of boxes but 187 of flagged ones, since its boxes are faulty more often.