Bayes rule and other problems

Bayes rule states that

P(A|B)=P(B|A)P(A)/(P(B|A)P(A)+P(B|A')P(A'))

Given one set of conditional probabilities, it enables one to calculate conditional probabilities with the reverse conditioning. However, we shall focus on the fact that Bayes rule enables one to calculate other probabilities when three probabilities (in this case: P(B|A), P(B|A'), and P(A); P(A')=1-P(A)) are given.

A Venn diagram for two events divides the sample space into four disjoint subsets: AB, A'B, AB', A'B'. The probabilities of these four events can be concisely represented with a square:

```               A      A'
_____________
|      |      |
B  |  x   |  y   |  x+y=P(B)
|______|______|
|      |      |
B' |  z   |  w   |  z+w=P(B')
|______|______|___
x+z=   y+w= |
P(A)   P(A')|  1
```
In accordance with the row and column labels, this square means that P(AB)=x, P(A'B)=y, P(AB')=z, and P(A'B')=w. P(A)=x+z and P(B)=x+y as indicated above. P(A|B) = P(AB)/P(B) = x/(x+y); and the other conditional probabilities can be represented in a similar manner.

There are four unknowns (x, y, z, and w) in the above square, in terms of which all the probabilities we are interested in can be calculated. One constraint is that x+y+z+w=1 (P(S)=1); hence it is reasonable that three further equations would enable us to solve for x, y, z, and w, hence all probabilities.

Examples:

• (Bayes rule) P(A)=.5, P(B|A)=.2, P(B|A')=.6; P(A|B)=?
From P(A')=1-P(A), the above square becomes:
```               A      A'
_____________
|      |      |
B  |  x   |  y   |  x+y=P(B)
|______|______|
|      |      |
B' |  z   |  w   |  z+w=P(B')
|______|______|___
|
.5     .5  |  1
```
Then P(B|A)=.2 becomes x ÷ .5 = .2 which provides x=.1; x+z=.5 then provides z=.4, and we are now looking at:
```               A      A'
_____________
|      |      |
B  |  .1  |  y   |  x+y=P(B)
|______|______|
|      |      |
B' |  .4  |  w   |  z+w=P(B')
|______|______|___
|
.5     .5  |  1
```
Finally, P(B|A')=.6 becomes y ÷ .5 =.6 which provides y=.3, and w=.2 follows. summing x+y and z+w lets us complete the square:
```               A      A'
_____________
|      |      |
B  |  .1  |  .3  |  .4
|______|______|
|      |      |
B' |  .4  |  .2  |  .6
|______|______|___
|
.5     .5  |  1
```
From this we can readily calculate P(A|B)=.1/.4=.25, or any other probability we wish.

• P(B|A)=.5, P(A')=.6, P(B')=.4;
We can immediately record P(A') (and P(A)) and P(B') (and P(B)) in the square:
```               A      A'
_____________
|      |      |
B  |  x   |  y   |  .6
|______|______|
|      |      |
B' |  z   |  w   |  .4
|______|______|___
|
.4     .6  |  1
```
P(B|A)=.5 then becomes x ÷ .4 = .5, hence x = .2.
```               A      A'
_____________
|      |      |
B  |  .2  |  y   |  .6
|______|______|
|      |      |
B' |  z   |  w   |  .4
|______|______|___
|
.4     .6  |  1
```
The rest of the square can be completed by .2+z=.4, .2+y=.6, and z(now known)+ w=.4.
```               A      A'
_____________
|      |      |
B  |  .2  |  .4  |  .6
|______|______|
|      |      |
B' |  .2  |  .2  |  .4
|______|______|___
|
.4     .6  |  1
```

• P(B|A)=1/4, P(A|B)=1/3, P(A)=2/5.
The probability of A (and its complement) is the easiest information to record.
```               A      A'
_____________
|      |      |
B  |  x   |  y   |  x+y=P(B)
|______|______|
|      |      |
B' |  z   |  w   |  z+w=P(B')
|______|______|___
|
2/5   3/5  |  1
```
Now P(B|A)=1/4 becomes x/(2/5)=1/4, or x=1/10. (Indeed x/(x+y)=1/3 is somewhat intimidating). z=3/10 since x+z=2/5.
```               A      A'
_____________
|      |      |
B  | 1/10 |  y   |  x+y=P(B)
|______|______|
|      |      |
B' | 3/10 |  w   |  z+w=P(B')
|______|______|___
|
2/5   3/5  |  1
```
Now P(A|B)=1/3 is (1/10)/((1/10)+y)=1/3 which provides (1/10)+y=3/10 or y=2/10 and the square can be completed.
```               A      A'
_____________
|      |      |
B  | 1/10 | 2/10 |  3/10
|______|______|
|      |      |
B' | 3/10 | 4/10 |  7/10
|______|______|___
|
2/5   3/5  |  1
```