Skip to content

Problem Set | Computer Science

Problem 1. Prove that (p    q)(q    p)(p \implies q) \lor (q \implies p) is a tautology using a truth table.

Solution
ppqqp    qp \implies qq    pq \implies pdisjunction
TTTTT
TFFTT
FTTFT
FFTTT

All rows give TT So it is a tautology.

If you get this wrong, revise: Section 1.1 and Section 1.4.

Problem 2. Convert (¬pq)(r¬s)(\neg p \lor q) \land (r \lor \neg s) to DNF.

Solution

The formula is a conjunction of two clauses. Distribute \land over \lor:

(¬pq)(r¬s)=(¬pr)(¬p¬s)(qr)(q¬s)(\neg p \lor q) \land (r \lor \neg s) = (\neg p \land r) \lor (\neg p \land \neg s) \lor (q \land r) \lor (q \land \neg s).

This is in DNF (disjunction of four terms, each a conjunction of two literals).

If you get this wrong, revise: Section 1.6.

Problem 3. Negate: “For every real number xxThere exists a real number yy such that y>xy \gt x.”

Solution

Original: xy(y>x)\forall x\, \exists y\, (y \gt x).

Negation: xy(yx)\exists x\, \forall y\, (y \leq x)I.e., “there exists a real number xx such that every Real number yy satisfies yxy \leq x.”

If you get this wrong, revise: Section 1.2.

Problem 4. Prove that ABA \subseteq B if and only if ABc=A \cap B^c = \emptyset.

Solution

(\Rightarrow) Assume ABA \subseteq B. Let xABcx \in A \cap B^c. Then xAx \in A and xBx \notin B. But ABA \subseteq B implies xBx \in BContradiction. So ABc=A \cap B^c = \emptyset.

(\Leftarrow) Assume ABc=A \cap B^c = \emptyset. Let xAx \in A. If xBx \notin B Then xBcx \in B^c So xABc=x \in A \cap B^c = \emptysetContradiction. Hence xBx \in BProving ABA \subseteq B. \blacksquare

If you get this wrong, revise: Section 2.1.

Problem 5. Show that the relation RR on Z\mathbb{Z} defined by aRba\,R\,b iff aba - b is even Is an equivalence relation. How many equivalence classes are there?

Solution

Reflexive: aa=0a - a = 0Which is even. ✓ Symmetric: If aba - b is even, then ba=(ab)b - a = -(a - b) is even. ✓ Transitive: If aba - b and bcb - c are even, then ac=(ab)+(bc)a - c = (a - b) + (b - c) is even. ✓

