ASU · Discrete Mathematical Structures

DISCRETE
MATH
STRUCTURES

An interactive reference covering logic, proofs, sets, functions, number theory, induction, combinatorics, and graph theory — every formula, concept, and technique you need.

Propositional Logic Proof Techniques Set Theory Big-O Notation Modular Arithmetic Mathematical Induction Combinatorics Graph Theory
01
PROPOSITIONAL LOGIC
Logical Operators
¬p
Negation
Reverses truth value. If p is T, ¬p is F.
T→F, F→T
p ∧ q
Conjunction (AND)
True only when BOTH p and q are true.
T∧T=T, all others=F
p ∨ q
Disjunction (OR)
True when AT LEAST ONE of p, q is true.
F∨F=F, all others=T
p ⊕ q
Exclusive OR
True when EXACTLY ONE of p, q is true — not both.
T⊕T=F, T⊕F=T, F⊕T=T, F⊕F=F
p → q
Implication (IF-THEN)
FALSE only when p is TRUE and q is FALSE. The most critical operator.
T→F=F, all others=T
p ↔ q
Biconditional (IFF)
True when p and q have IDENTICAL truth values.
T↔T=T, F↔F=T, else F
Conditional Relatives — Know All Four
NameFormEquivalent ToKey Fact
Implicationp → q¬p ∨ qOriginal statement
Converseq → pNOT equivalent to original
Inverse¬p → ¬qNOT equivalent; equivalent to converse
Contrapositive¬q → ¬pp → qLOGICALLY EQUIVALENT to original ✓
Laws of Logic (Equivalences)
Identity Laws
p ∧ T ≡ p
p ∨ F ≡ p
Domination Laws
p ∨ T ≡ T
p ∧ F ≡ F
Idempotent Laws
p ∨ p ≡ p
p ∧ p ≡ p
Double Negation
¬(¬p) ≡ p
De Morgan's Laws ⚡
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
Negate → flip AND/OR, distribute negation.
Distributive Laws
p ∧ (q ∨ r) ≡ (p∧q) ∨ (p∧r)
p ∨ (q ∧ r) ≡ (p∨q) ∧ (p∨r)
Absorption Laws
p ∨ (p ∧ q) ≡ p
p ∧ (p ∨ q) ≡ p
Negation Laws
p ∨ ¬p ≡ T (Tautology)
p ∧ ¬p ≡ F (Contradiction)
Quantifiers — Predicate Logic
∀x
Universal Quantifier
"For ALL x in the domain, P(x) is true."
To DISPROVE: find ONE counterexample.
Negation: ¬∀x P(x) ≡ ∃x ¬P(x)
∃x
Existential Quantifier
"There EXISTS at least one x such that P(x) is true."
To DISPROVE: show P(x) is false for every x.
Negation: ¬∃x P(x) ≡ ∀x ¬P(x)

INTERACTIVE TRUTH TABLE

Select a compound proposition to generate its truth table:

02
METHODS OF PROOF
Rules of Inference
RuleGivenConcludeForm
Modus Ponensp → q, pq[(p→q) ∧ p] → q
Modus Tollensp → q, ¬q¬p[(p→q) ∧ ¬q] → ¬p
Hypothetical Syllogismp → q, q → rp → rChain rule
Disjunctive Syllogismp ∨ q, ¬pqIf not this, then that
Additionpp ∨ qCan always add disjunct
Simplificationp ∧ qpExtract from conjunction
Conjunctionp, qp ∧ qCombine two truths
Universal Instantiation∀x P(x)P(c)Any specific c in domain
Universal GeneralizationP(c) for arbitrary c∀x P(x)Must hold for ALL values
Existential Instantiation∃x P(x)P(c) for some cName the witness
Proof Strategies — Click to Expand
Direct Direct Proof: "If p, then q"

Assume p is true, then use logical steps to conclude q is true.

Example: Prove that if n is odd, then n² is odd.

01
Assume n is odd.
Assume the hypothesis
02
By definition: n = 2k + 1 for some integer k.
Definition of odd number
03
n² = (2k+1)² = 4k² + 4k + 1 = 2(2k²+2k) + 1
Expand and factor
04
Let m = 2k²+2k (an integer). Then n² = 2m+1.
Substitution
05
Therefore n² is odd. □
Definition of odd — proof complete (QED)
Contrapositive Proof by Contrapositive: Prove ¬q → ¬p instead

