Discrete Mathematics Formula Sheet — GATE CS Quick Reference

Discrete Mathematics — Complete Formula Sheet

GATE CS Quick Reference — Sets, Relations, Functions, Graph Theory, Combinatorics, Number Theory, Recurrence Relations & Probability

Last Updated: April 2026

📌 How to Use This Sheet

  • This is a comprehensive quick-reference for all Discrete Mathematics formulas tested in GATE CS.
  • Formulas are grouped by topic — jump directly to the section you need using the table of contents.
  • For full derivations, worked examples, and explanations, follow the links at each section to the detailed topic pages.
  • Bookmark this page and review it during your GATE CS revision — it covers all 7 major DM topics in one place.

1. Sets & Power Sets

FormulaExpression
Power set size|P(A)| = 2n where n = |A|
Cartesian product size|A × B| = |A| × |B|
Inclusion-Exclusion (2)|A∪B| = |A|+|B|−|A∩B|
Inclusion-Exclusion (3)|A∪B∪C| = |A|+|B|+|C|−|A∩B|−|B∩C|−|A∩C|+|A∩B∩C|
De Morgan (sets)(A∪B)’ = A’∩B’   |   (A∩B)’ = A’∪B’
Symmetric difference|A⊕B| = |A|+|B|−2|A∩B|
Subsets of size rC(n,r) subsets of an n-element set
Number of divisors of n = p₁a₁…pₖaₖτ(n) = (a₁+1)(a₂+1)…(aₖ+1)

→ Full Sets, Relations & Functions Guide

2. Relations — Counting & Properties

TypeCount (set with n elements)
All relations on A2
Reflexive relations2n²−n
Irreflexive relations2n²−n
Symmetric relations2n(n+1)/2
Antisymmetric relations2n × 3n(n−1)/2
Reflexive + Symmetric2n(n−1)/2
Equivalence relations (= Bell number)B(n): 1,2,5,15,52,203… for n=1,2,3,4,5,6

Equivalence relation = Reflexive + Symmetric + Transitive

Partial order (POSET) = Reflexive + Antisymmetric + Transitive

Total order = Partial order where every pair is comparable

→ Full Guide

3. Functions — Counting

For functions f: A → B where |A|=m, |B|=n:

TypeCountCondition
Total functionsnm
Injective (one-to-one)P(n,m) = n!/(n−m)!Requires n ≥ m
Surjective (onto)k=0n(−1)kC(n,k)(n−k)mRequires m ≥ n
Bijectiven!Requires m = n

Inverse exists iff function is bijective.

(g ∘ f)(x) = g(f(x)) — apply f first, then g.

Order of element a in (ℤₙ,+) = n / gcd(a,n)

→ Full Guide

4. Graph Theory

FormulaExpression
Handshaking Lemma∑deg(v) = 2|E|; odd-degree vertices count = even
Directed: in-deg = out-deg∑in-deg(v) = ∑out-deg(v) = |E|
Complete graph Kn edgesn(n−1)/2
Complete bipartite Km,n edgesm × n
Euler Circuit conditionConnected + ALL degrees even
Euler Path conditionConnected + EXACTLY 2 odd-degree vertices
Tree: edgesn − 1 edges for n vertices
Labeled trees on n verticesnn−2 (Cayley’s formula)
Forest: k components, n verticesn − k edges
Euler’s planar formulaV − E + F = 2 (connected planar graph)
Planar boundE ≤ 3V−6 (general); E ≤ 2V−4 (bipartite/triangle-free)
Binary tree (perfect, height h)2h+1−1 nodes; 2h leaves
Complete binary tree height⌊log₂n⌋ for n nodes
Chromatic number — bipartiteχ = 2 (non-empty)
Chromatic number — complete Knχ = n
Chromatic number — odd cycleχ = 3
Four Color Theoremχ ≤ 4 for any planar graph

→ Full Graph Theory Guide

5. Combinatorics