The equivalence classes are [0] = \\{\mathrm{even\; integers{}\\} and [1] = \\{\mathrm{odd\; integers{}\\}. There are exactly 2 equivalence classes.

If you get this wrong, revise: Section 2.2.

Problem 6. Let f:RRf : \mathbb{R} \to \mathbb{R} be f(x)=2x+1f(x) = 2x + 1 and g:RRg : \mathbb{R} \to \mathbb{R} Be g(x)=x2g(x) = x^2. Find gfg \circ f and fgf \circ g. Is gfg \circ f injective?

Solution

(gf)(x)=g(f(x))=g(2x+1)=(2x+1)2=4x2+4x+1(g \circ f)(x) = g(f(x)) = g(2x + 1) = (2x + 1)^2 = 4x^2 + 4x + 1.

(fg)(x)=f(g(x))=f(x2)=2x2+1(f \circ g)(x) = f(g(x)) = f(x^2) = 2x^2 + 1.

Note gffgg \circ f \neq f \circ g So composition is not commutative.

gfg \circ f is not injective: (gf)(0)=1(g \circ f)(0) = 1 and (gf)(1)=4(1)2+4(1)+1=1(g \circ f)(-1) = 4(-1)^2 + 4(-1) + 1 = 1 But 010 \neq -1.

If you get this wrong, revise: Section 2.3.

Problem 7. Prove that the set of all infinite binary sequences is uncountable.

Solution

Suppose the set SS of all infinite binary sequences is countable, so S=s1,s2,s3,S = \\{s_1, s_2, s_3, \ldots\\} Where si=(si1,si2,si3,)s_i = (s_{i1}, s_{i2}, s_{i3}, \ldots) with each sij0,1s_{ij} \in \\{0, 1\\}.

Define t=(t1,t2,t3,)t = (t_1, t_2, t_3, \ldots) by ti=1siit_i = 1 - s_{ii} (flip the ii-th bit of the ii-th Sequence). Then tSt \in S but tsit \neq s_i for every ii (they differ in position ii). This Contradicts S=s1,s2,S = \\{s_1, s_2, \ldots\\}. Therefore SS is uncountable. \blacksquare

If you get this wrong, revise: Section 2.4.

Problem 8. Prove: the product of any two odd integers is odd.

Solution

Let a=2m+1a = 2m + 1 and b=2n+1b = 2n + 1 be odd. Then ab=(2m+1)(2n+1)=4mn+2m+2n+1=2(2mn+m+n)+1ab = (2m+1)(2n+1) = 4mn + 2m + 2n + 1 = 2(2mn + m + n) + 1 Which is odd. \blacksquare

If you get this wrong, revise: Section 3.1.

Problem 9. Prove: if 3n+23n + 2 is odd, then nn is odd.

Solution

By contrapositive: assume nn is even, so n=2kn = 2k. Then 3n+2=6k+2=2(3k+1)3n + 2 = 6k + 2 = 2(3k + 1)Which is Even. \blacksquare

If you get this wrong, revise: Section 3.2.

Problem 10. Prove: 3\sqrt{3} is irrational.

Solution

Suppose 3=p/q\sqrt{3} = p/q in lowest terms. Then 3q2=p23q^2 = p^2 So 3p23 \mid p^2Hence 3p3 \mid p. Write p=3rp = 3r. Then 3q2=9r23q^2 = 9r^2 So q2=3r2q^2 = 3r^2Giving 3q23 \mid q^2 and 3q3 \mid q. But then gcd(p,q)3\gcd(p, q) \geq 3Contradicting lowest terms. \blacksquare

If you get this wrong, revise: Section 3.3.

Problem 11. Prove by induction: i=0n2i=2n+11\sum_{i=0}^{n} 2^i = 2^{n+1} - 1 for all n0n \geq 0.

Solution

Base case: n=0n = 0: 20=1=2112^0 = 1 = 2^1 - 1. ✓

Inductive step: Assume i=0k2i=2k+11\sum_{i=0}^{k} 2^i = 2^{k+1} - 1. Then

i=0k+12i=(2k+11)+2k+1=22k+11=2k+21\sum_{i=0}^{k+1} 2^i = (2^{k+1} - 1) + 2^{k+1} = 2 \cdot 2^{k+1} - 1 = 2^{k+2} - 1

\blacksquare

If you get this wrong, revise: Section 3.4.

Problem 12. Prove by strong induction that every integer n2n \geq 2 is a product of primes.

Solution

Base case: n=2n = 2 is prime, hence a product of primes.

Inductive step: Assume every integer in 2,,k\\{2, \ldots, k\\} is a product of primes (k2k \geq 2). If k+1k + 1 is prime, done. If k+1k + 1 is composite, then k+1=abk + 1 = ab where 2a,bk2 \leq a, b \leq k. By the induction hypothesis, both aa and bb are products of primes, so k+1=abk + 1 = ab is too. \blacksquare

If you get this wrong, revise: Section 3.4 (strong induction).

Problem 13. A committee of 5 is to be chosen from 12 people. How many ways if two specific People must either both serve or neither serves?

Solution

Case 1: Both serve. Choose the remaining 3 from the other 10: (103)=120\binom{10}{3} = 120. Case 2: Neither serves. Choose all 5 from the other 10: (105)=252\binom{10}{5} = 252.

Total: 120+252=372120 + 252 = 372.

If you get this wrong, revise: Section 4.2.

Problem 14. How many integers from 1 to 500 are divisible by 3 or 7 but not by 5?

Solution

A3=166|A_3| = 166, A7=71|A_7| = 71, A3A7=23|A_3 \cap A_7| = 23. Divisible by 3 or 7: 166+7123=214166 + 71 - 23 = 214.

A3A5=33|A_3 \cap A_5| = 33, A7A5=14|A_7 \cap A_5| = 14, A3A7A5=4|A_3 \cap A_7 \cap A_5| = 4. Divisible by 3 or 7 and 5: 33+144=4333 + 14 - 4 = 43.

Divisible by 3 or 7 but not 5: 21443=171214 - 43 = 171.

If you get this wrong, revise: Section 4.3.

Problem 15. How many solutions does x1+x2+x3=15x_1 + x_2 + x_3 = 15 have with xi1x_i \geq 1?

Solution

Substitute yi=xi10y_i = x_i - 1 \geq 0: y1+y2+y3=12y_1 + y_2 + y_3 = 12 with yi0y_i \geq 0. By stars and bars: (12+3131)=(142)=91\binom{12 + 3 - 1}{3 - 1} = \binom{14}{2} = 91.

If you get this wrong, revise: Section 4.4.

Problem 16. Prove that among any 13 people, at least 2 were born in the same month.

Solution

There are 12 months and 13 people. By the pigeonhole principle, at least one month contains at least 13/12=2\lceil 13/12 \rceil = 2 people.

If you get this wrong, revise: Section 4.5.

Problem 17. Verify that C3=5C_3 = 5 using the Catalan recurrence and the closed form.

Solution

By recurrence: C3=C0C2+C1C1+C2C0=12+11+21=2+1+2=5C_3 = C_0 C_2 + C_1 C_1 + C_2 C_0 = 1 \cdot 2 + 1 \cdot 1 + 2 \cdot 1 = 2 + 1 + 2 = 5.

By closed form: C3=14(63)=1420=5C_3 = \frac{1}{4}\binom{6}{3} = \frac{1}{4} \cdot 20 = 5. ✓

If you get this wrong, revise: Section 4.6.

Problem 18. Find the chromatic number of C5C_5 (the 5-cycle) and justify.

Solution

C5C_5 is an odd cycle. It cannot be 2-coloured (an odd cycle requires 3 colours: colour the first Vertex 1, alternate 2 and 1 around, and the last vertex (5th) is adjacent to both the 4th (colour 2) And the 1st (colour 1), so it needs colour 3).

A 3-colouring exists: label vertices v1,,v5v_1, \ldots, v_5; colour v1=1v_1 = 1, v2=2v_2 = 2, v3=1v_3 = 1 v4=2v_4 = 2, v5=3v_5 = 3.

Therefore χ(C5)=3\chi(C_5) = 3.

If you get this wrong, revise: Section 5.5.

Problem 19. In the bipartite graph with partitions X=1,2,3X = \\{1, 2, 3\\} and Y=a,b,c,dY = \\{a, b, c, d\\} And edges 11a,ba,b; 22b,cb,c; 33c,dc,dVerify Hall’s condition and find a matching covering XX.

Solution

Neighbourhoods: N(1)=a,bN(\\{1\\}) = \\{a, b\\}, N(2)=b,cN(\\{2\\}) = \\{b, c\\}, N(3)=c,dN(\\{3\\}) = \\{c, d\\}. N(1,2)=a,b,cN(\\{1, 2\\}) = \\{a, b, c\\}, N(1,3)=a,b,c,dN(\\{1, 3\\}) = \\{a, b, c, d\\}, N(2,3)=b,c,dN(\\{2, 3\\}) = \\{b, c, d\\}. N(1,2,3)=a,b,c,dN(\\{1, 2, 3\\}) = \\{a, b, c, d\\}.

All satisfy N(S)S|N(S)| \geq |S|. A matching: 11aa, 22bb, 33cc.

If you get this wrong, revise: Section 5.7.

Problem 20. Solve an=3an12an2a_n = 3a_{n-1} - 2a_{n-2} with a0=0a_0 = 0, a1=1a_1 = 1.

Solution

Characteristic equation: r23r+2=0r^2 - 3r + 2 = 0Giving (r1)(r2)=0(r - 1)(r - 2) = 0 So r1=1r_1 = 1, r2=2r_2 = 2.

an=A1n+B2n=A+B2na_n = A \cdot 1^n + B \cdot 2^n = A + B \cdot 2^n.

a0=A+B=0    A=Ba_0 = A + B = 0 \implies A = -B. a1=A+2B=1    B+2B=B=1a_1 = A + 2B = 1 \implies -B + 2B = B = 1.

So A=1A = -1, B=1B = 1Giving an=2n1a_n = 2^n - 1. \blacksquare

If you get this wrong, revise: Section 6.2 and Section 6.3.

  • Confusing \Rightarrow and \Leftrightarrow. PQP \Rightarrow Q means “if PP then QQ” (sufficient condition). PQP \Leftrightarrow Q means “if and only if” (necessary and sufficient). Fix: PQP \Rightarrow Q is equivalent to ¬Q¬P\neg Q \Rightarrow \neg P (contrapositive), not QPQ \Rightarrow P (converse).
  • Wrong induction base case. The base case must be the smallest value for which the statement is claimed to hold. Fix: If the claim starts at n=1n = 1, prove n=1n = 1; if at n=0n = 0, prove n=0n = 0.
  • Confusing combinations and permutations with repetition. Standard formulas assume distinct, non-repeated items. Fix: With repetition: nrn^r (ordered) or (n+r1r)\binom{n+r-1}{r} (unordered).

Problem. Prove that k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6} for all n1n \geq 1.

Solution. Base (n=1n = 1): 1=1(2)(3)/6=11 = 1(2)(3)/6 = 1. ✓ Inductive step: assume true for nn. Then k=1n+1k2=n(n+1)(2n+1)6+(n+1)2=(n+1)[n(2n+1)+6(n+1)]6=(n+1)(2n2+7n+6)6=(n+1)(n+2)(2n+3)6\sum_{k=1}^{n+1} k^2 = \frac{n(n+1)(2n+1)}{6} + (n+1)^2 = \frac{(n+1)[n(2n+1) + 6(n+1)]}{6} = \frac{(n+1)(2n^2 + 7n + 6)}{6} = \frac{(n+1)(n+2)(2n+3)}{6}. ✓

\blacksquare

Problem. A connected planar graph has 6 vertices and 8 edges. How many faces does it have?

Solution. By Euler’s formula: VE+F=2V - E + F = 2. 68+F=2    F=46 - 8 + F = 2 \implies F = 4.

\blacksquare

flowchart TD
A[7_Problem Set] --> B[Key Concepts]
A --> C[Core Principles]
A --> D[Practical Applications]
B --> E[Fundamental definitions]
C --> F[Design patterns]
D --> G[Real-world usage]
  • Logic: propositions, truth tables, quantifiers; implication, contrapositive, converse.
  • Proof techniques: direct, contrapositive, contradiction, induction.
  • Combinatorics: permutations, combinations, inclusion-exclusion, pigeonhole principle.
  • Graph theory: Euler’s formula (VE+F=2V - E + F = 2), trees, planarity, chromatic number.

Practice problems consolidate theoretical understanding. Work through problems systematically: understand the problem, identify relevant concepts, design a solution approach, implement or prove, and verify. Start with concrete examples, then generalize. This iterative process builds intuition for recognizing problem types and selecting appropriate techniques from your mathematical toolkit.

TopicSiteLink
Discrete Mathematics (Overview)WyattsNotesView
Theory of ComputationWyattsNotesView
Abstract AlgebraWyattsNotesView
Number TheoryWyattsNotesView
Discrete Mathematics — MIT OCWMITView