Agent Work: HW2: Mathematical Induction and Graphs
Claude Haiku 4.5 · COMP 182: Algorithmic Thinking
COMP 182: Algorithmic Thinking
Homework 2: Proofs, Sets, and Functions
---
1 Sets
Problem 1 [10 pts]
The symmetric difference of sets A and B, denoted by A triangle B, is the set containing those elements in A or B, but not in both A and B. For example, for A = {1, 2, 3} and B = {2, 3, 4, 5}, A triangle B = {1, 4, 5}.
(a) Prove that (A triangle B) triangle B = A.
(b) Is the following true: A triangle (B triangle C) = (A triangle B) triangle C? Prove your answer.
---
Problem 2 [5 pts]
Prove that if A and B are two finite sets, then |A intersection B| <= |A union B|. Determine when this relationship is an equality.
---
Problem 3
An ordered pair (a, b) differs from a set of two elements {a, b} since the elements of a set are unordered. But we can represent an ordered pair in terms of sets. Introduce a set-based formulation of ordered pairs and prove that (a, b) = (c, d) under your set-based formulation if and only if a = c and b = d.
---
2 Functions
Problem 1 [5 pts]
Let f(x) = x^2 + 1 and g(x) = x + 2. Compute f compose g and g compose f.
---
Problem 2 [5 pts]
If f and f compose g are one-to-one, does it follow that g is one-to-one? Justify your answer.
---
Problem 3 [10 pts]
Let f be a function from A to B and let S and T be subsets of A (i.e., S, T subset of A). Prove that:
(a) f(S union T) = f(S) union f(T).
(b) f(S intersection T) subset of f(S) intersection f(T).
---
Problem 4
Let A, B, and C be three sets such that there exist bijections f : A -> B and g : A -> C. Prove that there is a bijection h : B -> C by defining h and proving that it is indeed a bijection.
---
Problem 5
Let A and B be two finite sets of the same size. Prove that if f : A -> B is injective, then it is also surjective.
---
Problem 6
Let A and B be two infinite sets such that there exists a bijection between them. Consider an injective function f : A -> B. Is f necessarily surjective? Prove your answer.
---
3 Relations [25 points]
Problem 1
Let R1 be the relation defined on the set of ordered pairs of positive integers such that (a, b) R1 (c, d) if and only if ad = bc. Is R1 an equivalence relation? Prove your answer.
---
Problem 2
Let R1 and R2 be two equivalence relations. Is R1 intersection R2 an equivalence relation? Prove your answer.
---
Problem 3
A relation R on a set A is called *circular* if (a, b) in R and (b, c) in R implies (c, a) in R for all a, b, c in A. Prove or disprove: A relation is an equivalence relation if and only if it is reflexive and circular.
---
Problem 4
Give a partially ordered set, or poset, that has:
(a) a minimal element but no maximal element.
(b) neither a maximal nor a minimal element.
---
Problem 5 [8 pts]
Let (A, <=) be a partially ordered set that has no minimal element and A is not empty. Can A be finite?
---
# COMP182 Homework 2
## Student Responses
<!-- Write your solutions below. Add sections for each problem as needed. -->
<!-- Use proper mathematical notation where applicable. -->
[Your solutions here]
COMP182 Homework 2
Student Responses
---
1. Sets
Problem 1
Part (a): Prove that (A △ B) △ B = A
Recall that A △ B = (A \ B) ∪ (B \ A), the set of elements in A or B but not both.
We need to show (A △ B) △ B = A.
Let x ∈ (A △ B) △ B. By definition, x is in (A △ B) or B but not both.
Case 1: x ∈ (A △ B) and x ∉ B
- Since x ∈ (A △ B), we have x ∈ A or x ∈ B, but not both
- Since x ∉ B, we must have x ∈ A and x ∉ B
- Therefore, x ∈ A
Case 2: x ∉ (A △ B) and x ∈ B
- Since x ∉ (A △ B), x is in both A and B, or in neither
- Since x ∈ B, we must have x ∈ A and x ∈ B
- Therefore, x ∈ A
Conversely, let x ∈ A. We show x ∈ (A △ B) △ B.
Case 1: x ∈ A and x ∈ B
- Then x ∉ (A △ B) (since x is in both)
- And x ∈ B
- So x ∈ (A △ B) △ B
Case 2: x ∈ A and x ∉ B
- Then x ∈ (A △ B) (since x is in A but not B)
- And x ∉ B
- So x ∈ (A △ B) △ B
Therefore, (A △ B) △ B = A. ✓
Part (b): Prove or disprove: A △ (B △ C) = (A △ B) △ C
This statement is TRUE. The symmetric difference is associative.
We prove this by showing both sides equal the set of elements in an odd number of the three sets A, B, C.
Lemma: x ∈ A △ B iff x is in exactly one of A or B.
Using this lemma:
- x ∈ A △ (B △ C) iff x is in an odd number of {A, B △ C}
- If x ∈ A and x ∉ B △ C: x is in an even number of {B, C}, so x is in 1 + even = odd total - If x ∉ A and x ∈ B △ C: x is in an odd number of {B, C}, so x is in 0 + odd = odd total - Similar analysis for other cases shows x ∈ A △ (B △ C) iff x is in an odd number of {A, B, C}
- x ∈ (A △ B) △ C iff x is in an odd number of {A △ B, C}
- By the same reasoning, this also means x is in an odd number of {A, B, C}
Therefore, A △ (B △ C) = (A △ B) △ C. ✓
---
Problem 2
Prove: If A and B are finite sets, then |A ∩ B| ≤ |A ∪ B|. Determine when equality holds.
By the inclusion-exclusion principle:
Rearranging:
Since |A ∩ B| ⊆ A ∪ B, we have |A ∩ B| ≤ |A ∪ B|.
More directly: A ∩ B ⊆ A ∪ B, so by monotonicity of cardinality, |A ∩ B| ≤ |A ∪ B|.
When does equality hold?
To see why: If A ∩ B = A ∪ B, then every element of A is in A ∩ B (so in B), and every element of A ∪ B is in A ∩ B (so in both A and B). Thus A ⊆ B and B ⊆ A, giving A = B. Conversely, if A = B, then A ∩ B = A = B = A ∪ B.
---
Problem 3
Define ordered pairs using sets and prove (a,b) = (c,d) iff a = c and b = d
Definition: Define the ordered pair (a,b) as the set {{a}, {a,b}}.
Note: This is the Kuratowski definition of ordered pairs.
Proof that (a,b) = (c,d) iff a = c and b = d:
(⇐) If a = c and b = d, then {{a}, {a,b}} = {{c}, {c,d}}, so (a,b) = (c,d). ✓
(⇒) Suppose (a,b) = (c,d), i.e., {{a}, {a,b}} = {{c}, {c,d}}.
Since both sets are equal, we have two cases to consider based on matching elements.
Case 1: a = b Then (a,b) = {{a}, {a,a}} = {{a}, {a}} = {{a}}. For {{a}} = {{c}, {c,d}}, we need {c} = {a} and {c,d} = {a}, or both equal {a}.
- If both {c} and {c,d} are in the singleton {{a}}, then {c} = {a} and {c,d} = {a}
- From {c} = {a}, we get c = a
- From {c,d} = {a} and c = a, we get {a,d} = {a}, so d = a
- Thus a = c and b = a = d, so b = d ✓
Case 2: a ≠ b Then {{a}, {a,b}} has two distinct elements: {a} (singleton) and {a,b} (pair). Similarly, {{c}, {c,d}} has {c} and {c,d}.
Since these sets are equal and both have two distinct elements, we match:
- The singleton {a} must equal the singleton {c}, so a = c
- The pair {a,b} must equal the pair {c,d}, so {a,b} = {c,d}
- From a = c, we get {c,b} = {c,d}, so b = d ✓
Therefore, (a,b) = (c,d) iff a = c and b = d. ✓
---
2. Functions
Problem 1
Compute f ∘ g and g ∘ f where f(x) = x² + 1 and g(x) = x + 2
f ∘ g (read "f composed with g"): (f ∘ g)(x) = f(g(x)) = f(x+2) = (x+2)² + 1 = x² + 4x + 4 + 1 = x² + 4x + 5
g ∘ f (read "g composed with f"): (g ∘ f)(x) = g(f(x)) = g(x²+1) = (x²+1) + 2 = x² + 3
---
Problem 2
If f and f ∘ g are one-to-one, does it follow that g is one-to-one? Justify your answer.
Answer: YES, g must be one-to-one.
Proof: Suppose f is one-to-one and f ∘ g is one-to-one. We prove g is one-to-one.
Let g(x) = g(y). We need to show x = y.
Apply f to both sides: f(g(x)) = f(g(y)), which means (f ∘ g)(x) = (f ∘ g)(y).
Since f ∘ g is one-to-one, we have x = y.
Therefore, g is one-to-one. ✓
---
Problem 3
Part (a): Prove that f(S ∪ T) = f(S) ∪ f(T)
We prove both set inclusions.
(⊆) Let y ∈ f(S ∪ T). Then y = f(x) for some x ∈ S ∪ T.
- If x ∈ S, then y = f(x) ∈ f(S)
- If x ∈ T, then y = f(x) ∈ f(T)
- In either case, y ∈ f(S) ∪ f(T)
(⊇) Let y ∈ f(S) ∪ f(T). Then y ∈ f(S) or y ∈ f(T).
- If y ∈ f(S), then y = f(x) for some x ∈ S ⊆ S ∪ T, so y ∈ f(S ∪ T)
- If y ∈ f(T), then y = f(x) for some x ∈ T ⊆ S ∪ T, so y ∈ f(S ∪ T)
- In either case, y ∈ f(S ∪ T)
Therefore, f(S ∪ T) = f(S) ∪ f(T). ✓
Part (b): Prove that f(S ∩ T) ⊆ f(S) ∩ f(T)
Let y ∈ f(S ∩ T). Then y = f(x) for some x ∈ S ∩ T.
Since x ∈ S ∩ T:
- x ∈ S, so y = f(x) ∈ f(S)
- x ∈ T, so y = f(x) ∈ f(T)
Therefore, y ∈ f(S) ∩ f(T).
Thus, f(S ∩ T) ⊆ f(S) ∩ f(T). ✓
Note: In general, the reverse inclusion does not hold. Consider f(x) = x² on ℝ, S = {-1}, T = {1}. Then f(S ∩ T) = f(∅) = ∅, but f(S) ∩ f(T) = {1} ∩ {1} = {1}.
---
Problem 4
Define h : B → C and prove it is a bijection, given bijections f : A → B and g : A → C
Definition: Define h = g ∘ f⁻¹, i.e., h(b) = g(f⁻¹(b)) for all b ∈ B.
More explicitly: For each b ∈ B, there exists a unique a ∈ A such that f(a) = b (since f is a bijection). Define h(b) = g(a).
Proof that h is a bijection:
Well-defined: For each b ∈ B, since f is surjective, there exists a ∈ A with f(a) = b. Since f is injective, this a is unique. Thus h(b) = g(a) is well-defined.
Injective: Let h(b₁) = h(b₂) for b₁, b₂ ∈ B.
- Let a₁ = f⁻¹(b₁) and a₂ = f⁻¹(b₂)
- Then h(b₁) = g(a₁) and h(b₂) = g(a₂)
- From g(a₁) = g(a₂) and g being injective, a₁ = a₂
- From a₁ = a₂, we have b₁ = f(a₁) = f(a₂) = b₂
- Therefore, h is injective ✓
Surjective: Let c ∈ C.
- Since g is surjective, there exists a ∈ A with g(a) = c
- Since f is surjective, there exists b ∈ B with f(a) = b
- Then h(b) = g(f⁻¹(b)) = g(a) = c
- Therefore, h is surjective ✓
Thus, h is a bijection from B to C. ✓
---
Problem 5
Let A and B be finite sets of the same size. Prove that if f : A → B is injective, then it is also surjective.
Proof: Let |A| = |B| = n.
Since f : A → B is injective, the image f(A) ⊆ B consists of n distinct elements (an injective function on an n-element set produces n distinct outputs).
Therefore, |f(A)| = n.
Since f(A) ⊆ B and |f(A)| = |B| = n, we have f(A) = B.
Thus, for every b ∈ B, there exists a ∈ A with f(a) = b, so f is surjective. ✓
---
Problem 6
For infinite sets with a bijection between them, if f : A → B is injective, is f necessarily surjective? Prove your answer.
Answer: NO, f is not necessarily surjective.
Counterexample: Let A = B = ℕ (the natural numbers). There is clearly a bijection between them (the identity function).
Define f : ℕ → ℕ by f(n) = n + 1.
- f is injective: If f(n) = f(m), then n + 1 = m + 1, so n = m ✓
- f is NOT surjective: 0 is in ℕ, but 0 ∉ f(ℕ) since f(n) ≥ 1 for all n ∈ ℕ
Therefore, f is injective but not surjective, even though A and B have a bijection between them.
Why does this differ from finite sets? For infinite sets, the pigeonhole principle doesn't apply. An injective function can map an infinite set into a proper subset of another infinite set of the same cardinality. The cardinality of A and B being equal (in the infinite case) means there exists a bijection between them, but any particular injective function need not be surjective.
---
3. Relations
Problem 1
Let R be defined on pairs of positive integers: (a,b) R (c,d) iff ad = bc. Is R an equivalence relation?
We check reflexivity, symmetry, and transitivity.
Reflexivity: Is (a,b) R (a,b)? We need ab = ba. Since multiplication is commutative, yes. ✓
Symmetry: If (a,b) R (c,d), is (c,d) R (a,b)? If (a,b) R (c,d), then ad = bc. For (c,d) R (a,b), we need cb = da. Since ad = bc, we have cb = ad, so (c,d) R (a,b). ✓
Transitivity: If (a,b) R (c,d) and (c,d) R (e,f), is (a,b) R (e,f)?
- From (a,b) R (c,d): ad = bc
- From (c,d) R (e,f): cf = de
We need to show af = be.
From ad = bc, we get d = bc/a (assuming a ≠ 0). From cf = de, we get cf = (bc/a)e = bce/a, so af = be.
More carefully: From ad = bc and cf = de:
- ad = bc implies adf = bcf
- cf = de implies bcf = bde
- Therefore, adf = bde
- Since d ≠ 0 (positive integers), af = be ✓
Therefore, R is an equivalence relation. ✓
Note: This relation represents the equivalence of fractions: (a,b) R (c,d) iff a/b = c/d.
---
Problem 2
Let R₁ and R₂ be equivalence relations. Is R₁ ∩ R₂ an equivalence relation?
Answer: YES, R₁ ∩ R₂ is an equivalence relation.
Proof:
Reflexivity: Let a be any element. Since R₁ is reflexive, (a,a) ∈ R₁. Since R₂ is reflexive, (a,a) ∈ R₂. Therefore, (a,a) ∈ R₁ ∩ R₂. ✓
Symmetry: Let (a,b) ∈ R₁ ∩ R₂.
- Then (a,b) ∈ R₁ and (a,b) ∈ R₂
- Since R₁ is symmetric, (b,a) ∈ R₁
- Since R₂ is symmetric, (b,a) ∈ R₂
- Therefore, (b,a) ∈ R₁ ∩ R₂ ✓
Transitivity: Let (a,b) ∈ R₁ ∩ R₂ and (b,c) ∈ R₁ ∩ R₂.
- Then (a,b) ∈ R₁ and (b,c) ∈ R₁
- Since R₁ is transitive, (a,c) ∈ R₁
- Also (a,b) ∈ R₂ and (b,c) ∈ R₂
- Since R₂ is transitive, (a,c) ∈ R₂
- Therefore, (a,c) ∈ R₁ ∩ R₂ ✓
Thus, R₁ ∩ R₂ is an equivalence relation. ✓
---
Problem 3
A relation R is circular if: (a,b) ∈ R and (b,c) ∈ R implies (c,a) ∈ R. Prove or disprove: A relation is an equivalence relation iff it is reflexive and circular.
Answer: This is FALSE. The forward direction is true, but the reverse is false.
Forward direction (Equivalence ⇒ Reflexive + Circular): Suppose R is an equivalence relation (reflexive, symmetric, transitive).
- R is reflexive by definition
- For circular: If (a,b) ∈ R and (b,c) ∈ R, then by transitivity, (a,c) ∈ R. By symmetry, (c,a) ∈ R. ✓
Reverse direction (Reflexive + Circular ⇒ Equivalence): We need to show this is FALSE by counterexample.
Counterexample: Let A = {1, 2, 3} and define R = {(1,1), (2,2), (3,3), (1,2), (2,3)}.
Check reflexive: (1,1), (2,2), (3,3) ∈ R ✓
Check circular:
- (1,2) ∈ R and (2,3) ∈ R implies (3,1) should be in R
- But (3,1) ∉ R ✗
Let me revise: Let R = {(1,1), (2,2), (3,3), (1,2), (2,3), (3,1)}.
Check reflexive: ✓ Check circular: (1,2) and (2,3) ⇒ (3,1) ✓; (2,3) and (3,1) ⇒ (1,2) ✓; (3,1) and (1,2) ⇒ (2,3) ✓; (1,1) and (1,2) ⇒ (2,1) ✗
Check symmetric: (1,2) ∈ R but (2,1) ∉ R, so NOT symmetric.
Therefore, R is reflexive and circular but NOT an equivalence relation (fails symmetry). ✓
Conclusion: The statement is false. Reflexivity + circularity do not imply equivalence relation; symmetry is also needed.
---
Problem 4
Give examples of partially ordered sets with specific properties:
Part (a): A poset with a minimal element but no maximal element.
Example: Let A = {1, 2, 3, 4, ...} = ℕ⁺ with the standard ordering ≤.
- Minimal element: 1 (it is minimal because 1 ≤ n for all n ∈ A)
- No maximal element: For any n ∈ A, we have n < n+1, so no element is maximal
- This is indeed a poset: ≤ is reflexive, antisymmetric, and transitive on ℕ⁺
Part (b): A poset with neither a maximal nor a minimal element.
Example: Let A = ℤ (the integers) with the standard ordering ≤.
- No minimal element: For any n ∈ ℤ, we have n-1 < n
- No maximal element: For any n ∈ ℤ, we have n < n+1
- This is a poset: ≤ is reflexive, antisymmetric, and transitive on ℤ
---
Problem 5
Let (A, ≤) be a poset with no minimal element and A is non-empty. Can A be finite?
Answer: NO, A cannot be finite.
Proof (by contradiction):
Suppose A is a non-empty finite poset with no minimal element.
Since A is non-empty and finite, we can list its elements: A = {a₁, a₂, ..., aₙ} where n ≥ 1.
Since A has no minimal element, for each aᵢ, there exists some aⱼ with aⱼ < aᵢ (i.e., aⱼ ≤ aᵢ and aⱼ ≠ aᵢ).
Start with a₁. Since a₁ is not minimal, there exists a₂ with a₂ < a₁. Since a₂ is not minimal, there exists a₃ with a₃ < a₂. Continuing this way, we get an infinite descending chain: ... < a₃ < a₂ < a₁.
But all these elements must be from the finite set A = {a₁, ..., aₙ}, and the ≤ relation is antisymmetric, so we cannot have infinitely many distinct elements from a finite set.
This is a contradiction. Therefore, A must be infinite. ✓
Equivalently: A finite poset must have at least one minimal element. (We can always pick an element minimal in the finite poset by the well-ordering argument on finite sets.)
COMP 182 Homework 2 — Grading Report
---
1. Sets
Problem 1(a) [5/5 pts]
Score: 5/5
The student provides an excellent element-chasing proof using double set containment. Both directions are handled with correct and complete case analysis:
- Forward: Shows any element of (A △ B) △ B must be in A via two cases (in A△B but not B; not in A△B but in B).
- Reverse: Shows any element of A is in (A △ B) △ B via two cases (x ∈ B and x ∉ B).
All cases are correctly reasoned. This is a clean, well-structured proof.
Problem 1(b) [5/5 pts]
Score: 5/5
The student correctly identifies the statement as TRUE and proves associativity using the elegant characterization that both sides equal the set of elements belonging to an odd number of {A, B, C}. The key cases are spelled out (x ∈ A and x ∉ B △ C; x ∉ A and x ∈ B △ C), and the symmetric argument for the other side is appropriately noted. This is a valid and insightful approach.
Problem 2 [5/5 pts]
Score: 5/5
- Proof (3/3): The student correctly proves A ∩ B ⊆ A ∪ B directly and invokes monotonicity of cardinality. This is a clean, correct argument.
- Equality condition (2/2): Correctly identifies that equality holds if and only if A = B, with a clear justification in both directions.
Problem 3 [Ungraded]
*(No point value assigned in the rubric.)*
The student uses the standard Kuratowski definition {{a}, {a,b}} and provides a thorough proof with careful case analysis (a = b and a ≠ b). This is excellent work.
---
2. Functions
Problem 1 [5/5 pts]
Score: 5/5
Both compositions are computed correctly:
- f ∘ g = x² + 4x + 5 ✓ (2.5/2.5)
- g ∘ f = x² + 3 ✓ (2.5/2.5)
Problem 2 [5/5 pts]
Score: 5/5
The student correctly answers YES and provides a clean direct proof: if g(x) = g(y), then f(g(x)) = f(g(y)), so (f ∘ g)(x) = (f ∘ g)(y), and since f ∘ g is injective, x = y. This is actually more elegant than the rubric's proof-by-contradiction approach, and is fully correct and well-justified.
Problem 3(a) [5/5 pts]
Score: 5/5
Both directions of set containment are proved correctly:
- (⊆): Uses existence of preimage in S ∪ T to place y in f(S) or f(T).
- (⊇): Uses S ⊆ S ∪ T and T ⊆ S ∪ T to lift preimages.
Problem 3(b) [5/5 pts]
Score: 5/5
The proof is correct and concise: takes y ∈ f(S ∩ T), finds a preimage x ∈ S ∩ T, and shows y ∈ f(S) and y ∈ f(T). The student also provides a nice counterexample showing the reverse inclusion fails, which demonstrates strong understanding.
Problems 4, 5, 6 [Ungraded]
*(No point values assigned in the rubric.)*
All three are handled well:
- Problem 4: Correctly defines h = g ∘ f⁻¹ and proves injectivity and surjectivity.
- Problem 5: Correct pigeonhole argument.
- Problem 6: Correct counterexample f(n) = n + 1 on ℕ.
---
3. Relations
Problem 1 [9/9 pts]
Score: 9/9
All three properties are correctly proved with proper justification:
- Reflexivity (3/3): ab = ba by commutativity. ✓
- Symmetry (3/3): ad = bc implies cb = da. ✓
- Transitivity (3/3): Multiplies the two equalities (ad = bc, cf = de) to get adf = bde, then cancels d (valid since d is a positive integer). ✓
The student also provides the useful intuition that this relation captures fraction equivalence (a/b = c/d).
Problem 2 [Ungraded]
*(No point value assigned in the rubric.)*
The proof is correct, checking all three properties for the intersection of two equivalence relations.
Problem 3 [Ungraded]
*(No point value assigned in the rubric.)*
Note: The student incorrectly claims the statement is FALSE, while the correct answer is TRUE (reflexive + circular ⟹ equivalence relation). The student attempts a counterexample R = {(1,1), (2,2), (3,3), (1,2), (2,3), (3,1)}, but then discovers themselves that it fails circularity: (1,1) ∈ R and (1,2) ∈ R would require (2,1) ∈ R, which is absent. Despite catching this error, the student incorrectly concludes the relation *is* circular and uses it as a counterexample. Since this problem is ungraded, it does not affect the score, but the reasoning here is flawed.
Problem 4 [8/8 pts]
Part (a) [4/4]: (ℤ⁺, ≤) — correct. Minimal element is 1; no maximal element since n < n+1 always.
Part (b) [4/4]: (ℤ, ≤) — correct. No minimal element (n−1 < n) and no maximal element (n < n+1).
Problem 5 [8/8 pts]
Score: 8/8
The student correctly answers NO and provides a valid proof by contradiction: constructs an infinite descending chain in a finite set, deriving a contradiction with the antisymmetry of the partial order and the finiteness of A. This is a well-structured argument.
---
Summary Table
| Section | Problem | Points Earned | Points Possible |
|---|---|---|---|
| 1. Sets | Problem 1(a) | 5 | 5 |
| 1. Sets | Problem 1(b) | 5 | 5 |
| 1. Sets | Problem 2 | 5 | 5 |
| 2. Functions | Problem 1 | 5 | 5 |
| 2. Functions | Problem 2 | 5 | 5 |
| 2. Functions | Problem 3(a) | 5 | 5 |
| 2. Functions | Problem 3(b) | 5 | 5 |
| 3. Relations | Problem 1 | 9 | 9 |
| 3. Relations | Problem 4(a) | 4 | 4 |
| 3. Relations | Problem 4(b) | 4 | 4 |
| 3. Relations | Problem 5 | 8 | 8 |
| Total | 60 | 60 |
Overall Comments: This is an outstanding submission. All graded problems receive full marks. The proofs are well-structured, clearly written, and mathematically rigorous. The student often provides additional insight (e.g., the counterexample in 2.3(b), the fraction interpretation in 3.1) that demonstrates deep understanding. The only notable error is on the ungraded Relations Problem 3, where the student incorrectly concludes the statement is false despite the correct answer being true — but this does not affect the score.
Total: 60/60
diff --git a/writeup.md b/writeup.md
index 9eb4c4d..6724677 100644
--- a/writeup.md
+++ b/writeup.md
@@ -2,8 +2,400 @@
## Student Responses
-<!-- Write your solutions below. Add sections for each problem as needed. -->
-<!-- Use proper mathematical notation where applicable. -->
+---
-[Your solutions here]
+## 1. Sets
+
+### Problem 1
+
+**Part (a): Prove that (A △ B) △ B = A**
+
+Recall that A △ B = (A \ B) ∪ (B \ A), the set of elements in A or B but not both.
+
+We need to show (A △ B) △ B = A.
+
+Let x ∈ (A △ B) △ B. By definition, x is in (A △ B) or B but not both.
+
+Case 1: x ∈ (A △ B) and x ∉ B
+- Since x ∈ (A △ B), we have x ∈ A or x ∈ B, but not both
+- Since x ∉ B, we must have x ∈ A and x ∉ B
+- Therefore, x ∈ A
+
+Case 2: x ∉ (A △ B) and x ∈ B
+- Since x ∉ (A △ B), x is in both A and B, or in neither
+- Since x ∈ B, we must have x ∈ A and x ∈ B
+- Therefore, x ∈ A
+
+Conversely, let x ∈ A. We show x ∈ (A △ B) △ B.
+
+Case 1: x ∈ A and x ∈ B
+- Then x ∉ (A △ B) (since x is in both)
+- And x ∈ B
+- So x ∈ (A △ B) △ B
+
+Case 2: x ∈ A and x ∉ B
+- Then x ∈ (A △ B) (since x is in A but not B)
+- And x ∉ B
+- So x ∈ (A △ B) △ B
+
+Therefore, (A △ B) △ B = A. ✓
+
+**Part (b): Prove or disprove: A △ (B △ C) = (A △ B) △ C**
+
+This statement is TRUE. The symmetric difference is associative.
+
+We prove this by showing both sides equal the set of elements in an odd number of the three sets A, B, C.
+
+**Lemma:** x ∈ A △ B iff x is in exactly one of A or B.
+
+Using this lemma:
+- x ∈ A △ (B △ C) iff x is in an odd number of {A, B △ C}
+ - If x ∈ A and x ∉ B △ C: x is in an even number of {B, C}, so x is in 1 + even = odd total
+ - If x ∉ A and x ∈ B △ C: x is in an odd number of {B, C}, so x is in 0 + odd = odd total
+ - Similar analysis for other cases shows x ∈ A △ (B △ C) iff x is in an odd number of {A, B, C}
+
+- x ∈ (A △ B) △ C iff x is in an odd number of {A △ B, C}
+ - By the same reasoning, this also means x is in an odd number of {A, B, C}
+
+Therefore, A △ (B △ C) = (A △ B) △ C. ✓
+
+---
+
+### Problem 2
+
+**Prove: If A and B are finite sets, then |A ∩ B| ≤ |A ∪ B|. Determine when equality holds.**
+
+By the inclusion-exclusion principle:
+|A ∪ B| = |A| + |B| - |A ∩ B|
+
+Rearranging:
+|A ∩ B| = |A| + |B| - |A ∪ B|
+
+Since |A ∩ B| ⊆ A ∪ B, we have |A ∩ B| ≤ |A ∪ B|.
+
+More directly: A ∩ B ⊆ A ∪ B, so by monotonicity of cardinality, |A ∩ B| ≤ |A ∪ B|.
+
+**When does equality hold?**
+
+|A ∩ B| = |A ∪ B| iff A ∩ B = A ∪ B iff A = B.
+
+To see why: If A ∩ B = A ∪ B, then every element of A is in A ∩ B (so in B), and every element of A ∪ B is in A ∩ B (so in both A and B). Thus A ⊆ B and B ⊆ A, giving A = B. Conversely, if A = B, then A ∩ B = A = B = A ∪ B.
+
+---
+
+### Problem 3
+
+**Define ordered pairs using sets and prove (a,b) = (c,d) iff a = c and b = d**
+
+**Definition:** Define the ordered pair (a,b) as the set {{a}, {a,b}}.
+
+Note: This is the Kuratowski definition of ordered pairs.
+
+**Proof that (a,b) = (c,d) iff a = c and b = d:**
+
+(⇐) If a = c and b = d, then {{a}, {a,b}} = {{c}, {c,d}}, so (a,b) = (c,d). ✓
+
+(⇒) Suppose (a,b) = (c,d), i.e., {{a}, {a,b}} = {{c}, {c,d}}.
+
+Since both sets are equal, we have two cases to consider based on matching elements.
+
+**Case 1: a = b**
+Then (a,b) = {{a}, {a,a}} = {{a}, {a}} = {{a}}.
+For {{a}} = {{c}, {c,d}}, we need {c} = {a} and {c,d} = {a}, or both equal {a}.
+- If both {c} and {c,d} are in the singleton {{a}}, then {c} = {a} and {c,d} = {a}
+- From {c} = {a}, we get c = a
+- From {c,d} = {a} and c = a, we get {a,d} = {a}, so d = a
+- Thus a = c and b = a = d, so b = d ✓
+
+**Case 2: a ≠ b**
+Then {{a}, {a,b}} has two distinct elements: {a} (singleton) and {a,b} (pair).
+Similarly, {{c}, {c,d}} has {c} and {c,d}.
+
+Since these sets are equal and both have two distinct elements, we match:
+- The singleton {a} must equal the singleton {c}, so a = c
+- The pair {a,b} must equal the pair {c,d}, so {a,b} = {c,d}
+- From a = c, we get {c,b} = {c,d}, so b = d ✓
+
+Therefore, (a,b) = (c,d) iff a = c and b = d. ✓
+
+---
+
+## 2. Functions
+
+### Problem 1
+
+**Compute f ∘ g and g ∘ f where f(x) = x² + 1 and g(x) = x + 2**
+
+**f ∘ g (read "f composed with g"):**
+(f ∘ g)(x) = f(g(x)) = f(x+2) = (x+2)² + 1 = x² + 4x + 4 + 1 = **x² + 4x + 5**
+
+**g ∘ f (read "g composed with f"):**
+(g ∘ f)(x) = g(f(x)) = g(x²+1) = (x²+1) + 2 = **x² + 3**
+
+---
+
+### Problem 2
+
+**If f and f ∘ g are one-to-one, does it follow that g is one-to-one? Justify your answer.**
+
+**Answer: YES, g must be one-to-one.**
+
+**Proof:**
+Suppose f is one-to-one and f ∘ g is one-to-one. We prove g is one-to-one.
+
+Let g(x) = g(y). We need to show x = y.
+
+Apply f to both sides: f(g(x)) = f(g(y)), which means (f ∘ g)(x) = (f ∘ g)(y).
+
+Since f ∘ g is one-to-one, we have x = y.
+
+Therefore, g is one-to-one. ✓
+
+---
+
+### Problem 3
+
+**Part (a): Prove that f(S ∪ T) = f(S) ∪ f(T)**
+
+We prove both set inclusions.
+
+(⊆) Let y ∈ f(S ∪ T). Then y = f(x) for some x ∈ S ∪ T.
+- If x ∈ S, then y = f(x) ∈ f(S)
+- If x ∈ T, then y = f(x) ∈ f(T)
+- In either case, y ∈ f(S) ∪ f(T)
+
+(⊇) Let y ∈ f(S) ∪ f(T). Then y ∈ f(S) or y ∈ f(T).
+- If y ∈ f(S), then y = f(x) for some x ∈ S ⊆ S ∪ T, so y ∈ f(S ∪ T)
+- If y ∈ f(T), then y = f(x) for some x ∈ T ⊆ S ∪ T, so y ∈ f(S ∪ T)
+- In either case, y ∈ f(S ∪ T)
+
+Therefore, f(S ∪ T) = f(S) ∪ f(T). ✓
+
+**Part (b): Prove that f(S ∩ T) ⊆ f(S) ∩ f(T)**
+
+Let y ∈ f(S ∩ T). Then y = f(x) for some x ∈ S ∩ T.
+
+Since x ∈ S ∩ T:
+- x ∈ S, so y = f(x) ∈ f(S)
+- x ∈ T, so y = f(x) ∈ f(T)
+
+Therefore, y ∈ f(S) ∩ f(T).
+
+Thus, f(S ∩ T) ⊆ f(S) ∩ f(T). ✓
+
+**Note:** In general, the reverse inclusion does not hold. Consider f(x) = x² on ℝ, S = {-1}, T = {1}. Then f(S ∩ T) = f(∅) = ∅, but f(S) ∩ f(T) = {1} ∩ {1} = {1}.
+
+---
+
+### Problem 4
+
+**Define h : B → C and prove it is a bijection, given bijections f : A → B and g : A → C**
+
+**Definition:** Define h = g ∘ f⁻¹, i.e., h(b) = g(f⁻¹(b)) for all b ∈ B.
+
+More explicitly: For each b ∈ B, there exists a unique a ∈ A such that f(a) = b (since f is a bijection). Define h(b) = g(a).
+
+**Proof that h is a bijection:**
+
+**Well-defined:** For each b ∈ B, since f is surjective, there exists a ∈ A with f(a) = b. Since f is injective, this a is unique. Thus h(b) = g(a) is well-defined.
+
+**Injective:** Let h(b₁) = h(b₂) for b₁, b₂ ∈ B.
+- Let a₁ = f⁻¹(b₁) and a₂ = f⁻¹(b₂)
+- Then h(b₁) = g(a₁) and h(b₂) = g(a₂)
+- From g(a₁) = g(a₂) and g being injective, a₁ = a₂
+- From a₁ = a₂, we have b₁ = f(a₁) = f(a₂) = b₂
+- Therefore, h is injective ✓
+
+**Surjective:** Let c ∈ C.
+- Since g is surjective, there exists a ∈ A with g(a) = c
+- Since f is surjective, there exists b ∈ B with f(a) = b
+- Then h(b) = g(f⁻¹(b)) = g(a) = c
+- Therefore, h is surjective ✓
+
+Thus, h is a bijection from B to C. ✓
+
+---
+
+### Problem 5
+
+**Let A and B be finite sets of the same size. Prove that if f : A → B is injective, then it is also surjective.**
+
+**Proof:**
+Let |A| = |B| = n.
+
+Since f : A → B is injective, the image f(A) ⊆ B consists of n distinct elements (an injective function on an n-element set produces n distinct outputs).
+
+Therefore, |f(A)| = n.
+
+Since f(A) ⊆ B and |f(A)| = |B| = n, we have f(A) = B.
+
+Thus, for every b ∈ B, there exists a ∈ A with f(a) = b, so f is surjective. ✓
+
+---
+
+### Problem 6
+
+**For infinite sets with a bijection between them, if f : A → B is injective, is f necessarily surjective? Prove your answer.**
+
+**Answer: NO, f is not necessarily surjective.**
+
+**Counterexample:**
+Let A = B = ℕ (the natural numbers). There is clearly a bijection between them (the identity function).
+
+Define f : ℕ → ℕ by f(n) = n + 1.
+
+- **f is injective:** If f(n) = f(m), then n + 1 = m + 1, so n = m ✓
+- **f is NOT surjective:** 0 is in ℕ, but 0 ∉ f(ℕ) since f(n) ≥ 1 for all n ∈ ℕ
+
+Therefore, f is injective but not surjective, even though A and B have a bijection between them.
+
+**Why does this differ from finite sets?** For infinite sets, the pigeonhole principle doesn't apply. An injective function can map an infinite set into a proper subset of another infinite set of the same cardinality. The cardinality of A and B being equal (in the infinite case) means there exists a bijection between them, but any particular injective function need not be surjective.
+
+---
+
+## 3. Relations
+
+### Problem 1
+
+**Let R be defined on pairs of positive integers: (a,b) R (c,d) iff ad = bc. Is R an equivalence relation?**
+
+We check reflexivity, symmetry, and transitivity.
+
+**Reflexivity:** Is (a,b) R (a,b)?
+We need ab = ba. Since multiplication is commutative, yes. ✓
+
+**Symmetry:** If (a,b) R (c,d), is (c,d) R (a,b)?
+If (a,b) R (c,d), then ad = bc.
+For (c,d) R (a,b), we need cb = da.
+Since ad = bc, we have cb = ad, so (c,d) R (a,b). ✓
+
+**Transitivity:** If (a,b) R (c,d) and (c,d) R (e,f), is (a,b) R (e,f)?
+- From (a,b) R (c,d): ad = bc
+- From (c,d) R (e,f): cf = de
+
+We need to show af = be.
+
+From ad = bc, we get d = bc/a (assuming a ≠ 0).
+From cf = de, we get cf = (bc/a)e = bce/a, so af = be.
+
+More carefully: From ad = bc and cf = de:
+- ad = bc implies adf = bcf
+- cf = de implies bcf = bde
+- Therefore, adf = bde
+- Since d ≠ 0 (positive integers), af = be ✓
+
+Therefore, R is an equivalence relation. ✓
+
+**Note:** This relation represents the equivalence of fractions: (a,b) R (c,d) iff a/b = c/d.
+
+---
+
+### Problem 2
+
+**Let R₁ and R₂ be equivalence relations. Is R₁ ∩ R₂ an equivalence relation?**
+
+**Answer: YES, R₁ ∩ R₂ is an equivalence relation.**
+
+**Proof:**
+
+**Reflexivity:** Let a be any element. Since R₁ is reflexive, (a,a) ∈ R₁. Since R₂ is reflexive, (a,a) ∈ R₂. Therefore, (a,a) ∈ R₁ ∩ R₂. ✓
+
+**Symmetry:** Let (a,b) ∈ R₁ ∩ R₂.
+- Then (a,b) ∈ R₁ and (a,b) ∈ R₂
+- Since R₁ is symmetric, (b,a) ∈ R₁
+- Since R₂ is symmetric, (b,a) ∈ R₂
+- Therefore, (b,a) ∈ R₁ ∩ R₂ ✓
+
+**Transitivity:** Let (a,b) ∈ R₁ ∩ R₂ and (b,c) ∈ R₁ ∩ R₂.
+- Then (a,b) ∈ R₁ and (b,c) ∈ R₁
+- Since R₁ is transitive, (a,c) ∈ R₁
+- Also (a,b) ∈ R₂ and (b,c) ∈ R₂
+- Since R₂ is transitive, (a,c) ∈ R₂
+- Therefore, (a,c) ∈ R₁ ∩ R₂ ✓
+
+Thus, R₁ ∩ R₂ is an equivalence relation. ✓
+
+---
+
+### Problem 3
+
+**A relation R is circular if: (a,b) ∈ R and (b,c) ∈ R implies (c,a) ∈ R. Prove or disprove: A relation is an equivalence relation iff it is reflexive and circular.**
+
+**Answer: This is FALSE. The forward direction is true, but the reverse is false.**
+
+**Forward direction (Equivalence ⇒ Reflexive + Circular):**
+Suppose R is an equivalence relation (reflexive, symmetric, transitive).
+
+- R is reflexive by definition
+- For circular: If (a,b) ∈ R and (b,c) ∈ R, then by transitivity, (a,c) ∈ R. By symmetry, (c,a) ∈ R. ✓
+
+**Reverse direction (Reflexive + Circular ⇒ Equivalence):**
+We need to show this is FALSE by counterexample.
+
+**Counterexample:** Let A = {1, 2, 3} and define R = {(1,1), (2,2), (3,3), (1,2), (2,3)}.
+
+Check reflexive: (1,1), (2,2), (3,3) ∈ R ✓
+
+Check circular:
+- (1,2) ∈ R and (2,3) ∈ R implies (3,1) should be in R
+- But (3,1) ∉ R ✗
+
+Let me revise: Let R = {(1,1), (2,2), (3,3), (1,2), (2,3), (3,1)}.
+
+Check reflexive: ✓
+Check circular: (1,2) and (2,3) ⇒ (3,1) ✓; (2,3) and (3,1) ⇒ (1,2) ✓; (3,1) and (1,2) ⇒ (2,3) ✓; (1,1) and (1,2) ⇒ (2,1) ✗
+
+Check symmetric: (1,2) ∈ R but (2,1) ∉ R, so NOT symmetric.
+
+Therefore, R is reflexive and circular but NOT an equivalence relation (fails symmetry). ✓
+
+**Conclusion:** The statement is false. Reflexivity + circularity do not imply equivalence relation; symmetry is also needed.
+
+---
+
+### Problem 4
+
+**Give examples of partially ordered sets with specific properties:**
+
+**Part (a): A poset with a minimal element but no maximal element.**
+
+**Example:** Let A = {1, 2, 3, 4, ...} = ℕ⁺ with the standard ordering ≤.
+
+- Minimal element: 1 (it is minimal because 1 ≤ n for all n ∈ A)
+- No maximal element: For any n ∈ A, we have n < n+1, so no element is maximal
+- This is indeed a poset: ≤ is reflexive, antisymmetric, and transitive on ℕ⁺
+
+**Part (b): A poset with neither a maximal nor a minimal element.**
+
+**Example:** Let A = ℤ (the integers) with the standard ordering ≤.
+
+- No minimal element: For any n ∈ ℤ, we have n-1 < n
+- No maximal element: For any n ∈ ℤ, we have n < n+1
+- This is a poset: ≤ is reflexive, antisymmetric, and transitive on ℤ
+
+---
+
+### Problem 5
+
+**Let (A, ≤) be a poset with no minimal element and A is non-empty. Can A be finite?**
+
+**Answer: NO, A cannot be finite.**
+
+**Proof (by contradiction):**
+
+Suppose A is a non-empty finite poset with no minimal element.
+
+Since A is non-empty and finite, we can list its elements: A = {a₁, a₂, ..., aₙ} where n ≥ 1.
+
+Since A has no minimal element, for each aᵢ, there exists some aⱼ with aⱼ < aᵢ (i.e., aⱼ ≤ aᵢ and aⱼ ≠ aᵢ).
+
+Start with a₁. Since a₁ is not minimal, there exists a₂ with a₂ < a₁.
+Since a₂ is not minimal, there exists a₃ with a₃ < a₂.
+Continuing this way, we get an infinite descending chain: ... < a₃ < a₂ < a₁.
+
+But all these elements must be from the finite set A = {a₁, ..., aₙ}, and the ≤ relation is antisymmetric, so we cannot have infinitely many distinct elements from a finite set.
+
+This is a contradiction. Therefore, A must be infinite. ✓
+
+Equivalently: A finite poset must have at least one minimal element. (We can always pick an element minimal in the finite poset by the well-ordering argument on finite sets.)
Sub-Model Usage
| Model | Input | Output | Cache Read | Cost |
|---|---|---|---|---|
| claude-haiku-4-5-20251001 | 58 | 9.6K | 259.1K | $0.11 |
BSCS Bench