FormulaExpression
Permutation P(n,r)n! / (n−r)!
Combination C(n,r)n! / (r!(n−r)!); symmetry: C(n,r)=C(n,n−r)
Pascal’s identityC(n,r) = C(n−1,r−1) + C(n−1,r)
Binomial theorem(x+y)n = ∑C(n,k)xkyn−k
Sum of binomial coefficients∑C(n,k) = 2n
Circular permutations(n−1)!
Necklace permutations(n−1)!/2
Pigeonhole (basic)n+1 objects, n boxes → ≥1 box has ≥2 objects
Pigeonhole (generalized)kn+1 objects, n boxes → ≥1 box has ≥k+1 objects
Derangements D(n)n![1−1+1/2!−1/3!+…+(−1)n/n!] ≈ n!/e
D(n) recurrenceD(n) = (n−1)[D(n−1)+D(n−2)]; D(1)=0, D(2)=1
D valuesD(3)=2, D(4)=9, D(5)=44, D(6)=265
Stars & Bars (≥0)x₁+…+xₖ=n, xᵢ≥0: C(n+k−1, k−1)
Stars & Bars (≥1)x₁+…+xₖ=n, xᵢ≥1: C(n−1, k−1)
Surjections f:A→B (|A|=m, |B|=n)k=0n(−1)kC(n,k)(n−k)m

→ Full Combinatorics Guide

6. Number Theory & Algebraic Structures

FormulaExpression
GCD × LCMgcd(a,b) × lcm(a,b) = |a × b|
Euclidean algorithmgcd(a,b) = gcd(b, a mod b)
Euler’s totient φ(pᵏ)pᵏ − pᵏ⁻¹
Euler’s totient φ(n)n × ∏p|n(1 − 1/p)
Fermat’s Little Theoremap−1 ≡ 1 (mod p) [p prime, gcd(a,p)=1]
Euler’s Theoremaφ(n) ≡ 1 (mod n) [gcd(a,n)=1]
Modular inverse (prime mod)a⁻¹ ≡ ap−2 (mod p)
CRT: unique solution modM = m₁×m₂×…×mₖ (pairwise coprime)
Lagrange’s theorem|H| divides |G| for subgroup H of finite group G
Generators of ℤₙφ(n) generators (elements coprime to n)
Order of a in (ℤₙ,+)n / gcd(a,n)
GF(q) exists iffq = pⁿ for prime p, positive integer n

→ Full Number Theory Guide

7. Recurrence Relations

Formula / RuleExpression
Fibonacci F(n)F(n−1)+F(n−2); closed: (φⁿ−ψⁿ)/√5; φ=(1+√5)/2
Tower of HanoiT(n)=2T(n−1)+1; T(n)=2ⁿ−1
Master Theorem T(n)=aT(n/b)+f(n)p=logba
Master Case 1 (f slow)f=O(np−ε) → T=Θ(np)
Master Case 2 (f equal)f=Θ(nplogkn) → T=Θ(nplogk+1n)
Master Case 3 (f fast)f=Ω(np+ε) + regularity → T=Θ(f(n))
Binary search T(n)=T(n/2)+1Θ(log n)
Merge sort T(n)=2T(n/2)+nΘ(n log n)
Homogeneous recurrenceCharacteristic eqn → roots → general solution
Repeated root r (mult m)Contributes (A₀+A₁n+…+Aₘ₋₁nᵐ⁻¹)rⁿ
Non-homogeneous (particular)Try C×sⁿ; if s is char. root of mult m → C×nᵐ×sⁿ

→ Full Recurrence Relations Guide

8. Probability & Distributions

FormulaExpression
Conditional probabilityP(A|B) = P(A∩B)/P(B)
Multiplication ruleP(A∩B) = P(A|B)P(B) = P(B|A)P(A)
Total probabilityP(A) = ΣP(A|Bᵢ)P(Bᵢ)
Bayes’ theoremP(Bᵢ|A) = P(A|Bᵢ)P(Bᵢ) / ΣP(A|Bⱼ)P(Bⱼ)
IndependenceP(A∩B) = P(A)P(B)
Expectation (discrete)E[X] = ΣxP(X=x)
VarianceVar(X) = E[X²]−(E[X])²
Linearity of expectationE[aX+b] = aE[X]+b; E[X+Y]=E[X]+E[Y]
Variance of sum (independent)Var(X+Y) = Var(X)+Var(Y)
DistributionE[X]Var(X)PMF/PDF
Bernoulli(p)pp(1−p)P(1)=p, P(0)=1−p
Binomial(n,p)npnp(1−p)C(n,k)pk(1−p)n−k
Geometric(p)1/p(1−p)/p²(1−p)k−1p, k≥1
Poisson(λ)λλe−λλk/k!
Uniform(a,b)(a+b)/2(b−a)²/121/(b−a)
Normal(μ,σ²)μσ²(1/σ√2π)e−(x−μ)²/2σ²
Exponential(λ)1/λ1/λ²λe−λx, x≥0

→ Full Probability Guide

Next Steps — Explore Each Topic in Depth

This formula sheet is your revision companion. For full explanations and worked examples, visit each topic page:

Leave a Comment