Since p→q ≡ ¬q→¬p, proving the contrapositive is logically equivalent. Use when the conclusion involves a negative property.

Example: Prove that if n² is odd, then n is odd.

01
We prove the contrapositive: if n is EVEN, then n² is EVEN.
Identify ¬q → ¬p
02
Assume n is even: n = 2k for some integer k.
Definition of even
03
n² = (2k)² = 4k² = 2(2k²)
Algebra
04
Since 2k² is an integer, n² is even. □
Definition of even — contrapositive proven
Contradiction Proof by Contradiction: Assume ¬p, derive absurdity

Assume the statement is FALSE. Show this leads to a contradiction (like 1=0 or x is both odd and even). Therefore the statement must be TRUE.

Classic example: Prove √2 is irrational.

01
Assume √2 IS rational (negation of what we want to prove).
Assume ¬p
02
Then √2 = a/b where a, b are integers with gcd(a,b)=1 (fully reduced).
Definition of rational in lowest terms
03
2 = a²/b² → a² = 2b² → a² is even → a is even.
Square both sides; even square → even number
04
Write a = 2c. Then 4c² = 2b² → b² = 2c² → b is even.
Substitute and simplify
05
Both a and b are even — CONTRADICTION. They can't share factor 2 in reduced form. □
Contradicts gcd(a,b)=1 assumption
Cases Proof by Cases: Split domain, prove each case

Divide the domain into EXHAUSTIVE cases, then prove the statement holds in EVERY case.

Example: Prove n² + n is even for all integers n.

01
Case 1: n is even. Write n = 2k. Then n²+n = 4k²+2k = 2(2k²+k). Even. ✓
Even case
02
Case 2: n is odd. Write n = 2k+1. Then n²+n = (4k²+4k+1)+(2k+1) = 4k²+6k+2 = 2(2k²+3k+1). Even. ✓
Odd case
03
Every integer is even or odd (exhaustive). In both cases n²+n is even. □
All cases covered — QED
03
SET THEORY
Set Operations
OperationSymbolFormal DefinitionMeaning
UnionA ∪ B{x | x∈A ∨ x∈B}Everything in A OR B
IntersectionA ∩ B{x | x∈A ∧ x∈B}Only what's in BOTH
DifferenceA − B{x | x∈A ∧ x∉B}A without B's elements
ComplementĀ or A'{x | x∉A}Everything NOT in A
Cartesian ProductA × B{(a,b) | a∈A, b∈B}All ordered pairs
Power SetP(A) or 2^ASet of all subsets of A|P(A)| = 2^|A|
Set Identities (Mirror of Logic Laws)
De Morgan's Laws (Sets)
̄(A ∪ B) = Ā ∩ B̄
̄(A ∩ B) = Ā ∪ B̄
Complement flips ∪ and ∩. Mirrors logic: ¬(p∨q)≡¬p∧¬q
Inclusion-Exclusion (2 sets)
|A ∪ B| = |A| + |B| - |A ∩ B|
Subtract overlap to avoid double-counting.
Inclusion-Exclusion (3 sets)
|A∪B∪C| = |A|+|B|+|C|
- |A∩B| - |A∩C| - |B∩C|
+ |A∩B∩C|
Distributive Laws (Sets)
A ∩ (B ∪ C) = (A∩B) ∪ (A∩C)
A ∪ (B ∩ C) = (A∪B) ∩ (A∪C)
Cardinality Key Facts
|A × B| = |A| · |B|
|P(A)| = 2^|A|
A set with 3 elements has 2³ = 8 subsets (including ∅ and itself).
Subset Definition
A ⊆ B ↔ ∀x(x∈A → x∈B)
A = B ↔ A⊆B ∧ B⊆A
∅ ⊆ A for every set A. ∅ is subset of everything.

VENN DIAGRAM VISUALIZER

A B U
04
FUNCTIONS & MAPPINGS
Function Classification
Injective (One-to-One)
f(a) = f(b) → a = b
No two inputs map to the same output. Distinct domain elements → distinct codomain elements.

Test: horizontal line hits graph AT MOST once.
Surjective (Onto)
∀y∈B ∃x∈A: f(x) = y
Every element in the CODOMAIN has at least one preimage. Range = Codomain.

Test: every output value is achieved.
Bijective (1-1 Correspondence)
Injective AND Surjective
Perfect pairing between domain and codomain. Only bijections have INVERSES.

