Writing
An Introduction to Probability and Random Variables for Pattern Recognition 1
19 January 2018Updated 14 October 20269 min read
An introduction to the probability theory behind statistical pattern recognition. This first part covers the axioms of probability, conditional probability, independence and the law of total probability through worked examples.
Axioms
The theory of probability forms the backbone of learning and research in statistical pattern recognition. Probability theory is one of the most amazing fields of mathematics, and it rests on three simple axioms.
-
The probability of an event , written , is greater than or equal to zero.
-
If and are mutually exclusive, which means they cannot happen together, then the probability of or is the probability of plus the probability of .
The formal statement of this axiom extends the rule to any countable collection of mutually exclusive events.
-
The probability of the entire sample space is .
These three axioms make probability theory self-checking. No probability is less than , and the probabilities of all the outcomes in a discrete sample space add up to . Also observe that the only arithmetic operator in the axioms is the (plus) sign. When we begin to combine and apply the axioms, the other arithmetic operations begin to emerge.
Suppose we have a sample space with six outcomes, to , and the probabilities shown in Figure 1 below.
Let us check that this sample space is valid:
- Is every probability greater than or equal to zero? Yes.
- Do the probabilities add up to ? Yes. .
- The outcomes are mutually exclusive. So we can find the probability of any event by adding the probabilities of its outcomes. For example:
Dependence: Conditional Probability
The probability of event given that event has already occurred is written . The vertical bar "" reads "given". is the probability that both and occur, , divided by the probability of , . The definition holds when .
This formula is intuitive. Suppose we want the probability of a given that the outcome is odd, . If we keep only the odd outcomes from the sample space, their probabilities are , and . These add up to , so they no longer form a valid probability distribution. We normalize them by dividing each probability by their sum, , as shown in Figure 2. We can then read the probability of a from the normalized sample space.
The outcome is odd, so the event " and odd" is the event "". The result is:
Rearranging the definition gives the product rule:
Independence
Two events and are independent if knowing that occurred tells us nothing about whether occurs. Suppose we are asked for the probability of a given that it snowed in Lagos, . The answer is simply , because whether it snowed in Lagos has no bearing on the outcome. Formally, and are independent when . When , this is the same as saying :
Total Probability
Suppose a random variable takes the values to , and its distribution depends on a second random variable . has two outcomes, and , with and . When , we draw from the distribution on the left of Figure 3. When , we draw from the distribution on the right.
Suppose we are asked:
- What is the probability that given , ? We read the answer, , from the distribution of when .
- What is the probability that given , ? We read the answer, , from the distribution of when .
Now suppose we are asked for the probability that , . We cannot read this from either distribution because we are not told the value of . We can still derive it. The events and are mutually exclusive, and together they make up the event . The second axiom lets us add their probabilities, and the product rule in Equation (1) gives each of them:
In general, when the outcomes of are mutually exclusive and cover every possibility, the law of total probability states:

Ekaba Bisong is a Ph.D. researcher at the University of Victoria and the founder of SiliconBlast. More about me