Lesson overview
Use set operations to model selection, filtering and overlap.
Starter: make the model explicit
Before reading the worked example, write down the objects involved, the claim being made and the notation you expect to use. This prevents the common error of calculating before modelling.
Learning objectives
- Compute union, intersection, difference and complement.
- Explain a power set in terms of all possible subsets.
- Use a Venn-style argument to justify a result.
Learning outcomes
- By the end of this lesson, you can compute union, intersection, difference and complement.
- By the end of this lesson, you can explain a power set in terms of all possible subsets.
- By the end of this lesson, you can use a Venn-style argument to justify a result.
Key vocabulary
What this lesson is about
Set operations create new sets from existing sets. Union collects everything in either set, intersection keeps only what is common to both, difference removes one set from another, and the power set collects all possible subsets.
For example, if A = {read, write}, then P(A) = {∅, {read}, {write}, {read, write}}. This matters in computing because permission sets, feature flags and configuration choices often involve all possible subsets.
Venn diagrams make inclusion, overlap and exclusion visible, but the formal definitions still decide the answer. A diagram helps you see the structure; notation proves what the shaded region means.
Terms, acronyms and named methods
These are the phrases and named techniques used in this lesson. Read this section before the worked example so the notation and examples have a clear meaning.
Formal notation and definitions
How to read the symbols
Use union, intersection and difference to describe exactly which region of a Venn diagram is meant. The shaded region must match the membership condition.
Degree-level reasoning
At degree level, set notation is not shorthand for a diagram. It is a language for stating exactly which objects are included, excluded or related.
When proving a set identity, use element-chasing: take an arbitrary element x, show the membership condition in one set is equivalent to the membership condition in the other, then conclude equality.
Do not stop at a correct-looking answer. State why the method is valid, whether the result depends on a hidden assumption, and what would count as a counterexample.
Worked formal model
This section shows the model, notation, calculation and interpretation as one worked answer. The notation is part of the reasoning, not decoration.
1. Context and objects
If C is customers and P is premium accounts, C intersect P describes customers who are also premium accounts.
Objects: sets A and B, their members x, and the universal set U that fixes the scope of the rule.
Model cue: Use a two-circle Venn diagram with sets A and B inside universal set U. Shade A ∩ B for overlap, A ∪ B for everything in either circle, and A \ B for the part of A outside B.
2. Mathematical working
Plain text version
A ∩ B = {x | x ∈ A and x ∈ B}
If A = {1,2,3} and B = {3,4}, then A ∩ B = {3}
A \ B = {1,2}
P({read, write}) = {∅, {read}, {write}, {read, write}}3. How to read the working
- State the universal set so the boundary of the problem is fixed.
- Use membership notation to define each operation precisely.
- Use the Venn diagram to see the region, then use the definition to justify the answer.
- For a small permission set, use the power set to list every subset of permissions that could be granted.
- Translate the resulting set back into the computing rule or filter.
4. Computing meaning and check
The set operation tells an implementation which records pass a filter. Intersection means both conditions must hold; difference identifies a precise exception group.
Now check: Prove A ∩ B ⊆ A using the definition of intersection. Then explain what that proof means in the security example.
Worked example
From scenario to formal reasoning
Scenario: If C is customers and P is premium accounts, C intersect P describes customers who are also premium accounts.
Method: Use the definitions and notation introduced above, then state what the result means in this computing scenario.
Reveal model answer
Let A be users who passed identity checks and B be users who enabled two-factor authentication. A ∩ B is the set of users satisfying both security requirements. A \ B is the risk group: users who passed identity checks but have not enabled two-factor authentication.
Worked solution structure
How a strong answer should be written
- Define: State the domain and the objects under discussion. For this lesson, begin from A ∪ B = {x | x ∈ A or x ∈ B}.
- Apply: Use the relevant definition from set theory; do not rely on the diagram, wording or intuition alone.
- Check: Test a boundary case, counterexample candidate or representation limit.
- Conclude: Write one sentence that connects the formal result back to the computing scenario.
Common misconception
A common mistake is reading union as exclusive. In ordinary set theory, A union B includes things in A, in B or in both.
Guided practice
- For A = {a, b} write P(A) in full, then count how many subsets it contains.
- Let A be verified users and B be two-factor users. Write A ∩ B, A ∪ B and A \ B in plain English.
- Prove A ∩ B ⊆ A by taking an arbitrary element x and using the definition of intersection.
- Explain why the complement of A is meaningless until the universal set U has been stated.
Quick checks
1. If A = {a,b}, what is P(A)?
2. Which operation means objects in A and also in B?
Digital exam practice
Example exam task
For A = verified users and B = two-factor users, describe A ∩ B, A ∪ B, A \ B and P({read, write}). Prove A ∩ B ⊆ A and explain the security meaning.
Notation toolkit
Means: the elements shared by A and B
How to use: Use it for filters that require both conditions.
Means: the elements in A, in B, or in both
How to use: Use it for inclusive either-or selection.
Means: the power set: all subsets of A
How to use: Use it when a question asks for every possible permission subset.
What a good answer is expected to show
A strong answer for this lesson defines sets A and B, their members x, and the universal set U that fixes the scope of the rule, applies the set theory method with visible working, and finishes by interpreting the result in the computing scenario.
How to solve it
- State the universal set so the boundary of the problem is fixed.
- Use membership notation to define each operation precisely.
- Use the Venn diagram to see the region, then use the definition to justify the answer.
- For a small permission set, use the power set to list every subset of permissions that could be granted.
- Translate the resulting set back into the computing rule or filter.
Model answer
Reveal model answer
A ∩ B means verified users who also use two-factor authentication; A ∪ B means users satisfying at least one of the two conditions; A \ B means verified users without two-factor authentication. P({read, write}) = {∅, {read}, {write}, {read, write}}. If x ∈ A ∩ B, then x ∈ A by the definition of intersection, so A ∩ B ⊆ A.
Practise next
- For A = {a, b} write P(A) in full, then count how many subsets it contains.
- Let A be verified users and B be two-factor users. Write A ∩ B, A ∪ B and A \ B in plain English.
Self-marking criteria
- Defines each set operation accurately.
- Lists the full power set of a two-element permission set.
- Uses element-chasing for the subset proof.
- States the universal set where complement or exclusion is discussed.
- Connects the result to a concrete filter or access rule.
Extension
Change one assumption in the worked scenario and decide whether the same method still applies. If it does not, name the exact point where the reasoning breaks.
Study route
Save one clean worked answer from this lesson. Include the problem statement, notation, working, final answer and a short note explaining the computing meaning of the result.
Next lesson: Cartesian Products and Modelling Data with Sets.
