# Rules of Probability

### Union

The union of two sets encompasses any element that exists in either one or both of them. We can represent this visually as a venn diagram as shown. Union is often represented as:

$(A\ or\ B)$ ### Intersection

The intersection between two sets encompasses any element that exists in BOTH sets and is often written out as:

$(A\ and\ B)$ If there are two events, A and B, the addition rule states that the probability of event A or B occurring is the sum of the probability of each event minus the probability of the intersection:

$P(A\ or\ B) = P(A) + P(B) - P(A\ and\ B)$

If the events are mutually exclusive, this formula simplifies to:

$P(A\ or\ B) = P(A) + P(B)$ ### Multiplication Rule

The multiplication rule is used to find the probability of two events, A and B, happening simultaneously. The general formula is:

$P(A \text{ and } B) = P(A) \cdot P(B \mid A)$

For independent events, this formula simplifies to:

$P(A \text{ and } B) = P(A) \cdot P(B)$

This is because the following is true for independent events:

$P(B \mid A) = P(B)$

The tree diagram shown displays an example of the multiplication rule for independent events. ### Complement

The complement of a set consists of all possible outcomes outside of the set.

Let’s say set A is rolling an odd number with a 6-sided die: {1, 3, 5}. The complement of this set would be rolling an even number: {2, 4, 6}.

We can write the complement of set A as AC. One key feature of complements is that a set and its complement cover the entire sample space. In this die roll example, the set of even numbers and odd numbers would cover all possible rolls: {1, 2, 3, 4, 5, 6}. ### Independent Events

Two events are independent if the occurrence of one event does not affect the probability of the other one occurring.

Let’s say we have a bag of five marbles: three are red and two are blue. If we select two marbles out of the bag WITH replacement, the probability of selecting a blue marble second is independent of the outcome of the first event.

The diagram below outlines the independent nature of these events. Whether a red marble or a blue marble is chosen randomly first, the chance of selecting a blue marble second is always 2 in 5. ### Dependent Events

Two events are dependent if the occurrence of one event does affect the probability of the other one occurring.

Let’s say we have a bag of five marbles: three are red and two are blue. If we select two marbles out of the bag WITHOUT replacement, the probability of selecting a blue marble second depends on the outcome of the first event.

The diagram below outlines this dependency. If a red marble is randomly selected first, the chance of selecting a blue marble second is 2 in 4. Meanwhile, if a blue marble is randomly selected first, the chance of selecting a blue marble second is 1 in 4. ### Mutually Exclusive Events

Two events are considered mutually exclusive if they cannot occur at the same time. For example, consider a single coin flip: the events “tails” and “heads” are mutually exclusive because we cannot get both tails and heads on a single flip.

We can visualize two mutually exclusive events as a pair of non-overlapping circles. They do not overlap because there is no outcome for one event that is also in the sample space for the other. ### Conditional Probability

Conditional probability is the probability of one event occurring, given that another one has already occurred. We can represent this with the following notation:

\begin{aligned} \text{Probability of event A occurring given event B has occurred} \\ P(A \mid B) \\ \end{aligned}

For independent events, the following is true for events A and B:

\begin{aligned} P(A \mid B) = P(A) \\ \text{and} \\ P(B \mid A) = P(B) \\ \end{aligned}

### Bayes’ Theorem

Bayes’ theorem is a useful tool to find the probability of an event based on prior knowledge. The formula for Bayes’ theorem is:

$P(B \mid A) = \frac{P(A \mid B) \cdot P(B)}{P(A)}$