Q 29: Suppose that the probability that a pedestrian will be hit by a car while crossing the road at a pedestrian crossing without paying attention to the traffic light is to be computed. Let H be a discrete random variable taking one value from {Hit, Not Hit}. Let L be a discrete random variable taking one value from {Red, Yellow, Green}.
Realistically, H will be dependent on L. That is, P(H = Hit) and P(H = Not Hit) will take different values depending on whether L is red, yellow or green. A person is, for example, far more likely to be hit by a car when trying to cross while the lights for cross traffic are green than if they are red. In other words, for any given possible pair of values for H and L, one must consider the joint probability distribution of H and L to find the probability of that pair of events occurring together if the pedestrian ignores the state of the light.
Here is a table showing the conditional probabilities of being hit, depending on the state of the lights. (Note that the columns in this table must add up to 1 because the probability of being hit or not hit is 1 regardless of the state of the light.)
Conditional distribution: P(HL) 

L=Green 
L=Yellow 
L=Red 

H=Not Hit 
0.99 
0.9 
0.2 
H=Hit 
0.01 
0.1 
0.8 
To find the joint probability distribution, we need more data. Let's say that P(L=green) = 0.2, P(L=yellow) = 0.1, and P(L=red) = 0.7. Multiplying each column in the conditional distribution by the probability of that column occurring, we find the joint probability distribution of H and L, given in the central 2×3 block of entries. (Note that the cells in this 2×3 block add up to 1).
Joint distribution: P(H,L) 


L=Green 
L=Yellow 
L=Red 
Marginal probability P(H) 

H=Not Hit 
0.198 
0.09 
0.14 
0.428 
H=Hit 
0.002 
0.01 
0.56 
0.572 
Total 
0.2 
0.1 
0.7 
1 