Used to prove two sets have same cardinality.
Floor & Ceiling
⌊x⌋ = greatest int ≤ x
⌈x⌉ = least int ≥ x
⌊3.7⌋ = 3, ⌈3.2⌉ = 4
⌊-2.3⌋ = -3, ⌈-2.7⌉ = -2
Function Composition
(f ∘ g)(x) = f(g(x))
Apply g first, then f. Order matters — composition is not commutative in general.
Inverse Function
f⁻¹: B → A exists
iff f is bijective
f⁻¹(y) = x ↔ f(x) = y
f ∘ f⁻¹ = Identity
f⁻¹ ∘ f = Identity
Counting Functions Between Sets
TypeCount (|A|=m, |B|=n)Condition
Any functionn^mNo restrictions
Injective functionsP(n,m) = n!/(n-m)!Requires n ≥ m
Bijective functionsn! (if m = n)Requires m = n
05
ALGORITHM COMPLEXITY
Big-O Definition
Formal Big-O Definition
f(x) is O(g(x)) if ∃ constants C > 0 and k
such that |f(x)| ≤ C|g(x)| for all x > k
Big-O gives an UPPER BOUND on growth rate. We care about behavior as n → ∞, ignoring constants and lower-order terms.
Complexity Classes
ClassNameExamplen=10n=100
O(1)ConstantArray index access11
O(log n)LogarithmicBinary search~3~7
O(n)LinearLinear scan10100
O(n log n)LinearithmicMerge sort~33~664
O(n²)QuadraticBubble sort10010,000
O(n³)CubicMatrix multiply (naive)1,0001,000,000
O(2^n)ExponentialBrute-force TSP1,0241.27×10³⁰
O(n!)FactorialAll permutations3,628,8009.3×10¹⁵⁷

GROWTH RATE VISUALIZER

Big-O Arithmetic Rules
Sum Rule
O(f) + O(g) = O(max(f,g))
O(n²) + O(n) = O(n²). The dominant term wins.
Product Rule
O(f) · O(g) = O(f·g)
Nested loops: O(n) inside O(n) = O(n²)
Drop Constants
O(5n) = O(n)
O(3n² + 7n) = O(n²)
Multiplicative constants are irrelevant for asymptotic analysis.
Logarithm Base Doesn't Matter
O(log₂ n) = O(log₁₀ n) = O(ln n)
Base change is just a constant factor: logₐ n = log₂ n / log₂ a
06
NUMBER THEORY
Divisibility & Modular Arithmetic
Divisibility
a | b ↔ ∃k∈Z: b = k·a
Read "a divides b." If 3|12, then 12=4×3. Key property: if a|b and b|c then a|c.
Division Algorithm
a = d·q + r, 0 ≤ r < d
Every integer a, divisor d > 0 gives unique quotient q and remainder r.
a mod d = r
Congruence
a ≡ b (mod m)
iff m | (a - b)
a and b have the same remainder when divided by m.
17 ≡ 5 (mod 12) since 12|(17-5)=12 ✓
Modular Arithmetic Rules
(a+b) mod m = ((a mod m)+(b mod m)) mod m
(a·b) mod m = ((a mod m)·(b mod m)) mod m
GCD & The Euclidean Algorithm
Euclidean Algorithm
gcd(a, b) = gcd(b, a mod b)
Base case: gcd(a, 0) = a
Example: gcd(252, 198)
252 = 1·198 + 54 → gcd(198, 54)
198 = 3·54 + 36 → gcd(54, 36)
54 = 1·36 + 18 → gcd(36, 18)
36 = 2·18 + 0 → gcd = 18
Key Theorems
Fermat's Little Theorem
a^p ≡ a (mod p)
If p∤a: a^(p-1) ≡ 1 (mod p)
p must be PRIME. Used for fast modular exponentiation in RSA encryption.
Example: 2^12 mod 13 = 2^(13-1) mod 13 = 1 mod 13 = 1
Chinese Remainder Theorem
System of x ≡ aᵢ (mod mᵢ)
has unique solution if all mᵢ pairwise coprime
gcd(mᵢ, mⱼ) = 1 for all i ≠ j ensures a unique solution modulo m₁·m₂···mₖ.
Fundamental Theorem of Arithmetic
Every n > 1 = p₁^a₁ · p₂^a₂ · ... · pₖ^aₖ
Every integer > 1 has a UNIQUE prime factorization. Basis for RSA: easy to multiply primes, computationally hard to factor the product.
Modular Exponentiation
a^n mod m
Use repeated squaring
To compute 3^10 mod 7:
3²=9≡2, 3⁴≡4, 3⁸≡2 (mod 7)
3^10 = 3^8 · 3^2 ≡ 2·2 = 4 (mod 7)

