Random Signals for Engineers using MATLAB and Mathcad Copyright 1999 Springer Verlag NY Example 1.6 If we are given three sets { A, B, C } and probabilities of expression of these sets as follows P A 0.5 P A C 0.2 P A B C 01 . P A B C 0.05 What is P[ A 1 2 3 4 B ] ? SOLUTION: Since three sets are involved in the solution we can use the Venn Diagram and representation for these sets in example1.1. The regions that correspond to the problem statement are first identified. The vectors for the regions A, B, C from example 1.1 are first set up A=[2 4 5 7] A = 2 4 B=[3 4 7 8] 5 7 7 8 7 8 B = 3 4 C= [5 6 7 8] C = 5 6 and the universal vector is required since we are using the not operator U=[1:8] U = 1 2 3 4 5 6 7 8 The region that corresponds to Equation 2, 3 and 4 and P[ A B ] can be found using vectors A,B and C P A B C An=intersect(A,intersect(setdiff(U,B),setdiff(U,C))) An = 2 P A B C Bn=intersect(A,intersect(B,C)) Bn = 7 P A C Cn=intersect(A,C) Cn = 5 7 P A B dn=intersect(A,B) dn = 4 7 The Venn Diagram may also verify the regions but these formal methods are less prone to errors and the Venn diagram can be used as a check. The following equations can be written for the probabilities P 2...P7 and solved using the solve capability of Matlab. Setting up solve block we have syms p2 p4 p5 p7 eq1=p2 + p4 + p5 + p7 - 0.5; eq2=p5 + p7 - 0.2; eq3=p2 - 0.1; eq4=p7 - 0.05; S=solve(eq1,eq2,eq3,eq4) S = p2: p4: p5: p7: [1x1 [1x1 [1x1 [1x1 sym] sym] sym] sym] Equations represented are given above. The solution is double([S.p2 S.p4 S.p5 S.p7]) ans = 0.1000 The desired P[ A 0.2000 0.1500 0.0500 B ] is, therefore double(S.p4+S.p7) ans = 0.2500 Since the probabilities of sets represented by region 4 and region 7 are mutually exclusive and the probabilities of each of the sets add.