Discrete Math for Data Science

DSCI 220, 2025 W1

October 22, 2025

Announcements

Sets Continued

Goals

  • Gallery through proofs

Warm Up

Suppose \(A = \{1, \{2\}\}\)

  1. Is \(1\in A\)?
  2. Is \(\{1\} \subseteq A\)?
  3. Is \(1 \subseteq A\)?
  4. Is \(\{1\} \in A\)?
  5. Is \(2\in A\)?
  1. Is \(\{2\} \subseteq A\)?
  2. Is \(2 \subseteq A\)?
  3. Is \(\{2\} \in A\)?
  4. Is \(\emptyset \in A\)?
  5. Is \(\emptyset \subseteq A\)?

Set Proofs

Setup

We’ll use these café sets:

\(I\) = “iced orders” ( df['is_iced'])

\(N\) = “non-dairy milk” (df['milk']=='Oat' | df['milk'] == 'Almond')

\(O\) = “oat-milk orders” (df['milk'] == 'Oat')

\(A\) = “almond-milk orders” (df['milk'] == 'Almond')

\(H\) = “high-caffeine” (df['caffeine_mg'] >= 150)

\(L\) = “low-calorie” (df['calories'] <= 150)

DeMorgan for Sets

By observation, you discovered that \((I\cup N)^c = I^c\cap N^c\). But is this always true?

 

Claim: For any sets \(A\) and \(B\), \((A\cup B)^c = A^c\cap B^c\).

 

Observations, before we begin:

  • universally quantified statement requires arbitrary instantiation of variables.
  • set equality \(A=B\) actually requires 2 proofs: \(A\subseteq B\) and \(B\subseteq A\).
  • to prove \(A\subseteq B\) we rely on the definition: For any \(x\), \(x\in A\rightarrow x\in B\).
  • following the form of the definition, we consider an arbitrary \(x\), assume \(x\in A\) and show \(x\in B\).

DeMorgan for Sets Proof

Claim: For any sets \(A\) and \(B\), \((A\cup B)^c = A^c\cap B^c\).

Proof: Consider arbitrary sets \(A\) and \(B\). We must show both \((A\cup B)^c\subseteq A^c\cap B^c\), and \(A^c\cap B^c\subseteq (A\cup B)^c\).

  1. Proof of \((A\cup B)^c\subseteq A^c\cap B^c\)
       Consider an arbitrary \(x\in\) ____________.

 

       Then, \(x\) is not in ____________.

 

       Hence, \(x\) is not in ________ and \(x\) is not in ________.

 

       Since \(x\) is not in \(A\), ________, and similarly, since \(x\) is not in \(B\), ________.

 

       It follows that \(x\in\) ____________ by definition of ____________.

DeMorgan for Sets Proof

Claim: For any sets \(A\) and \(B\), \((A\cup B)^c = A^c\cap B^c\).

Proof: Consider arbitrary sets \(A\) and \(B\). We must show both \((A\cup B)^c\subseteq A^c\cap B^c\), and \(A^c\cap B^c\subseteq (A\cup B)^c\).

  1. Proof of \(A^c\cap B^c\subseteq (A\cup B)^c\)

Intersection Narrows

Story: “Iced and high-caffeine” can’t include non-iced drinks.

Theorem: \(I\cap H \subseteq I\).

Proof:

 

 

Apply:

  • \(|I\cap H|\le |I|\)
  • every row in \(I\cap H\) has df['is_iced'] == True.

Union Widens

Story: Broadening a filter to “non-dairy or iced” can’t lose non-dairy orders.

Theorem: \(N \subseteq N\cup I\).

Proof:

 

 

Apply:

  • \(|N|\le |N\cup I|\)
  • every non-dairy row still passes the broader filter.

Union is Monotone

Story: Every oat drink is non-dairy. Then “oat or high-caffeine” is contained in “non-dairy or high-caffeine”.

Theorem: If \(O\subseteq N\), then \(O\cup H \subseteq N\cup H\).

Proof: Let \(x\in O\cup H\). Then \(x\in H\) or \(x\in O\).

  • If \(x\in H\), then \(x\in N\cup H\).
  • If \(x\in O\), then \(x\in N\) (since \(O\subseteq N\)), so \(x\in N\cup H\).

Apply: Replacing a condition by a superset inside an OR cannot shrink results.

Complement Flips the Order

Story: Since oat \(\subseteq\) non-dairy, anyone not non-dairy is certainly not oat.

Theorem: If \(O\subseteq N\), then \(N^{c}\subseteq O^{c}\).

Proof:


 

 

Apply: Negating a broader class yields a subset in the reverse direction.

Partition Identity

Story: Split iced orders by whether they’re non-dairy (\(N\)) or not (\(N^c\)). We should neither lose nor double-count any iced orders.

Theorem: For any sets \(I\) and \(N\), \[ (I\cap N)\ \cup\ (I\cap N^{c}) \;=\; I \quad\text{and}\quad (I\cap N)\ \cap\ (I\cap N^{c}) \;=\; \varnothing. \]

Apply:

  • Because the union is “disjoint”, \(|I| \;=\; |I\cap N| \;+\; |I\cap N^c|\)
  • This is the basis for the “Law of Total Probability,” which you will see someday!

Partition Identity Proof

Theorem: For any sets \(I\) and \(N\), \[ (I\cap N)\ \cup\ (I\cap N^{c}) \;=\; I \quad\text{and}\quad (I\cap N)\ \cap\ (I\cap N^{c}) \;=\; \varnothing. \]

Proof: