# Fundamentals

## Union of two events

$p(A \cup B) = p(A) + p(B) - p(A \cap B)$

## Joint probabilities

$p(A, B) = p(A \cap B) = p(A|B)p(B)$

This is known as the **product rule**.

Given a joint distribution on two events $p(A, B)$, we define the marginal distribution as follows:

$p(A) = \sum_{b}p(A, B) = \sum_{b}{p(A|B=b)p(B=b)}$

This is the **sum rule** or the **rule of total probability**.

## Conditional probability

Conditional probability of event $A$, given that $B$ is true:

$p(A|B) = \frac{p(A,B)}{p(B)} \text{ if } p(B) > 0$