Free preview
82 lessons
Mathematical Foundations for ML
Free preview
Mathematical Foundations for ML · 82 lessons
No surprise gaps
Actually remember it
Skip what you know
One subscription. All learning paths included.
Our content is best on a larger screen
The complement
Sometimes we need "not " - all elements that aren't in a set. To define this precisely, we first need a universal set containing all elements under consideration.
Definition
The complement of set , written , contains all elements in that are not in . We write this as:
To find , we list every element from that doesn't appear in . If contains the even numbers, then contains the odd numbers - every element that fails to satisfy the original condition.
On a Venn diagram, the complement is the region outside circle but still inside the rectangle . Use the button below to toggle the shading.
The complement captures everything that's "left over" when we exclude from the universal set.
Key Point
To compute : start with , remove every element that's in , and keep the rest.
Let and .
Find .
Solution
The complement contains all elements in that are not in . We check each element:
The complement contains the odd numbers - all elements not in the original set of even numbers.
Practice questions
4 questions
Let and .
What is ?
Select the correct answer:
+ 3 more questions
Properties of complements
Complements have three fundamental properties that follow directly from their definition.
Property 1: Double complement
Taking the complement twice returns the original set:
If contains the even numbers and contains the odd numbers, then is "not odd" - which brings us back to even.
Property 2: Disjoint
A set and its complement share no elements:
No element can be both in and not in simultaneously. Sets with empty intersection are disjoint.
Property 3: Exhaustive coverage
A set and its complement together cover the entire universal set:
Every element is either in or not in - there's no third option. Together, and account for everything.
Key Point
Properties 2 and 3 together say that and partition - they're disjoint (no overlap) and exhaustive (nothing left out).
Let and .
Verify all three complement properties for this set.
Solution
First, we find the complement:
Property 1:
The complement of contains all elements not in :
Property 2:
The intersection contains elements in both and :
These sets share no elements:
Property 3:
The union contains all elements in either or :
Practice questions
4 questions
Let and .
What is ?
Select the correct answer:
+ 3 more questions
De Morgan's laws
When we take the complement of a union or intersection, something interesting happens. De Morgan's laws tell us exactly how complements interact with these operations.
Definition
The first law says: to be outside " or ", an element must be outside and outside . If it were in either one, it would be in the union.
The second law says: to be outside " and ", an element just needs to be outside or outside . Being missing from either set is enough to be missing from their intersection.
Optional
Use the interactive widget below to see why these laws work.
Select a law:
De Morgan's first law
Left-hand side
Right-hand side
Use Next to step through and see why both sides describe the same region.
Key Point
De Morgan's laws let us rewrite compound set expressions. This can simplify certain problems.
Let , , and .
Solution
Part 1: Finding directly
First, compute the union:
Now take the complement - elements in but not in :
Part 2: Finding
First, find each complement:
Now take the intersection - elements in both and :
Both methods give , confirming De Morgan's first law: .
The element is the only one that's in neither nor .
Practice questions
4 questions
Which expression is equivalent to ?
Select the correct answer:
+ 3 more questions