This review pulls together everything from the Discrete Mathematics section. Use it to test yourself across all five areas before moving on.
Logic true / false Sets collections Proofs why it's true Counting how many Graphs connections
Every symbol used in this section, in one place.
Logic
¬p “not p”
p ∧ q “p and q” true only when both hold
p ∨ q “p or q” true when at least one holds
p ⊕ q “p exclusive-or q” exactly one, never both
p → q “if p, then q”
p ↔ q “p if and only if q”
p ≡ q “p is logically equivalent to q”
∀x “for all x”
∃x “there exists an x”
∃!x “there exists exactly one x”
Sets
x ∈ A “x is an element of A”
x ∉ A “x is not an element of A”
A ⊆ B “A is a subset of B”
∅ “the empty set”
|A| “the cardinality of A” the element count, not absolute value
𝒫(A) “the power set of A”
A ∪ B “A union B”
A ∩ B “A intersect B”
A − B “A minus B”
Ā “the complement of A”
A × B “A cross B” the set of ordered pairs
Proofs and counting
a | b “a divides b” a statement, not a fraction
a ∤ b “a does not divide b”
∎ “end of proof” also QED
∴ “therefore”
n! “n factorial”
P(n, r) “permutations of r from n” order matters
C(n, r) “n choose r” order does not matter
Σ “the sum of”
⌈x⌉ “the ceiling of x” round up
⌊x⌋ “the floor of x” round down
Graphs, relations, and modular arithmetic
G = (V, E) “a graph with vertices V and edges E”
deg(v) “the degree of vertex v”
Kₙ, Cₙ, Pₙ “the complete, cycle, and path graphs on n vertices”
(a, b) “the ordered pair a, b”
[a] “the equivalence class of a”
f : A → B “f is a function from A to B”
a mod n “a modulo n” the remainder
a ≡ b (mod n) “a is congruent to b modulo n”
gcd(a, b) “the greatest common divisor”
A proposition has a definite truth value. Predicates with free variables do not.
Connectives: ¬ p \neg p ¬ p (not), p ∧ q p \wedge q p ∧ q (and, true only when both are), p ∨ q p \vee q p ∨ q (inclusive or, true when at least one is)
A truth table with n n n propositions needs 2 n 2^n 2 n rows
Tautology : true in every row. Contradiction : false in every row.
De Morgan’s laws : ¬ ( p ∧ q ) ≡ ¬ p ∨ ¬ q \neg(p \wedge q) \equiv \neg p \vee \neg q ¬ ( p ∧ q ) ≡ ¬ p ∨ ¬ q and ¬ ( p ∨ q ) ≡ ¬ p ∧ ¬ q \neg(p \vee q) \equiv \neg p \wedge \neg q ¬ ( p ∨ q ) ≡ ¬ p ∧ ¬ q . Push the negation in, flip the connective.
p → q p \rightarrow q p → q is false only when p p p is true and q q q is false
p → q ≡ ¬ p ∨ q p \rightarrow q \equiv \neg p \vee q p → q ≡ ¬ p ∨ q , so ¬ ( p → q ) ≡ p ∧ ¬ q \neg(p \rightarrow q) \equiv p \wedge \neg q ¬ ( p → q ) ≡ p ∧ ¬ q
Contrapositive ¬ q → ¬ p \neg q \rightarrow \neg p ¬ q → ¬ p is equivalent to the original
Converse q → p q \rightarrow p q → p and inverse ¬ p → ¬ q \neg p \rightarrow \neg q ¬ p → ¬ q are not equivalent to it
”p p p only if q q q ” and ”q q q is necessary for p p p ” both mean p → q p \rightarrow q p → q
p ↔ q ≡ ( p → q ) ∧ ( q → p ) p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p) p ↔ q ≡ ( p → q ) ∧ ( q → p ) , so proving it takes two proofs
∀ x P ( x ) \forall x \, P(x) ∀ x P ( x ) : hard to prove, disproved by one counterexample
∃ x P ( x ) \exists x \, P(x) ∃ x P ( x ) : proved by one example, hard to disprove
¬ ∀ x P ( x ) ≡ ∃ x ¬ P ( x ) \neg \forall x \, P(x) \equiv \exists x \, \neg P(x) ¬∀ x P ( x ) ≡ ∃ x ¬ P ( x ) and ¬ ∃ x P ( x ) ≡ ∀ x ¬ P ( x ) \neg \exists x \, P(x) \equiv \forall x \, \neg P(x) ¬∃ x P ( x ) ≡ ∀ x ¬ P ( x )
Mixed quantifier order matters: ∀ x ∃ y \forall x \exists y ∀ x ∃ y lets y y y depend on x x x ; ∃ y ∀ x \exists y \forall x ∃ y ∀ x demands one fixed y y y
Unordered, no duplicates. { 1 , 2 , 2 , 3 } = { 1 , 2 , 3 } \{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 ∅ ⊆ A always. A = B A = B A = B iff A ⊆ B A \subseteq B A ⊆ B and B ⊆ A B \subseteq A B ⊆ A
∣ P ( A ) ∣ = 2 ∣ A ∣ |\mathcal{P}(A)| = 2^{|A|} ∣ P ( A ) ∣ = 2 ∣ A ∣ , and ∣ A × B ∣ = ∣ A ∣ ⋅ ∣ B ∣ |A \times B| = |A| \cdot |B| ∣ A × B ∣ = ∣ A ∣ ⋅ ∣ B ∣
Operations: A ∪ B A \cup B A ∪ B , A ∩ B A \cap B A ∩ B , A − B A - B A − B , A ˉ \bar{A} A ˉ , A ⊕ B A \oplus B A ⊕ B
Inclusion-exclusion : ∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ |A \cup B| = |A| + |B| - |A \cap B| ∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ , and for three sets add singles, subtract pairs, add the triple
Direct : assume p p p , unfold definitions (n = 2 k n = 2k n = 2 k for even, n = 2 k + 1 n = 2k+1 n = 2 k + 1 for odd, b = a k b = ak b = ak for a ∣ b a \mid b a ∣ b ), derive q q q
Counterexample : one case where p p p holds and q q q fails disproves an implication
Contrapositive : assume ¬ q \neg q ¬ q , derive ¬ p \neg p ¬ p . Best when the hypothesis is about a squared quantity
Contradiction : assume p ∧ ¬ q p \wedge \neg q p ∧ ¬ 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 k k k
Multiplication principle (and, steps in sequence): multiply
Addition principle (or, mutually exclusive alternatives): add
With repetition: n k n^k n k . Without: n ( n − 1 ) ⋯ ( n − k + 1 ) n(n-1)\cdots(n-k+1) n ( n − 1 ) ⋯ ( n − k + 1 )
Complement rule for “at least one”: total minus none
Permutations (order matters): P ( n , r ) = n ! ( n − r ) ! P(n,r) = \dfrac{n!}{(n-r)!} P ( n , r ) = ( n − r )! n !
Repeated items: n ! n 1 ! n 2 ! ⋯ n k ! \dfrac{n!}{n_1! \, n_2! \cdots n_k!} n 1 ! n 2 ! ⋯ n k ! n ! . Circular: ( n − 1 ) ! (n-1)! ( n − 1 )!
Combinations (order does not matter): ( n r ) = n ! r ! ( n − r ) ! \binom{n}{r} = \dfrac{n!}{r!(n-r)!} ( r n ) = r ! ( n − r )! n !
Symmetry: ( n r ) = ( n n − r ) \binom{n}{r} = \binom{n}{n-r} ( r n ) = ( n − r n ) . Sum over all r r r : 2 n 2^n 2 n
Binomial theorem : coefficient of x n − r y r x^{n-r}y^r x n − r y r in ( x + y ) n (x+y)^n ( x + y ) n is ( n r ) \binom{n}{r} ( r n )
Pigeonhole : n n n objects in k k k boxes forces ⌈ n / k ⌉ \lceil n/k \rceil ⌈ n / k ⌉ in some box. To guarantee m m m in a box, take k ( m − 1 ) + 1 k(m-1)+1 k ( m − 1 ) + 1
G = ( V , E ) G = (V,E) G = ( V , E ) . Handshake theorem : ∑ deg ( v ) = 2 ∣ E ∣ \sum \deg(v) = 2|E| ∑ deg ( v ) = 2∣ E ∣ , so the count of odd-degree vertices is even
K n K_n K n has ( n 2 ) \binom{n}{2} ( 2 n ) edges, each vertex of degree n − 1 n-1 n − 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 ∣ = ∣ V ∣ − 1 |E| = |V| - 1 ∣ E ∣ = ∣ V ∣ − 1 , unique path between every pair
Balanced binary tree of n n n vertices has height about log 2 n \log_2 n 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
a ≡ b ( m o d n ) a \equiv b \pmod n a ≡ b ( mod n ) iff n ∣ ( a − b ) n \mid (a-b) n ∣ ( a − b ) . Congruence mod n n n is an equivalence relation with n n n 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 g cd( a , n ) = 1
Fermat’s little theorem : for prime p p p with p ∤ a p \nmid a p ∤ a , a p − 1 ≡ 1 ( m o d p ) a^{p-1} \equiv 1 \pmod p a p − 1 ≡ 1 ( mod p )
Example 1: Negate a compound statement.
Negate: “If the build passes and the tests are green, then we deploy.”
Let p p p = build passes, q q q = tests green, r r r = we deploy. The statement is ( p ∧ q ) → r (p \wedge q) \rightarrow r ( p ∧ q ) → r .
¬ ( ( p ∧ q ) → r ) ≡ ( p ∧ q ) ∧ ¬ r \neg\big((p \wedge q) \rightarrow r\big) \equiv (p \wedge q) \wedge \neg r ¬ ( ( p ∧ q ) → r ) ≡ ( p ∧ q ) ∧ ¬ r
“The build passes, the tests are green, and we do not deploy.”
Example 2: Quantifier negation.
Negate: ∀ x ∃ y ( x ⋅ y = 1 ) \forall x \exists y \, (x \cdot y = 1) ∀ x ∃ y ( x ⋅ y = 1 ) over the real numbers.
∃ x ∀ y ( x ⋅ y ≠ 1 ) \exists x \forall y \, (x \cdot y \neq 1) ∃ x ∀ y ( x ⋅ y = 1 )
The negation is true , witnessed by x = 0 x = 0 x = 0 , since 0 ⋅ y = 0 0 \cdot y = 0 0 ⋅ y = 0 for every y y y . 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?
∣ M ∪ D ∣ = 120 + 90 − 45 = 165 |M \cup D| = 120 + 90 - 45 = 165 ∣ M ∪ D ∣ = 120 + 90 − 45 = 165
200 − 165 = 35 200 - 165 = 35 200 − 165 = 35
Example 4: Contrapositive proof.
Claim. For integers n n n , if n 2 − 6 n + 5 n^2 - 6n + 5 n 2 − 6 n + 5 is even, then n n n is odd.
Proof by contrapositive. Assume n n n is even, so n = 2 k n = 2k n = 2 k .
n 2 − 6 n + 5 = 4 k 2 − 12 k + 5 = 2 ( 2 k 2 − 6 k + 2 ) + 1 n^2 - 6n + 5 = 4k^2 - 12k + 5 = 2(2k^2 - 6k + 2) + 1 n 2 − 6 n + 5 = 4 k 2 − 12 k + 5 = 2 ( 2 k 2 − 6 k + 2 ) + 1
That’s odd. So an even n n n produces an odd value, and the contrapositive holds. ∎
Example 5: Induction.
Claim. 1 + 3 + 5 + ⋯ + ( 2 n − 1 ) = n 2 1 + 3 + 5 + \cdots + (2n-1) = n^2 1 + 3 + 5 + ⋯ + ( 2 n − 1 ) = n 2 for all n ≥ 1 n \geq 1 n ≥ 1 .
Base case: n = 1 n=1 n = 1 . Left side is 1, right side is 1 2 = 1 1^2 = 1 1 2 = 1 . ✓
Inductive step: Assume 1 + 3 + ⋯ + ( 2 k − 1 ) = k 2 1 + 3 + \cdots + (2k-1) = k^2 1 + 3 + ⋯ + ( 2 k − 1 ) = k 2 . Then
1 + 3 + ⋯ + ( 2 k − 1 ) + ( 2 k + 1 ) = k 2 + 2 k + 1 = ( k + 1 ) 2 1 + 3 + \cdots + (2k-1) + (2k+1) = k^2 + 2k + 1 = (k+1)^2 1 + 3 + ⋯ + ( 2 k − 1 ) + ( 2 k + 1 ) = k 2 + 2 k + 1 = ( k + 1 ) 2
By induction the formula holds for all n ≥ 1 n \geq 1 n ≥ 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:
( 14 5 ) = 2002 \binom{14}{5} = 2002 ( 5 14 ) = 2002
Teams with no designer, all engineers:
( 8 5 ) = 56 \binom{8}{5} = 56 ( 5 8 ) = 56
2002 − 56 = 1946 2002 - 56 = 1946 2002 − 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 ! = 40320 240 = 168 \frac{8!}{1! \, 5! \, 2!} = \frac{40320}{240} = 168 1 ! 5 ! 2 ! 8 ! = 240 40320 = 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 ( 3 − 1 ) + 1 = 9 4(3-1) + 1 = 9 4 ( 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 + 2 2 = 16 2 = 8 |E| = \frac{3+3+4+4+2}{2} = \frac{16}{2} = 8 ∣ E ∣ = 2 3 + 3 + 4 + 4 + 2 = 2 16 = 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 , S P,Q,R,S P , Q , R , S . Edges: P Q = 4 PQ=4 P Q = 4 , P R = 1 PR=1 P R = 1 , P S = 6 PS=6 P S = 6 , Q R = 2 QR=2 QR = 2 , Q S = 3 QS=3 QS = 3 , R S = 5 RS=5 R S = 5 .
Sorted: P R ( 1 ) PR(1) P R ( 1 ) , Q R ( 2 ) QR(2) QR ( 2 ) , Q S ( 3 ) QS(3) QS ( 3 ) , P Q ( 4 ) PQ(4) P Q ( 4 ) , R S ( 5 ) RS(5) R S ( 5 ) , P S ( 6 ) PS(6) P S ( 6 ) .
P R ( 1 ) PR(1) P R ( 1 ) - add
Q R ( 2 ) QR(2) QR ( 2 ) - add
Q S ( 3 ) QS(3) QS ( 3 ) - add. Now 3 edges for 4 vertices, done.
MST = { P R , Q R , Q S } , weight = 6 \text{MST} = \{PR, QR, QS\}, \quad \text{weight} = 6 MST = { P R , QR , QS } , weight = 6
Example 11: Modular arithmetic.
Compute 5 30 m o d 13 5^{30} \bmod 13 5 30 mod 13 .
13 is prime and 13 ∤ 5 13 \nmid 5 13 ∤ 5 , so Fermat gives 5 12 ≡ 1 ( m o d 13 ) 5^{12} \equiv 1 \pmod{13} 5 12 ≡ 1 ( mod 13 ) . Reduce the exponent mod 12:
30 = 2 ⋅ 12 + 6 ⟹ 5 30 ≡ 5 6 ( m o d 13 ) 30 = 2 \cdot 12 + 6 \quad \Longrightarrow \quad 5^{30} \equiv 5^6 \pmod{13} 30 = 2 ⋅ 12 + 6 ⟹ 5 30 ≡ 5 6 ( mod 13 )
5 2 = 25 ≡ 12 ≡ − 1 ( m o d 13 ) 5^2 = 25 \equiv 12 \equiv -1 \pmod{13} 5 2 = 25 ≡ 12 ≡ − 1 ( mod 13 )
5 6 = ( 5 2 ) 3 ≡ ( − 1 ) 3 = − 1 ≡ 12 ( m o d 13 ) 5^6 = (5^2)^3 \equiv (-1)^3 = -1 \equiv 12 \pmod{13} 5 6 = ( 5 2 ) 3 ≡ ( − 1 ) 3 = − 1 ≡ 12 ( mod 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? A. The number 12 is prime. B. Every square is a rectangle. C. x is greater than 7. D. Paris is in France.
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'? A. The file is unreadable and the disk is unmounted B. The file is unreadable or the disk is unmounted C. The file is readable or the disk is mounted D. If the file is readable then the disk is unmounted
Which statement is logically equivalent to 'if the alarm sounds, then smoke was detected'? A. If smoke was detected, then the alarm sounds B. If the alarm does not sound, then smoke was not detected C. If smoke was not detected, then the alarm does not sound D. The alarm sounds and smoke was detected
What is the negation of 'every employee completed the training'? A. No employee completed the training B. Every employee failed the training C. At least one employee did not complete the training D. Exactly one employee completed the training
For the set A = {2, {3}, 4}, which statement is TRUE? A. 3 is an element of A B. {3} is an element of A C. {2, 3} is a subset of A D. The cardinality of A is 4
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? A. Showing it holds for n = 1 through 20 B. One integer n for which 2n + 3 is composite C. Showing 2n + 3 is composite for all n D. Proving the contrapositive
Which proof technique is most natural for showing that the square root of 3 is irrational? A. Direct proof B. Mathematical induction C. Proof by contradiction D. Disproof by counterexample
In a proof by induction, why must the base case be verified? A. It anchors the chain; a valid inductive step alone can prove false statements B. It is only needed for inequality proofs C. It replaces the need for an inductive hypothesis D. It establishes that the statement holds for all n at once
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. It has an Euler circuit but no Euler path B. It has an Euler path but no Euler circuit C. It has neither an Euler path nor an Euler circuit D. It must be a tree
A tree has 30 vertices. How many edges does it have?
Which set of properties defines a partial order? A. Reflexive, symmetric, transitive B. Symmetric, antisymmetric, transitive C. Reflexive, antisymmetric, transitive D. Antisymmetric and transitive only
Compute (58 x 71) mod 7 by reducing each factor first.
Retry Quiz Retrying will remove your ✅ checkmark until you pass again.