Sets and Set Operations
Videos (~40 mins)
- Introducing Sets (17:26)
- Describing Sets (18:11)
Reading (~30 mins)
Optional Reading
This is a slightly more advanced reading that may appeal to you if you want to see more theoretical math examples.
Warmup Problems (~40 mins)
Please complete these problems “by hand,” without typing. Pencil/pen and paper is best practice for the quiz, but using a stylus with a tablet is also fine. Then, scan/photograph or otherwise produce an image of your solutions and upload them to Canvas.
Problem 1
Write the following sets in roster notation:
- \(\left\{ x \in \mathbb{Z} \; : x^2 \leq 10 \right\}\)
- \(\left\{ x \in \mathbb{N} \; : x \leq 10 \right\} \cap \left\{ x \in \mathbb{Z} \; : x \text{ is a prime number.} \right\}\)
- \(\left\{ x \in \mathbb{Z} \; : x/2 \geq 10 \right\} \cap \left\{ x \in \mathbb{Z} \; : 5x < 100 \right\}\)
Problem 2
Write each of the following sets in set-builder notation. Then, write them again in set-generator notation.
- \(\left\{ 2, 4, 8, 16, 32, 64,\ldots \right\}\)
- \(\left\{ 3, 4, 5, 6, 7, 8 \right\}\)
- \(\left\{ 0, 3, 6, 9, 12, 15 \right\}\)
Problem 3
Set-generator notation corresponds closely to set comprehensions in Python. After reading the linked documentation:
Part A
For each of the sets below, write a Python set comprehension which produces that set. You may use the range
function but may not explicitly define any other sets or lists.
- \(\{1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 16\}\).
- \(\{\sqrt{x} \;|\; x \in \mathbb{N}\;,\; 0 \leq x \leq 5\}\).
- \(\{1, 4, 7, 10, 13, 16\}\).
Part B
Determine the set produced by the Python set comprehension. Try to do this without running the Python code.
{x for x in range(1, 10) if x % 2 == 0}
{2*x for x in range(1, 5)}
{x**3 for x in range(10) if x < 4}
© Phil Chodrow, 2024