Skip to content

Discrete Mathematics Review

This review pulls together everything from the Discrete Mathematics section. Use it to test yourself across all five areas before moving on.

Every symbol used in this section, in one place.

  • A proposition has a definite truth value. Predicates with free variables do not.
  • Connectives: ¬p\neg p (not), pqp \wedge q (and, true only when both are), pqp \vee q (inclusive or, true when at least one is)
  • A truth table with nn propositions needs 2n2^n rows
  • Tautology: true in every row. Contradiction: false in every row.
  • De Morgan’s laws: ¬(pq)¬p¬q\neg(p \wedge q) \equiv \neg p \vee \neg q and ¬(pq)¬p¬q\neg(p \vee q) \equiv \neg p \wedge \neg q. Push the negation in, flip the connective.
  • pqp \rightarrow q is false only when pp is true and qq is false
  • pq¬pqp \rightarrow q \equiv \neg p \vee q, so ¬(pq)p¬q\neg(p \rightarrow q) \equiv p \wedge \neg q
  • Contrapositive ¬q¬p\neg q \rightarrow \neg p is equivalent to the original
  • Converse qpq \rightarrow p and inverse ¬p¬q\neg p \rightarrow \neg q are not equivalent to it
  • pp only if qq” and ”qq is necessary for pp” both mean pqp \rightarrow q
  • pq(pq)(qp)p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p), so proving it takes two proofs
  • xP(x)\forall x \, P(x): hard to prove, disproved by one counterexample
  • xP(x)\exists x \, P(x): proved by one example, hard to disprove
  • ¬xP(x)x¬P(x)\neg \forall x \, P(x) \equiv \exists x \, \neg P(x) and ¬xP(x)x¬P(x)\neg \exists x \, P(x) \equiv \forall x \, \neg P(x)
  • Mixed quantifier order matters: xy\forall x \exists y lets yy depend on xx; yx\exists y \forall x demands one fixed yy
  • Unordered, no duplicates. {1,2,2,3}={1,2,3}\{1,2,2,3\} = \{1,2,3\}
  • \in compares object to set; \subseteq compares set to set
  • A\emptyset \subseteq A always. A=BA = B iff ABA \subseteq B and BAB \subseteq A
  • P(A)=2A|\mathcal{P}(A)| = 2^{|A|}, and A×B=AB|A \times B| = |A| \cdot |B|
  • Operations: ABA \cup B, ABA \cap B, ABA - B, Aˉ\bar{A}, ABA \oplus B
  • Inclusion-exclusion: AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|, and for three sets add singles, subtract pairs, add the triple
  • Direct: assume pp, unfold definitions (n=2kn = 2k for even, n=2k+1n = 2k+1 for odd, b=akb = ak for aba \mid b), derive qq
  • Counterexample: one case where pp holds and qq fails disproves an implication
  • Contrapositive: assume ¬q\neg q, derive ¬p\neg p. Best when the hypothesis is about a squared quantity
  • Contradiction: assume p¬qp \wedge \neg q, derive an impossibility. Best for non-existence and irrationality claims
  • Induction: base case plus inductive step. Both required. Strong induction assumes all cases up to kk
  • Multiplication principle (and, steps in sequence): multiply
  • Addition principle (or, mutually exclusive alternatives): add
  • With repetition: nkn^k. Without: n(n1)(nk+1)n(n-1)\cdots(n-k+1)
  • Complement rule for “at least one”: total minus none
  • Permutations (order matters): P(n,r)=n!(nr)!P(n,r) = \dfrac{n!}{(n-r)!}
  • Repeated items: n!n1!n2!nk!\dfrac{n!}{n_1! \, n_2! \cdots n_k!}. Circular: (n1)!(n-1)!
  • Combinations (order does not matter): (nr)=n!r!(nr)!\binom{n}{r} = \dfrac{n!}{r!(n-r)!}
  • Symmetry: (nr)=(nnr)\binom{n}{r} = \binom{n}{n-r}. Sum over all rr: 2n2^n
  • Binomial theorem: coefficient of xnryrx^{n-r}y^r in (x+y)n(x+y)^n is (nr)\binom{n}{r}
  • Pigeonhole: nn objects in kk boxes forces n/k\lceil n/k \rceil in some box. To guarantee mm in a box, take k(m1)+1k(m-1)+1
  • G=(V,E)G = (V,E). Handshake theorem: deg(v)=2E\sum \deg(v) = 2|E|, so the count of odd-degree vertices is even
  • KnK_n has (n2)\binom{n}{2} edges, each vertex of degree n1n-1
  • Bipartite iff no odd cycle
  • Path: no repeated vertex. Trail: no repeated edge. Cycle: closed path
  • Bridge iff the edge lies on no cycle
  • Euler (every edge once): circuit iff all degrees even; path iff exactly two odd
  • Hamilton (every vertex once): no simple test, NP-complete
  • Tree: connected, acyclic, E=V1|E| = |V| - 1, unique path between every pair
  • Balanced binary tree of nn vertices has height about log2n\log_2 n
  • MST: Kruskal sorts edges globally and skips cycles; Prim grows one tree outward
  • Reflexive, symmetric, antisymmetric, transitive
  • Equivalence relation = reflexive + symmetric + transitive, and it partitions the set
  • Partial order = reflexive + antisymmetric + transitive, and it permits incomparable pairs
  • Injective: nothing hit twice. Surjective: nothing missed. Bijective: both, and only these have inverses
  • ab(modn)a \equiv b \pmod n iff n(ab)n \mid (a-b). Congruence mod nn is an equivalence relation with nn classes
  • Addition, subtraction, multiplication, and powers all respect congruence, so reduce early
  • Division needs a modular inverse, which exists iff gcd(a,n)=1\gcd(a,n) = 1
  • Fermat’s little theorem: for prime pp with pap \nmid a, ap11(modp)a^{p-1} \equiv 1 \pmod p

