Check out my previous post on the four main rules of probability first and come back to this post to see a very nice example.

Example:

Consider we have two boxes a blue and a green, there are a number of marbles in each box. Let’s say in the green box there are two black marbles and six red marbles. Also in the blue box there are one red marble and three black marbles.

If the probability of selecting the green box is 0.4, calculate all the marginal probabilities.

Let’s consider the boxes as a probability variable , and the marbles as another probability variable, .

The probability of selecting the green box is 0.4, it means that . We can calculate the as follows:

If we select the blue box (including one red and three black marbles), the probability of selecting the red marble is:

And then the probability of selecting a black marble from the blue box is

If we select the green box (including two black and six red marbles), the probability of selecting the red marble is:

And then the probability of selecting a black marble from the blue box is

The overall probability of choosing a red marble can be calculated using the sum and the product rules as follows:

Then the probability of choosing a black marble is

Reversing the conditional probability we can calculate other probabilities as well, for instance, can be calculated using the Bayes theorem as follows: