\documentclass[11pt]{article} \usepackage[margin=1in,headheight=24pt]{geometry} \usepackage{fancyhdr} \setlength{\headheight}{55pt} \usepackage{hyperref} \usepackage{tcolorbox} \usepackage{xcolor} \usepackage{amsfonts,amsmath,amssymb,amsthm} \usepackage{mathtools} \usepackage{subcaption} \usepackage{tikz} \usepackage{tikz-network} \newtheorem{theorem}{Theorem}[section] \newtheorem{axiom}[theorem]{Axiom} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{fact}[theorem]{Fact} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{remark}[theorem]{Remark} \definecolor{black}{RGB}{0,0,0} \definecolor{orange}{RGB}{230,159,0} \definecolor{skyblue}{RGB}{86,180,233} \definecolor{bluishgreen}{RGB}{0,158,115} \definecolor{yellow}{RGB}{240,228,66} \definecolor{blue}{RGB}{0,114,178} \definecolor{vermillion}{RGB}{213,94,0} \definecolor{reddishpurple}{RGB}{204,121,167} \definecolor{cugold}{RGB}{207,184,124} \pagestyle{plain} \fancypagestyle{firstpage}{ \fancyhf{} \renewcommand{\headrulewidth}{0pt} \fancyhead[c]{ \makebox[\textwidth][l]{\textbf{MATH 6404: Applied [Combinatorics and] Graph Theory} \hfill CU Denver} \\ \rule{\textwidth}{0.5pt} \\ \makebox[\textwidth][l]{Spring 2026 \hfill Instructor: Carlos Mart\'inez} } \fancyfoot[C]{\thepage} } \newcommand{\scribebox}[4]{ \begin{tcolorbox}[colback=cugold!40,colframe=black,left=6pt,right=6pt,top=10pt,bottom=10pt] \centering \textbf{Lecture #1:} #2 \\ \textbf{Date:} #3 \hfill \textbf{Scribe:} #4 \end{tcolorbox} } %%% -+-+-+-+-+-+- BEGIN HERE -+-+-+-+-+-+- %%% \newcommand{\lecturenumber}{$3$} \newcommand{\lecturetitle}{The Principle of Inclusion-Exclusion (PIE) and Applications} \newcommand{\scribename}{Simon Ruland} \newcommand{\lecturedate}{February 25, 2026} \begin{document} \thispagestyle{firstpage} \scribebox{\lecturenumber}{\lecturetitle}{\lecturedate}{\scribename} Recall the sum principle: $$|S \sqcup T| = |S| + |T|$$ The disjoint union is required. You may recall from prior life that 1) $$|S \cup T| = |S| + |T| - |S \cap T|$$ Every element in the intersection is counted twice in the first part. The double-counting must be corrected. Goal: Generalize 1) to work with any finite collection $$S_1, S_2, .. S_n \subseteq S$$ For n=2, $$|S| = |S_1 \cup S_2| + |S \setminus (S_1 \cup S_2)|$$ So if we know $|S|$ and $|S \setminus (S_1 \cup S_2)|$, then we know $|S_1 \cup S_2|$. We will focus on terms like $|S \setminus (S_1 \cup S_2)|$. \begin{theorem} The Principle of Inclusion and Exclusion: Let S be finite and $S_1, S_2, ..., S_n \subseteq S$. Then, $$|S\setminus \bigcup_{1\leq i \leq n}S_i| = |S| - \sum_{1 \leq i \leq n} |S_i| + \sum_{1 \leq i < j \leq n} |S_i \cap S_j| - ... + (-1)^n |\bigcap_{1\leq i \leq n} S_i|$$ \end{theorem} \begin{proof} It suffices to show that for any s in S, its contribution to LHS is the same as its contribution to RHS. Consider any s in S; there are two cases: 1) $$s\notin \bigcup_{i=1}S_i$$. LHS: So, $s \in \bigcup_{i=1}^nS_i$ which contributes 1 to the count. RHS: s is in S, so it is accounted for in $|S|$. s is not in any of the intersections, so in total it contributes 1 to the count of RHS. 2) $$s \in \bigcup_{i=1}^nS_i$$. Suppose $s \in S_i$ for exactly $m \geq 1$ of the sets $S_1, S_2, ...,S_n$ LHS: $$s \notin S\setminus U_{i=1}^nS_i$$ so it contributes 0 to LHS. RHS: We know that $s \in S_i \cap S_{i_2}, ... S_{j_k}$, a k-subset of the m subsets that contain s. Based on the alternating signs, $$0 = \binom{m}{0}-\binom{m}{1}+\binom{m}{2}- ... + (-1)^m\binom{m}{m}$$ because $$\sum_{\text{k is odd}}\binom{m}{k} = \sum_{\text{k is even}}\binom{m}{k}$$ \end{proof} Application 1: Derangements A permutation is a bijection $$\pi:[n] \rightarrow [n] $$ For example, in one line notation and function notation we have $$\pi = 4,1,2,3$$ $$\pi(1) = 2, \pi(2) = 3, \pi(3) = 4, \pi(4) = 1$$ A permutation is a derangement if $\pi(i) \neq i \ \forall i \in [n]$. How many derangements of [n] are there? Idea: use PIE to ``count with restrictions'': \begin{enumerate} \item S: the set of all objects \item $S_i$: the subset of S that violates the ith restriction \item $S \setminus\bigcup_{i=1}^n S_i$: the subset of S that meet all restrictions. \end{enumerate} In the case of derangements, \begin{enumerate} \item $S=\mathcal{S}_n$, the set of all permutations on [n] \item $S_i \subseteq \mathcal{S}_n$ such that $\pi \in S_i \iff \pi(i) = i$ \item $S\setminus\bigcup_{i=1}^n S_i$ is the set of derangements So the number of derangements is $D(n) = |S\setminus\bigcup_{i=1}^n S_i|$ \end{enumerate} $\pi = 1,2,...n \implies \pi \in S_i \forall i \in [n]$. The intersections over $S_1,..,S_n$ are non-trivial. Note that any $\pi \in S_i$ looks like $$\pi^{-1}(1), \pi^{-1}(2), ..., \pi^{-1}(i-1), i, \pi^{-1}(i+1), ..., \pi^{-1}(n)$$ Except for the i, $\pi$ is a permutation on n-1 letters. $|S_i| = (n-1)!$ There are $\binom{n}{1}$ choices for $S_i$, so $$ \sum_{i=1}^n |S_i| = \binom{n}{1}(n-1)! = n(n-1)! = n!$$ Similarly, any $\pi \in S_i \cap S_j$ looks like $$\pi^{-1}(1), ..., \pi^{-1}(i-1), \pi^{-1}, i , (i+1), ..., \pi^{-1}(j-1), j, \pi^{-1}(j+1), ..., \pi^{-1}(n)$$ Except for i and j, $\pi$ is a permutation on n-2 letters. $$|S_i\cap S_j| = (n-2)!$$ There are $\binom{n}{2}$ options for $S_i, S_j$, so $$\sum_{i