Example 1: Negate a compound statement.

Negate: “If the build passes and the tests are green, then we deploy.”

Let pp = build passes, qq = tests green, rr = we deploy. The statement is (pq)r(p \wedge q) \rightarrow r.

¬((pq)r)(pq)¬r\neg\big((p \wedge q) \rightarrow r\big) \equiv (p \wedge q) \wedge \neg r

“The build passes, the tests are green, and we do not deploy.”

Example 2: Quantifier negation.

Negate: xy(xy=1)\forall x \exists y \, (x \cdot y = 1) over the real numbers.

xy(xy1)\exists x \forall y \, (x \cdot y \neq 1)

The negation is true, witnessed by x=0x = 0, since 0y=00 \cdot y = 0 for every yy. So the original statement is false.

Example 3: Inclusion-exclusion.

Of 200 surveyed users, 120 use the mobile app, 90 use the desktop app, and 45 use both. How many use neither?

MD=120+9045=165|M \cup D| = 120 + 90 - 45 = 165 200165=35200 - 165 = 35

Example 4: Contrapositive proof.

Claim. For integers nn, if n26n+5n^2 - 6n + 5 is even, then nn is odd.

Proof by contrapositive. Assume nn is even, so n=2kn = 2k.

n26n+5=4k212k+5=2(2k26k+2)+1n^2 - 6n + 5 = 4k^2 - 12k + 5 = 2(2k^2 - 6k + 2) + 1

That’s odd. So an even nn produces an odd value, and the contrapositive holds. ∎

Example 5: Induction.

Claim. 1+3+5++(2n1)=n21 + 3 + 5 + \cdots + (2n-1) = n^2 for all n1n \geq 1.

Base case: n=1n=1. Left side is 1, right side is 12=11^2 = 1. ✓

Inductive step: Assume 1+3++(2k1)=k21 + 3 + \cdots + (2k-1) = k^2. Then

1+3++(2k1)+(2k+1)=k2+2k+1=(k+1)21 + 3 + \cdots + (2k-1) + (2k+1) = k^2 + 2k + 1 = (k+1)^2

By induction the formula holds for all n1n \geq 1. ∎

Example 6: Mixed counting.

A team of 5 is chosen from 8 engineers and 6 designers, and must include at least 1 designer. How many teams?

