968 words
5 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Mathematics I · Week 1 — Sets, relations, and functions Deep study for Quiz 2 weeks 1–4. Build vocabulary first, then pattern recognition, then mixed traps.

Mathematics I · Week 1 — Sets, relations, and functions
Deep study for Quiz 2 weeks 1–4. Build vocabulary first, then pattern recognition, then mixed traps.
Week map
Set language → roster and interval notation → subset and power set → relations as cross-products → function as special relation → domain, codomain, range → injective / surjective / bijective sketches.
Set notation (learn the symbols before the rules)
- A → “set A” → collection of distinct objects → A={2,5,7}.
- {x:condition} → “set builder” → all x satisfying the condition → {x:x∈Z,−2<x<4}={−1,0,1,2,3}.
- x∈A → “x belongs to A” → membership test → 3∈{1,3,5} is true.
- A⊆B → “A is a subset of B” → every element of A is in B → {2,4}⊆{1,2,3,4}.
- A∪B → “union” → elements in A or B (or both) → {1,2}∪{2,3}={1,2,3}.
- A∩B → “intersection” → elements in both → {1,2}∩{2,3}={2}.
- Ac or A′ → “complement” → elements in universal set U not in A → if U={1,2,3,4}, then {1,3}c={2,4}.
- ∣A∣ → “cardinality” → number of elements → ∣{a,b,c}∣=3.
Roster vs interval on the line
Finite sets use braces: {−1,0,1}. Intervals on R use parentheses/brackets:
- (a,b) → open interval → a<x<b → (2,5) excludes endpoints.
- [a,b] → closed interval → a≤x≤b.
- (−∞,b] → unbounded left → all x≤b.
Trap: {2} is a set containing one element; 2 is not a set. ∅ and {∅} differ: the second has one element (the empty set).
Relations
A relation R from set A to set B is any subset of A×B (ordered pairs).
Example: A={1,2,3}, B={0,1}. Define R={(1,0),(2,0),(3,1)}. Then 2R0 is true (pair (2,0) is in R).
Relation properties (when R is on A×A)
- Reflexive: every element pairs with itself → (a,a)∈R for all a∈A.
- Symmetric: swapping order keeps membership → if (a,b)∈R then (b,a)∈R.
- Transitive: chains close → if (a,b)∈R and (b,c)∈R then (a,c)∈R.
Mini-example: On {1,2,3}, let R={(1,1),(2,2),(3,3),(1,2),(2,1)}. Reflexive yes; symmetric yes; transitive yes (only chain 1→2→1 closes).
Functions
A function f:A→B is a relation where each input in domain A has exactly one output in codomain B.
- Range → actual outputs hit → subset of codomain.
- f(x) → value at x → unique output rule.
Non-function example on {1,2}: pairs {(1,0),(1,1),(2,0)} — input 1 has two outputs.
Injective, surjective, bijective
- Injective (one-to-one): different inputs → different outputs. Fail if two inputs share an output.
- Surjective (onto): every codomain element is hit. Fail if some b∈B never appears.
- Bijective: both injective and surjective — inputs and outputs pair perfectly.
Mini-example: f:{1,2,3}→{10,20,30} with f(1)=10,f(2)=20,f(3)=30 is bijective (finite sets, equal size, all distinct).
Pattern families
Easy — Membership and operations
- List elements after union/intersection/complement with universal set stated.
- Convert roster to set-builder when pattern is clear (even integers between 0 and 10).
- Count ∣A∣ after combining sets; use inclusion when asked “how many in A or B but not both”: ∣A∪B∣−∣A∩B∣ for symmetric difference size.
Medium — Subset and power set
- List all subsets of a small set; confirm 2n count for n elements.
- Decide whether X⊆Y from explicit rosters or interval containment.
- Given U and A, describe Ac in roster form.
Hard — Relation vs function and mapping type
- From a table of pairs, mark function or not; identify domain and range.
- Decide injective/surjective from arrow diagram or table without computing formula.
- Combine set ops with function definition: e.g. domain restricted to A∩B.
Worked mini-examples
Example 1 — Union and complement. U={1,2,3,4,5}, A={1,3,5}, B={2,3,4}.
A∪B={1,2,3,4,5}, A∩B={3}, (A∪B)c=∅, A∖B={1,5}.
Example 2 — Power set size. S={a,b,c}. ∣S∣=3, so ∣P(S)∣=23=8 subsets (including ∅ and S).
Example 3 — Function check. Rule g(x)=x with domain {0,1,4,9} and codomain {0,1,2,3}: g(0)=0,g(1)=1,g(4)=2,g(9)=3 — function, bijective on these finite sets.
Example 4 — Not injective. h:{1,2,3}→{5,6} with h(1)=5,h(2)=5,h(3)=6. Function yes; not injective (1 and 2 collide).
Traps
- Confusing ∈ (element) with ⊆ (subset). {1}⊆{1,2} but {1}∈/{1,2} as an element (unless nested).
- Forgetting ∅ is subset of every set.
- Calling a relation a function when one input has two outputs in the table.
- Range vs codomain: codomain is declared; range is what actually occurs.
- Power set of {a} is {∅,{a}} — two elements, not one.
Diagnostic (try yourself)
-
Let U={1,2,3,4,5,6}, P={2,4,6}, Q={1,2,3}. List all elements of (P∪Q)c.
-
How many subsets does {w,x,y,z} have? How many of those subsets contain w?
-
A relation on {0,1,2} is given by pairs {(0,0),(1,0),(1,1),(2,2)}. Is it a function from {0,1,2} to {0,1,2}? If not, which input fails?
-
Define f:{1,2,3,4}→{5,6,7} by f(1)=5,f(2)=6,f(3)=7,f(4)=5. Is f injective? Surjective? Bijective?
-
Express in roster form: {x∈Z:x2<10}.