Understanding the mathematical formula for the Inclusion and Exclusion Principle. In my Discrete Structures class we covered the Principle of Inclusion and Exclusion. The formula that we looked at is:
$$\left | \bigcup_{i = 1}^n A_i \right |= \sum_{r=1}^n \left( (-1)^{r-1} \sum_{\mathcal{L} \subseteq [n]:|\mathcal{L}|=r } \left | \bigcap_{j \in \mathcal{L}} A_j\right | \right)$$
I understand what the overall formula means, however I would like to know what each of these terms mean. I understand the left side:
$\left | \bigcup_{i = 1}^n A_i \right | = \left | A_1 \cup A_2 \cup \ ... \cup A_n\right |$
However, the right side is a bit tricky for me to fully understand. If you can explain, in a simple one-liner, what each one of the terms (especially the squiggly L symbol) mean, it would be great.
 A: In the context of discrete math I suppose that $|\cdot|$ means counting. The inner sum is over all subsets $L$ of $\{1,...,n\}$ of size $r$. Instead of just trying to learn this formula by heart I think it is better to understand where it comes from. If you let $1_A$ be the indicator function of a set $A$, then clearly $1_A 1_B=1_{A\cap B}$. So multiplying corresponds to taking intersections. To get an indicator function of a union you take complements:
$$ 1- 1_{A_1\cup \cdots \cup A_n} = 1_{A_1^c \cap ...\cap A_n^c} = 1_{A_1^c} \cdots 1_{A_n^c} = $$
$$(1-1_{A_1}) \cdots (1-1_{A_n})$$
The formula you state
 comes from unwrapping this product, use the above-mentioned  intersection principle on each term and finally
 counting over the whole ambient set.
A: Drawing an example would help, but in a nutshell: the right-hand side takes into account all possible intersections between all involved sets. For example with three finite sets $A_1, A_2, A_3$, if you add all their cardinalities, you have counted twice the elements that belong in $A_1\cap A_2, A_2\cap A_3$ and $A_3\cap A_1$, so you have to remove these (hence the first minus sign). But doing this, you removed twice the elements that belong to $A_1\cap A_2\cap A_3$, so you have to add those back. And so on and so forth if $n$ is larger, the arrangement of all sets becoming more complicated to enumerate.
So, the "squiggly L" is just a compact notation to do that tedious enumeration, and amounts to saying that you're summing over all possible sets of indices, that is, of any cardinalities less than $n$, so that you can consider all possible intersections and add/remove them accordingly.
