Skip to main content
\(\newcommand{\set}[1]{\{1,2,\dotsc,#1\,\}} \newcommand{\ints}{\mathbb{Z}} \newcommand{\posints}{\mathbb{N}} \newcommand{\rats}{\mathbb{Q}} \newcommand{\reals}{\mathbb{R}} \newcommand{\complexes}{\mathbb{C}} \newcommand{\twospace}{\mathbb{R}^2} \newcommand{\threepace}{\mathbb{R}^3} \newcommand{\dspace}{\mathbb{R}^d} \newcommand{\nni}{\mathbb{N}_0} \newcommand{\nonnegints}{\mathbb{N}_0} \newcommand{\dom}{\operatorname{dom}} \newcommand{\ran}{\operatorname{ran}} \newcommand{\prob}{\operatorname{prob}} \newcommand{\Prob}{\operatorname{Prob}} \newcommand{\height}{\operatorname{height}} \newcommand{\width}{\operatorname{width}} \newcommand{\length}{\operatorname{length}} \newcommand{\crit}{\operatorname{crit}} \newcommand{\inc}{\operatorname{inc}} \newcommand{\HP}{\mathbf{H_P}} \newcommand{\HCP}{\mathbf{H^c_P}} \newcommand{\GP}{\mathbf{G_P}} \newcommand{\GQ}{\mathbf{G_Q}} \newcommand{\AG}{\mathbf{A_G}} \newcommand{\GCP}{\mathbf{G^c_P}} \newcommand{\PXP}{\mathbf{P}=(X,P)} \newcommand{\QYQ}{\mathbf{Q}=(Y,Q)} \newcommand{\GVE}{\mathbf{G}=(V,E)} \newcommand{\HWF}{\mathbf{H}=(W,F)} \newcommand{\bfC}{\mathbf{C}} \newcommand{\bfG}{\mathbf{G}} \newcommand{\bfH}{\mathbf{H}} \newcommand{\bfF}{\mathbf{F}} \newcommand{\bfI}{\mathbf{I}} \newcommand{\bfK}{\mathbf{K}} \newcommand{\bfP}{\mathbf{P}} \newcommand{\bfQ}{\mathbf{Q}} \newcommand{\bfR}{\mathbf{R}} \newcommand{\bfS}{\mathbf{S}} \newcommand{\bfT}{\mathbf{T}} \newcommand{\bfNP}{\mathbf{NP}} \newcommand{\bftwo}{\mathbf{2}} \newcommand{\cgA}{\mathcal{A}} \newcommand{\cgB}{\mathcal{B}} \newcommand{\cgC}{\mathcal{C}} \newcommand{\cgD}{\mathcal{D}} \newcommand{\cgE}{\mathcal{E}} \newcommand{\cgF}{\mathcal{F}} \newcommand{\cgG}{\mathcal{G}} \newcommand{\cgM}{\mathcal{M}} \newcommand{\cgN}{\mathcal{N}} \newcommand{\cgP}{\mathcal{P}} \newcommand{\cgR}{\mathcal{R}} \newcommand{\cgS}{\mathcal{S}} \newcommand{\bfn}{\mathbf{n}} \newcommand{\bfm}{\mathbf{m}} \newcommand{\bfk}{\mathbf{k}} \newcommand{\bfs}{\mathbf{s}} \newcommand{\bijection}{\xrightarrow[\text{onto}]{\text{$1$--$1$}}} \newcommand{\injection}{\xrightarrow[]{\text{$1$--$1$}}} \newcommand{\surjection}{\xrightarrow[\text{onto}]{}} \newcommand{\nin}{\not\in} \newcommand{\prufer}{\mbox{prüfer}} \DeclareMathOperator{\fix}{fix} \DeclareMathOperator{\stab}{stab} \DeclareMathOperator{\var}{var} \newcommand{\inv}{^{-1}} \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section7.2The Inclusion-Exclusion Formula

Now that we have an understanding of what we mean by a property, let's see how we can use this concept to generalize the process we used in the first two examples of the previous section.

Let \(X\) be a set and let \(\mathcal{P}=\{P_1,P_2,\dots,P_m\}\) be a family of properties. Then for each subset \(S\subseteq [m]\), let \(N(S)\) denote the number of elements of \(X\) which satisfy property \(P_i\) for all \(i\in S\). Note that if \(S=\emptyset\), then \(N(S)=|X|\), as every element of \(X\) satisfies every property in \(S\) (which contains no actual properties).

Returning for a moment to Example 7.1 with \(P_1\) being “is a computer science major” and \(P_2\) being “is male,” we note that \(N(\{1\})=47\), since there are \(47\) computer science majors in the class. Also, \(N(\{2\})=51\) since \(51\) of the students are male. Finally, \(N(\{1,2\})=45\) since there are \(45\) male computer science majors in the class.

In the examples of the previous section, we subtracted off \(N(S)\) for the sets \(S\) of size \(1\) and then added back \(N(S)\) for the set of properties of size \(2\), since we'd subtracted the number of things with both properties (male computer science majors or solutions with both \(x_3>7\) and \(x_4'>8\)) twice. Symbolically, we determined that the number of objects satisfying none of the properties was \begin{equation*} N(\emptyset) - N(\{1\}) - N(\{2\}) + N(\{1,2\}). \end{equation*}

Suppose that we had three properties \(P_1,P_2\), and \(P_3\). How would we count the number of objects satisfying none of the properties? As before, we start by subtracting for each of \(P_1\), \(P_2\), and \(P_3\). Now we have removed the objects satisfying both \(P_1\) and \(P_2\) twice, so we must add back \(N(\{1,2\})\). similarly, we must do this for the objects satisfying both \(P_2\) and \(P_3\) and both \(P_1\) and \(P_3\). Now let's think about the objects satisfying all three properties. They're counted in \(N(\emptyset)\), eliminated three times by the \(N(\{i\})\) terms, and added back three times by the \(N(\{i,j\})\) terms. Thus, they're still being counted! Thus, we must yet subtract \(N(\{1,2,3\})\) to get the desired number: \begin{equation*} N(\emptyset) - N(\{1\}) - N(\{2\}) - N(\{3\}) + N(\{1,2\}) + N(\{2,3\}) + N(\{1,3\}) - N(\{1,2,3\}). \end{equation*} We can generalize this as the following theorem:

Proof