Two events are independent if knowing the outcome of one event does not affect the probability of the other event occurring.
## for simple probability
Formally, we say $P(A|B) = P(A)$, $P(B|A) = P(B)$.
To prove that any set of events is **mutually independent**, we must show for all events and *every subset of events*
$P(A_1 \cap A_2 \cap \dots \cap A_i) = P(A_1) P(A_2) \dots P(A_i)$
In other words, we must show that $P(A_1 \cap A_2) = P(A_1)P(A_2)$ and $P(A_1 \cap A_3) = P(A_1) P(A_3)$ and so on for every grouping.
Disjoint events, where $P(A \cap B) = 0$ are not independent events because knowing that $B$ has occurred means that $A$ cannot occur.
Using the notation of a [[probability density function]], it is equivalent to say two random variables are independent if $f(x,y) = f(x)*f(y)$ for all possible values of $x$ and $y$.
## for joint probability density functions
$X$ and $Y$ are [[independent]] if their joint [[probability density function]] is a product of their marginal pdfs. Formally, $X$ and $Y$ are independent if
$f(x,y) = f_x(x) * f_y(y)$
### shortcuts
Here are some shortcuts to testing for independence using joint pdfs.
If the joint pdfs for $X$ and $Y$ factor into an $X$ part and a $Y$ part with indicator variables, where the opposite variable is not a part of the indicator variable, $X$ and $Y$ are independent.
For example, the joint pdf $f(x,y) = 16xy$ where $0 < x < y < 1$ can be written as
$f(x,y) = 16xy \ I_{(0,y)}(x) \ I_{(0,1)}(y)$
Here, $X$ and $Y$ are not independent because the indicator variable for $x$ includes $y$. (See [[integration with indicator variables]] for a more complete explanation.) You might intuit this because if we know $x$, then we know that $y$ must be at least large, and so knowing the value of $x$ affects the probability of $y$ taking on some value.
In contrast, the joint pdf $f(x,y) = xy$ where $0 < x < 1$ and $0 < y < 2$ can be written as
$f(x,y) = xy \ I_{(0,1)}(x) \ I_{(0,2)}(y)$
Here, $X$ and $Y$ are independent because the indicator variables do not include the other variable. To prove this, we can factor the marginal pdfs for $x$ and $y$ and test whether their product is the joint pdf.
$\displaylines{
f_x(x) = \frac12 x \ \text {, } f_y(y) = 2 y \\
xy = \frac12 x * 2 y
}$
If the graph of the base of the region over which you are integrating is a rectangle, it is a strong indication two random variables are independent.
#refactor