Complement rule. Total teams:

(145)=2002\binom{14}{5} = 2002

Teams with no designer, all engineers:

(85)=56\binom{8}{5} = 56 200256=19462002 - 56 = 1946

Example 7: Permutation with repeats.

How many distinct arrangements of the letters in ASSESSES?

8 letters: A (1), S (5), E (2).

8!1!5!2!=40320240=168\frac{8!}{1! \, 5! \, 2!} = \frac{40320}{240} = 168

Example 8: Pigeonhole.

How many cards must you draw from a standard 52-card deck to guarantee 3 of the same suit?

4 suits, want 3 in one. Worst case is 2 of each suit:

4(31)+1=94(3-1) + 1 = 9

Example 9: Graph analysis.

A connected graph has degrees 3, 3, 4, 4, 2. Edges? Euler circuit? Euler path? Tree?

E=3+3+4+4+22=162=8|E| = \frac{3+3+4+4+2}{2} = \frac{16}{2} = 8

Two odd degrees (the 3’s), so no Euler circuit but an Euler path exists between them. Not a tree, since a tree on 5 vertices would need 4 edges, not 8.

Example 10: Kruskal’s algorithm.

Vertices P,Q,R,SP,Q,R,S. Edges: PQ=4PQ=4, PR=1PR=1, PS=6PS=6, QR=2QR=2, QS=3QS=3, RS=5RS=5.

Sorted: PR(1)PR(1), QR(2)QR(2), QS(3)QS(3), PQ(4)PQ(4), RS(5)RS(5), PS(6)PS(6).

  1. PR(1)PR(1) - add
  2. QR(2)QR(2) - add
  3. QS(3)QS(3) - add. Now 3 edges for 4 vertices, done.
MST={PR,QR,QS},weight=6\text{MST} = \{PR, QR, QS\}, \quad \text{weight} = 6

Example 11: Modular arithmetic.

Compute 530mod135^{30} \bmod 13.

13 is prime and 13513 \nmid 5, so Fermat gives 5121(mod13)5^{12} \equiv 1 \pmod{13}. Reduce the exponent mod 12:

30=212+653056(mod13)30 = 2 \cdot 12 + 6 \quad \Longrightarrow \quad 5^{30} \equiv 5^6 \pmod{13} 52=25121(mod13)5^2 = 25 \equiv 12 \equiv -1 \pmod{13} 56=(52)3(1)3=112(mod13)5^6 = (5^2)^3 \equiv (-1)^3 = -1 \equiv 12 \pmod{13}

Example 12: Classify a relation.

Is “has the same number of characters as” on a set of strings an equivalence relation?

  • Reflexive: every string has its own length. ✓
  • Symmetric: length equality goes both ways. ✓
  • Transitive: equal lengths chain. ✓

Yes, and its equivalence classes group strings by length.

Which of the following is NOT a proposition?
How many rows does a truth table with 5 distinct propositions require?
What is the negation of 'the file is readable and the disk is mounted'?
Which statement is logically equivalent to 'if the alarm sounds, then smoke was detected'?
What is the negation of 'every employee completed the training'?
For the set A = {2, {3}, 4}, which statement is TRUE?
In a group of 80 people, 50 speak Spanish, 35 speak French, and 20 speak both. How many speak neither?
A set has 7 elements. How many subsets does it have?
To disprove the claim 'for every integer n, 2n + 3 is prime', what suffices?
Which proof technique is most natural for showing that the square root of 3 is irrational?
In a proof by induction, why must the base case be verified?
A menu has 6 starters, 8 mains, and 5 desserts. How many three-course meals with one of each are possible?
How many distinct arrangements are there of the letters in the word PEPPER?
A club of 10 chooses a 4-person committee with no distinct roles. How many committees are possible?
A drawer holds socks in 6 colors. How many socks must be drawn to guarantee a matching pair?
A connected graph has 11 edges. What is the sum of all its vertex degrees?
A connected graph has exactly two vertices of odd degree. What can you conclude?
A tree has 30 vertices. How many edges does it have?
Which set of properties defines a partial order?
Compute (58 x 71) mod 7 by reducing each factor first.