MODULAR ARITHMETIC CALCULATOR

07
MATHEMATICAL INDUCTION
The Three Flavors
Weak Induction
1. Prove P(1) [base case]
2. Prove P(k) → P(k+1)
The classic. Assume the statement holds for k, prove it holds for k+1. Most straightforward approach.
Strong Induction
1. Prove P(1)
2. Prove [P(1)∧...∧P(k)] → P(k+1)
Assume it holds for ALL values 1 through k. Stronger inductive hypothesis. Needed for Fibonacci, prime factorization proofs.
Structural Induction
1. Base: prove for initial set elements
2. Recursive: prove for new elements built from existing ones
For recursively defined structures (trees, strings, sets). The ASU formal paper topic — write every step in full sentences.

STEP-THROUGH: WEAK INDUCTION PROOF

Prove: 1+2+3+···+n = n(n+1)/2 for all n ≥ 1
01
State the Proposition P(n)
P(n): "1 + 2 + 3 + ··· + n = n(n+1)/2"

We want to prove this holds for every positive integer n ≥ 1.
02
Base Case: Prove P(1)
LHS: 1
RHS: 1(1+1)/2 = 1(2)/2 = 1

LHS = RHS = 1. ✓ P(1) is true.
03
Inductive Hypothesis: Assume P(k)
Assume P(k) is true for some integer k ≥ 1:

"1 + 2 + ··· + k = k(k+1)/2"

This is our assumption — we now use it to prove P(k+1).
04
Inductive Step: Prove P(k+1)
We must show: 1+2+···+k+(k+1) = (k+1)(k+2)/2

LHS = [1+2+···+k] + (k+1)
= k(k+1)/2 + (k+1) ← by Inductive Hypothesis
= (k+1)[k/2 + 1]
= (k+1)(k+2)/2 ✓ This is exactly P(k+1)!
05
Conclusion
By the Principle of Mathematical Induction, since P(1) is true and P(k) → P(k+1) for all k ≥ 1, we conclude that P(n) is true for all positive integers n. □
08
COMBINATORICS & COUNTING
Fundamental Principles
Product Rule (AND)
If task 1 has m ways
and task 2 has n ways
→ together: m × n ways
Passwords: 26 letters × 10 digits = 260 two-character combos
Sum Rule (OR)
If task can be done in m OR n ways
(disjoint sets)
→ total: m + n ways
Choose 1 item: 5 from box A OR 7 from box B = 12 choices
Pigeonhole Principle
n objects in k boxes
→ ∃ box with ≥ ⌈n/k⌉ objects
13 people → at least 2 share a birth month. Used to prove hash collision existence.
Complement Counting
|A| = |U| - |Ā|
Sometimes easier to count what you DON'T want, then subtract. "At least one" problems.
Permutations & Combinations
TypeOrder Matters?FormulaExample
Permutation P(n,r)✓ YESn! / (n-r)!Arrange 3 from 5: P(5,3)=60
Combination C(n,r)✗ NOn! / (r!(n-r)!)Choose 3 from 5: C(5,3)=10
Perm w/ Repetition✓ YESn^r4-digit PIN: 10⁴=10,000
Combo w/ Repetition✗ NOC(n+r-1, r)Choose 2 flavors from 5 (repeats ok): C(6,2)=15
Circular Permutation✓ YES(n-1)!Seat 5 at round table: 4!=24
Multinomial✓ YESn! / (n₁!n₂!···nₖ!)Arrangements of MISSISSIPPI
Binomial Theorem
Binomial Theorem
(x + y)^n = Σ C(n,k) · x^(n-k) · y^k for k=0 to n
The k-th term (from k=0): C(n,k) · x^(n-k) · y^k

Pascal's Identity: C(n+1, k) = C(n,k-1) + C(n,k)
Each entry in Pascal's Triangle = sum of two above it.

COUNTING CALCULATOR

