Practical examples of set theory notation in problem solving
Starting with concrete examples of set theory notation in problem solving
Before reviewing terminology, it’s more helpful to see how set notation actually appears inside problems. Here are a few representative scenarios where the notation isn’t just decoration; it does real work.
Example 1: Students taking math and science
Suppose a class has 40 students. Let
- M = set of students taking math
- S = set of students taking science
You’re told:
- |M| = 28 (28 students take math)
- |S| = 25 (25 students take science)
- |M ∩ S| = 18 (18 students take both)
How many students take at least one of the two subjects?
Set theory notation makes the question short:
Find |M ∪ S| given |M|, |S|, and |M ∩ S|.
Use the standard identity:
[
|M ∪ S| = |M| + |S| − |M ∩ S|.
]
So:
[
|M ∪ S| = 28 + 25 − 18 = 35.
]
That’s a classic example of set theory notation in problem solving: the union symbol ∪ and intersection symbol ∩ let you express “at least one” and “both” with almost no words.
Example 2: Survey with three activities (union and inclusion–exclusion)
Now add a third set and see the notation scale up.
In a survey of 100 people:
- 60 jog (set J)
- 50 do yoga (set Y)
- 40 cycle (set C)
- 25 do both jogging and yoga (J ∩ Y)
- 20 do both jogging and cycling (J ∩ C)
- 15 do both yoga and cycling (Y ∩ C)
- 10 do all three (J ∩ Y ∩ C)
How many people do at least one of the three activities? Again, the question becomes:
Find |J ∪ Y ∪ C|.
Using the three-set inclusion–exclusion formula:
[
|J ∪ Y ∪ C| = |J| + |Y| + |C| − |J ∩ Y| − |J ∩ C| − |Y ∩ C| + |J ∩ Y ∩ C|.
]
Plug in the numbers:
[
|J ∪ Y ∪ C| = 60 + 50 + 40 − 25 − 20 − 15 + 10 = 100.
]
So everyone in the survey does at least one activity. This is one of the best examples of set theory notation in problem solving for contests and standardized tests: once you recognize the pattern, the symbols practically guide you to the formula.
Everyday examples of set theory notation in problem solving
Set notation isn’t just for textbook puzzles. It quietly powers a lot of everyday decision-making and modern tech.
Example 3: Filtering a streaming catalog (intersection and difference)
Imagine a streaming platform. Let
- M = set of all movies
- A = set of action titles
- T = set of titles available in 4K
You want action movies in 4K, but not older than 2010.
Model it like this:
- A ∩ T = action movies that are also in 4K
- Let Y = set of titles released before 2010
- Then (A ∩ T) \ Y = action 4K movies released in 2010 or later.
That difference symbol \ (sometimes written as −) is how you encode “but not” in a precise way. Modern databases and query languages (like SQL) mirror this idea with intersections (JOINs) and differences (EXCEPT/NOT IN). If you look at a basic relational algebra reference from a university database course, you’ll see direct parallels between set operations and query operations (for example, see introductory database notes from MIT OpenCourseWare: https://ocw.mit.edu).
Example 4: Email filters (complements and unions)
Let’s say you build a spam filter. Define:
- U = all incoming emails
- S ⊆ U = suspected spam
- B ⊆ U = emails from blocked addresses
You want to auto-delete anything that is either spam or from a blocked sender. That’s the set
[
D = S ∪ B.
]
But you also want to keep a backup of all legitimate emails. That’s the complement of D within U:
[
L = U \ D = U \ (S ∪ B).
]
This is a clean example of set theory notation in problem solving: the complement and union capture the entire filtering rule in one expression.
Probability: classic examples of set theory notation in problem solving
Probability theory is built on set theory. Many probability rules are just set identities with probabilities attached.
Example 5: Overlapping events in probability
Let A = event “it rains tomorrow” and B = event “you have an outdoor meeting.” Then:
- A ∩ B = “it rains and you have an outdoor meeting”
- A ∪ B = “it rains or you have an outdoor meeting (or both)”
The probability rule
[
P(A ∪ B) = P(A) + P(B) − P(A ∩ B)
]
is just the set formula for |A ∪ B| scaled by total outcomes. If you read any standard probability text (for example, MIT’s open probability notes or similar university materials), you’ll see this set-based view repeatedly.
Suppose:
- P(A) = 0.4 (40% chance of rain)
- P(B) = 0.3 (30% chance of an outdoor meeting)
- P(A ∩ B) = 0.15
Then
[
P(A ∪ B) = 0.4 + 0.3 − 0.15 = 0.55.
]
So there’s a 55% chance that either it rains, or you have an outdoor meeting, or both. Again, this is a clear example of set theory notation in problem solving where the notation is doing the conceptual heavy lifting.
For a more formal treatment of how probability is built on sets, see introductory materials on measure and probability from institutions like Harvard (for instance, Harvard’s online statistics course materials: https://online-learning.harvard.edu).
Example 6: Conditional probability and subsets
Let A and B be events with B having positive probability. The conditional probability
[
P(A \mid B) = \frac{P(A ∩ B)}{P(B)}
]
literally means: restrict your universe to B, then ask how big the subset A ∩ B is inside that smaller universe. The intersection symbol ∩ and the idea of subsets are not cosmetic; they define what “given B” actually means.
As data science and machine learning have grown, this set-based thinking has become standard in practice. When you filter a dataset to “only customers in California who purchased in 2024,” you are effectively working with a subset of your original set of customers.
Data and computer science: real examples of set theory notation in problem solving
Modern data work is full of implicit sets. Rows in a database are elements; filters and joins are set operations.
Example 7: Database joins as intersections and Cartesian products
Consider two tables:
- Customers = set C of customer IDs
- Orders = set O of (customer ID, order ID) pairs
The set of all possible (customer, order) pairs is the Cartesian product C × O. But in practice, you usually want only the pairs where the customer ID matches. That’s a subset of C × O defined by a condition.
In relational algebra, a basic inner join behaves like an intersection of appropriate sets: you keep only rows that “line up” under some condition. While the syntax may differ, the underlying logic is: start with a product C × O, then restrict to a subset using a predicate (customer IDs match). Many university database courses (for example, Stanford or MIT) explicitly present joins using set notation.
This is a more technical but very real example of set theory notation in problem solving, especially in computer science and data engineering.
Example 8: Feature sets in machine learning
In machine learning, you often talk about a feature set. Let
- F = set of all available features (age, income, location, etc.)
- S ⊆ F = set of selected features for a model
Feature selection methods—like LASSO or stepwise selection—are effectively searching over subsets of F. You might compare two models:
- Model 1 uses S₁
- Model 2 uses S₂
Then:
- S₁ ∩ S₂ = features both models share
- S₁ ∪ S₂ = features used by at least one of the models
- S₁ \ S₂ = features only Model 1 uses
These are quiet but important examples of set theory notation in problem solving in modern AI workflows, even if you don’t always write the symbols explicitly.
For a more formal background on sets and functions in discrete math and CS, open course notes from universities like Carnegie Mellon or UC Berkeley are good references (for example, CMU’s discrete mathematics notes: https://www.cmu.edu/academics/discrete-math.html).
Logic, Venn diagrams, and reasoning with sets
Set theory gives you a visual and symbolic language for logic problems too.
Example 9: Logic puzzle with Venn-style reasoning
Suppose a puzzle says:
All jazz fans in the club like blues. Some rock fans like jazz. No one who dislikes blues likes jazz.
Define:
- J = set of jazz fans
- B = set of people who like blues
- R = set of rock fans
Translate the statements:
- “All jazz fans in the club like blues” → J ⊆ B
- “Some rock fans like jazz” → R ∩ J ≠ ∅
- “No one who dislikes blues likes jazz” → J ⊆ B, or equivalently J ∩ Bᶜ = ∅
Questions like “Can someone be in J but not in B?” become trivial: if J ⊆ B, then J \ B is empty. This is another example of set theory notation in problem solving, this time in the context of pure logic.
How to read and write set theory notation efficiently
At this point, we’ve walked through multiple examples of set theory notation in problem solving across surveys, probability, data science, and logic. To make this actually usable under time pressure (exams, interviews, coding), it helps to have a short mental dictionary.
Think of it like this:
- Union (A ∪ B): “in A or B or both.” Use it for “at least one,” “either,” or “or.”
- Intersection (A ∩ B): “in A and B.” Use it for “both,” “common to,” and “overlap.”
- Difference (A \ B): “in A but not in B.” Use it for “but not,” “excluding,” and “only A-type.”
- Complement (Aᶜ or U \ A): “not in A,” relative to some universe U.
- Subset (A ⊆ B): everything in A is also in B.
- Cartesian product (A × B): all ordered pairs (a, b) with a in A and b in B.
When you see a word problem, try to rewrite the key sentence in set notation before you do any arithmetic. That habit alone turns messy language into structures you already know how to work with.
FAQ: short answers and more examples
Q1. Can you give a simple example of using set notation to solve a word problem?
Yes. If 30 students play soccer (set S), 20 play basketball (set B), and 10 play both, then the number who play at least one sport is |S ∪ B| = |S| + |B| − |S ∩ B| = 30 + 20 − 10 = 40. That’s one of the simplest examples of set theory notation in problem solving.
Q2. How are Venn diagrams related to set theory notation?
Each region of a Venn diagram corresponds to a combination of set membership: A only, B only, A ∩ B, and so on. Shading a region is like writing an expression such as A ∩ Bᶜ. Many textbooks introduce Venn diagrams first, then show the symbolic notation as a compact way to say the same thing.
Q3. What is an example of using complements in a probability question?
If the chance a website doesn’t crash on a given day is 0.97, and days are independent, the probability it never crashes over 10 days is (0.97)¹⁰. The probability it crashes at least once is the complement: 1 − (0.97)¹⁰. Here “at least once” is easier to express using a complement, and set notation captures that with an event like Aᶜ.
Q4. Are there real examples where set theory is used in science or public health?
Yes. In epidemiology, researchers often talk about populations as sets: people exposed to a risk factor, people who developed a disease, and their intersection. For instance, the CDC and NIH routinely publish studies where cohorts and subgroups are defined as sets (for example, smokers vs. non-smokers, vaccinated vs. unvaccinated). Comparing rates across these sets is core to how public health decisions are made.
Q5. How can I get better at recognizing when to use set notation in a problem?
Look for words like “only,” “both,” “either,” “neither,” “at least one,” and “but not.” These phrases almost always translate into unions, intersections, differences, or complements. The more you practice rewriting such phrases as set expressions, the more natural it becomes to use set theory notation in problem solving.
Related Topics
Explore More Logic and Set Theory Problem Solving
Discover more examples and insights in this category.
View All Logic and Set Theory Problem Solving