09
RELATIONS & GRAPH THEORY
Relation Properties
PropertyDefinitionFormalExample on {1,2,3}
ReflexiveEvery element relates to itself∀x: (x,x) ∈ R{(1,1),(2,2),(3,3),...}
SymmetricIf aRb then bRa∀x,y: (x,y)∈R → (y,x)∈RIf (1,2)∈R then (2,1)∈R
AntisymmetricIf aRb and bRa, then a=b(x,y)∈R ∧ (y,x)∈R → x=y≤ is antisymmetric
TransitiveIf aRb and bRc then aRc(x,y)∈R ∧ (y,z)∈R → (x,z)∈RIf (1,2),(2,3)∈R then (1,3)∈R
Equivalence Relation
Reflexive + Symmetric + Transitive
Groups elements into disjoint EQUIVALENCE CLASSES that partition the set.
Example: ≡ (mod m), same birthday, same length strings.
Partial Ordering (POSET)
Reflexive + Antisymmetric + Transitive
Models hierarchies. Visualized as Hasse diagram.
Examples: ≤ on integers, ⊆ on sets, divisibility on N.
Graph Theory Fundamentals
Graph G = (V, E)
V = vertices (nodes)
E ⊆ V × V = edges
Undirected: edges are unordered pairs {u,v}
Directed: edges are ordered pairs (u,v)
Degree & Handshaking
Σ deg(v) = 2|E|
Sum of all vertex degrees = twice the number of edges. Corollary: number of odd-degree vertices is ALWAYS even.
Euler vs Hamilton
Euler: every EDGE once
Hamilton: every VERTEX once
Euler circuit exists ↔ connected + all even degrees. Hamilton path: NP-complete — no simple condition.
Euler Circuit Condition
Connected multigraph has
Euler circuit ↔
every vertex has even degree
Euler PATH (different endpoints): exactly 2 vertices of odd degree.
Graph Isomorphism
G₁ ≅ G₂ if ∃ bijection f: V₁→V₂
preserving adjacency
Same structure, possibly drawn differently. Check: same vertex count, edge count, degree sequence.
Trees
Connected graph with no cycles
|E| = |V| - 1
Any two vertices connected by exactly one path. Used in: file systems, decision trees, spanning trees, parse trees.

INTERACTIVE GRAPH

Drag vertices to rearrange. Hover to highlight connections.
Vertices |V|
7
Edges |E|
9
Σ degrees
18
Euler Circuit
Max Degree
10
MASTER FORMULA REFERENCE
Logic
Conditional Equivalence
p → q ≡ ¬p ∨ q
Implication as disjunction. Useful for converting conditionals.
Logic
Biconditional
p ↔ q ≡ (p→q) ∧ (q→p)
p if and only if q. Both implications must hold.
Logic
De Morgan #1
¬(p ∧ q) ≡ ¬p ∨ ¬q
Negate AND → flip to OR with negations distributed.
Logic
De Morgan #2
¬(p ∨ q) ≡ ¬p ∧ ¬q
Negate OR → flip to AND with negations distributed.
Sets
Inclusion-Exclusion (2)
|A ∪ B| = |A| + |B| - |A ∩ B|
Subtract overlap to avoid counting twice.
Sets
Power Set Size
|P(A)| = 2^|A|
A set with n elements has 2ⁿ subsets (including ∅ and A itself).
Counting
Permutation
P(n,r) = n! / (n-r)!
r items from n, ORDER matters. P(5,3) = 5·4·3 = 60
Counting
Combination
C(n,r) = n! / (r!(n-r)!)
r items from n, order does NOT matter. C(5,3) = 10
Counting
Pascal's Identity
C(n+1,r) = C(n,r-1) + C(n,r)
Foundation of Pascal's Triangle. Each entry = sum of two above.
Counting
Binomial Theorem
(x+y)^n = Σ C(n,k) x^(n-k) y^k
Sum from k=0 to n. Coefficient of x^(n-k)y^k is C(n,k).
Number Theory
Division Algorithm
a = d·q + r, 0 ≤ r < d
Unique q (quotient) and r (remainder) for any a, d>0.
Number Theory
Euclidean Algorithm
gcd(a,b) = gcd(b, a mod b)
Repeat until remainder = 0. gcd(a,0) = a.
Number Theory
Fermat's Little Theorem
a^(p-1) ≡ 1 (mod p), if p∤a
p must be prime. Key tool for fast modular exponentiation and RSA.
Graph Theory
Handshaking Theorem
Σ deg(v) = 2|E|
Sum of all degrees = 2× edge count. Always even.
Graph Theory
Tree Edge Count
Tree on n vertices has n-1 edges
Connected, acyclic. Adding any edge creates exactly one cycle.
Probability
Bayes' Theorem
P(A|B) = P(B|A)·P(A) / P(B)
Conditional probability inversion. Updates beliefs with evidence.