📋 Master Formula Sheet & Quick Reference

Purpose: This is the single-page quick reference for every key formula, identity, and complexity result across all AI topics tested in GATE DA. Print it, bookmark it, and use it during your final revision. Formulas are grouped by chapter and topic.
How to Use: Skim before each mock test to refresh your memory. Highlight any formula you keep forgetting. Come back to this page during the last 48 hours before the exam for a rapid sweep.

1. Search Algorithms (Ch 02 & 03)

Notation: b = branching factor, d = depth of shallowest goal, m = maximum depth of the search tree, l = depth limit, C* = optimal path cost, ε = minimum step cost.
Algorithm Time Space Complete? Optimal?
BFS O(bd) O(bd) Yes (finite b) Yes (uniform cost)
DFS O(bm) O(bm) No No
DLS O(bl) O(bl) No No
IDDFS O(bd) O(bd) Yes Yes (uniform cost)
UCS O(b1+⌊C*/ε⌋) O(b1+⌊C*/ε⌋) Yes (ε > 0) Yes
Bidirectional O(bd/2) O(bd/2) Yes Yes (uniform cost)
IDDFS Overhead: Total nodes generated = d·b + (d−1)·b² + … + 1·bd. The overhead ratio compared to BFS is b/(b−1), which is less than 11% for b ≥ 10.
A* Evaluation Function:
f(n) = g(n) + h(n)
where g(n) = cost from start to n, h(n) = estimated cost from n to goal
Admissibility (guarantees optimality with Tree Search):
h(n) ≤ h*(n) for all n
where h*(n) is the true cheapest cost from n to goal
Consistency / Monotonicity (guarantees optimality with Graph Search):
h(n) ≤ c(n, a, n′) + h(n′) for every successor n′ of n
Consistency implies admissibility (but not vice versa).
Effective Branching Factor b*:
N + 1 = (b*)d+1
where N = total nodes expanded, d = solution depth. A good heuristic has b* close to 1.
Greedy Best-First Search:
f(n) = h(n)
Not optimal, not complete (in infinite state spaces). Time & Space: O(bm) worst case.
IDA* (Iterative Deepening A*):
Uses f-cost limit instead of depth limit. Space: O(bd). Optimal if h is admissible.
Hill Climbing: Move to neighbor with highest value. Can get stuck at local maxima, ridges, and plateaus.
Simulated Annealing — Acceptance Probability:
P(accept) = e−ΔE / T
where ΔE = value(next) − value(current), T = temperature. As T → 0, becomes greedy.
Genetic Algorithm Operators:
Fitness function → Selection → Crossover → Mutation → Next generation
Schema theorem: short, low-order, above-average schemata grow exponentially.
Minimax Value:
MINIMAX(s) =
  • UTILITY(s) — if s is a terminal state
  • maxa MINIMAX(RESULT(s, a)) — if PLAYER(s) = MAX
  • mina MINIMAX(RESULT(s, a)) — if PLAYER(s) = MIN
Time: O(bm), Space: O(bm)
Alpha-Beta Pruning:
α = best value MAX can guarantee (initially −∞)
β = best value MIN can guarantee (initially +∞)
Prune when α ≥ β

Complexity:
• Worst case: O(bm) — no pruning
• Best case (perfect ordering): O(bm/2) — effectively doubles searchable depth
• Random ordering: O(b3m/4)
Expectiminimax (Stochastic Games):
Adds CHANCE nodes between MAX/MIN layers:
EXPECTIMINIMAX(s) = Σr P(r) · EXPECTIMINIMAX(RESULT(s, r))
Time: O(bm · nm) where n = number of chance outcomes. Alpha-beta pruning is less effective here.
Move Ordering Tip: In alpha-beta, examine the likely best moves first (e.g., killer heuristic, history heuristic) to maximize pruning.

3. Propositional Logic (Ch 05)

3.1 Key Logical Equivalences

De Morgan’s Laws:
¬(A ∧ B) ≡ ¬A ∨ ¬B
¬(A ∨ B) ≡ ¬A ∧ ¬B
Implication Elimination:
A → B ≡ ¬A ∨ B
Contrapositive:
A → B ≡ ¬B → ¬A
Biconditional:
A ↔ B ≡ (A → B) ∧ (B → A) ≡ (A ∧ B) ∨ (¬A ∧ ¬B)
Distributive Laws:
A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)
A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)
Double Negation:
¬¬A ≡ A
Absorption:
A ∨ (A ∧ B) ≡ A
A ∧ (A ∨ B) ≡ A

3.2 Inference Rules

Modus Ponens:
A, A → B ⊢ B
Modus Tollens:
¬B, A → B ⊢ ¬A
Resolution (core of SAT solvers):
(A ∨ B), (¬B ∨ C) ⊢ (A ∨ C)
Resolution is refutation-complete: to prove KB ⊧ α, show KB ∧ ¬α is unsatisfiable.
Hypothetical Syllogism:
A → B, B → C ⊢ A → C

3.3 CNF Conversion Steps

Steps to convert to CNF:
  1. Eliminate biconditionals: A ↔ B ⇒ (A → B) ∧ (B → A)
  2. Eliminate implications: A → B ⇒ ¬A ∨ B
  3. Push negations inward (De Morgan’s + double negation)
  4. Distribute ∨ over ∧
  5. Result: conjunction of clauses (clause = disjunction of literals)

4. Predicate Logic (Ch 06)

Quantifier Equivalences:
¬∀x P(x) ≡ ∃x ¬P(x)
¬∃x P(x) ≡ ∀x ¬P(x)
Unification:
Find substitution θ such that Apply(θ, p) = Apply(θ, q).
Most General Unifier (MGU) is the most general such θ.
Occur check: x cannot unify with a term containing x (prevents infinite structures).
Skolemization (remove existential quantifiers):
• ∃x P(x) ⇒ P(c) — replace with Skolem constant c
• ∀x ∃y P(x, y) ⇒ ∀x P(x, f(x)) — replace with Skolem function f
• ∀x ∀z ∃y P(x, y, z) ⇒ ∀x ∀z P(x, f(x, z), z)
Skolemization preserves satisfiability (not equivalence).
Generalized Modus Ponens:
p1′, p2′, …, pn′, (p1 ∧ p2 ∧ … ∧ pn → q) ⊢ qθ
where θ = Unify(pi′, pi) for all i.

4.1 FOL to CNF Conversion

Additional steps beyond propositional CNF:
  1. Eliminate implications and biconditionals (same as propositional)
  2. Move negations inward (including quantifier negation rules)
  3. Standardize variables (rename so each quantifier uses a unique variable)
  4. Skolemize: remove ∃ quantifiers
  5. Drop universal quantifiers (all remaining variables are implicitly universal)
  6. Distribute ∨ over ∧

5. Probability & Bayesian Networks (Ch 07)

5.1 Core Probability Rules

Sum Rule (Marginalization):
P(A) = Σb P(A, B=b) = Σb P(A | B=b) P(B=b)
Product Rule:
P(A, B) = P(A | B) · P(B) = P(B | A) · P(A)
Bayes’ Theorem:
P(A | B) = P(B | A) · P(A) / P(B)

With multiple hypotheses:
P(Hi | E) = P(E | Hi) · P(Hi) / Σj P(E | Hj) · P(Hj)
Conditional Independence:
P(A, B | C) = P(A | C) · P(B | C)
Notation: A ⊥ B | C (A is independent of B given C)
Chain Rule (general):
P(X1, X2, …, Xn) = Πi=1..n P(Xi | X1, …, Xi−1)

5.2 Bayesian Networks

Chain Rule for Bayesian Networks:
P(X1, …, Xn) = Πi=1..n P(Xi | Parents(Xi))
Each variable is conditionally independent of its non-descendants given its parents.
Number of Parameters:
For a node X with k binary parents: 2k rows in its CPT (for binary X, 2k independent parameters).
Total parameters for full joint (n binary vars): 2n − 1.
BN reduces this via conditional independence.

5.3 D-Separation Rules

D-separation determines conditional independence in a Bayesian Network. X and Y are d-separated by Z if every undirected path between X and Y is “blocked” by Z.
Structure Pattern Blocked When
Chain A → B → C B is in evidence set Z
Common Cause (Fork) A ← B → C B is in evidence set Z
Common Effect (Collider / V-structure) A → B ← C B and all descendants of B are not in Z
Key Insight: Colliders work opposite! An unobserved collider blocks the path. Observing a collider (or its descendant) opens the path (“explaining away” effect).

5.4 Variable Elimination

Factor Operations:
• Pointwise product: f3(X, Y, Z) = f1(X, Y) · f2(Y, Z)
• Summing out (marginalization): f(X) = Σy f(X, Y=y)

Elimination order matters: affects intermediate factor sizes. Finding optimal order is NP-hard; use heuristics (min-degree, min-fill).

6. Machine Learning (Ch 08)

6.1 Bias-Variance Decomposition

Expected Prediction Error:
E[(y − ŷ)²] = Bias(ŷ)² + Var(ŷ) + σ²

• Bias²: (E[ŷ] − f(x))² — error from wrong assumptions
• Variance: E[(ŷ − E[ŷ])²] — error from sensitivity to training data
• σ² (Irreducible noise): inherent noise in the data
Bias-Variance Tradeoff:
Simple models → high bias, low variance (underfitting)
Complex models → low bias, high variance (overfitting)

6.2 Loss Functions

Mean Squared Error (MSE):
MSE = (1/n) Σi=1..n (yi − ŷi)²
Cross-Entropy Loss (Binary):
L = −[y log(ŷ) + (1 − y) log(1 − ŷ)]
Cross-Entropy Loss (Multi-class):
L = −Σi=1..C yi log(ŷi)
where C = number of classes, yi is 1 for the true class and 0 otherwise.

6.3 Evaluation Metrics

Metric Formula Use When
Accuracy (TP + TN) / (TP + TN + FP + FN) Balanced classes
Precision TP / (TP + FP) Cost of false positive is high
Recall (Sensitivity) TP / (TP + FN) Cost of false negative is high
F1 Score 2PR / (P + R) = 2TP / (2TP + FP + FN) Imbalanced classes
Specificity TN / (TN + FP) Screening tests

6.4 Regularization

L1 Regularization (Lasso):
J(θ) = Loss(θ) + λ Σj |θj|
Promotes sparsity (drives some weights to exactly 0).
L2 Regularization (Ridge):
J(θ) = Loss(θ) + λ Σj θj²
Shrinks weights toward 0 but doesn’t force exact zeros.

6.5 Decision Trees & Information Theory

Entropy:
H(S) = −Σi=1..C pi log2(pi)
Maximum entropy for C classes = log2(C)
Information Gain:
IG(S, A) = H(S) − Σv ∈ Values(A) (|Sv| / |S|) · H(Sv)
ID3 selects the attribute with the highest information gain.
Gini Impurity:
Gini(S) = 1 − Σi=1..C pi²
Used by CART. Gini = 0 means pure node.

6.6 Support Vector Machines

Margin: 2 / ||w||
Optimization: Minimize ½ ||w||² subject to yi(w · xi + b) ≥ 1
Kernel Trick:
• Linear: K(x, z) = x · z
• Polynomial: K(x, z) = (x · z + c)d
• RBF/Gaussian: K(x, z) = exp(−||x − z||² / 2σ²)

6.7 Naïve Bayes Classifier

Classification Rule:
ŷ = argmaxc P(C=c) · Πi=1..n P(xi | C=c)
Assumes features are conditionally independent given the class.
Laplace Smoothing:
P(xi | C=c) = (count(xi, c) + 1) / (count(c) + |vocabulary|)

7. Neural Networks & Deep Learning (Ch 09)

7.1 Perceptron

Perceptron Output:
y = σ(w · x + b) where σ is the activation function (step function for classical perceptron)
Perceptron Learning Rule:
wi ← wi + η (y − ŷ) xi
Converges in finite steps if data is linearly separable (Perceptron Convergence Theorem).
XOR Problem: A single perceptron cannot solve XOR — requires a multi-layer network (at least one hidden layer).

7.2 Activation Functions

Function Formula Range Key Property
Sigmoid σ(z) = 1 / (1 + e−z) (0, 1) Output interpretable as probability; vanishing gradient
Tanh tanh(z) = (ez − e−z) / (ez + e−z) (−1, 1) Zero-centered; still has vanishing gradient
ReLU f(z) = max(0, z) [0, ∞) No vanishing gradient for z > 0; dying ReLU problem
Leaky ReLU f(z) = max(αz, z), α ≈ 0.01 (−∞, ∞) Fixes dying ReLU
Softmax σ(zi) = ezi / Σj ezj (0, 1), sums to 1 Used for multi-class output layer

7.3 Backpropagation

Error Signal (Output Unit j):
δj = (yj − oj) · σ′(netj)
where netj = Σi wij oi
Error Signal (Hidden Unit j):
δj = σ′(netj) · Σk wjk δk
(sum over all units k in the next layer)
Weight Update:
Δwij = −η · δj · oi
wij ← wij + Δwij
where η = learning rate, oi = output of unit i
Gradient Descent Variants:
• SGD: Update after each sample
• Mini-batch: Update after a batch of samples
• Adam: Adaptive learning rates with momentum — mt = β1mt−1 + (1−β1)gt, vt = β2vt−1 + (1−β2)gt²

7.4 Convolutional Neural Networks

Output Size (1D):
output = ⌊(n − f + 2p) / s⌋ + 1
where n = input size, f = filter size, p = padding, s = stride
Number of Parameters (Conv Layer):
params = (f × f × cin + 1) × cout
where f = filter size, cin = input channels, cout = output channels (filters), +1 for bias

7.5 Attention Mechanism

Scaled Dot-Product Attention:
Attention(Q, K, V) = softmax(QKT / √dk) · V
where Q = queries, K = keys, V = values, dk = dimension of keys.
Scaling by √dk prevents softmax saturation for large dk.
Multi-Head Attention:
MultiHead(Q, K, V) = Concat(head1, …, headh) WO
where headi = Attention(QWiQ, KWiK, VWiV)

8. Reinforcement Learning (Ch 12)

8.1 Markov Decision Processes

MDP Tuple: (S, A, P, R, γ) where S = states, A = actions, P(s′|s,a) = transition model, R(s,a,s′) = reward, γ = discount factor (0 ≤ γ < 1).
Bellman Equation (State Value):
Vπ(s) = Σa π(a|s) Σs′ P(s′|s,a) [R(s,a,s′) + γ Vπ(s′)]
Bellman Optimality Equation (Value):
V*(s) = maxa Σs′ P(s′|s,a) [R(s,a,s′) + γ V*(s′)]
Bellman Optimality Equation (Q-value):
Q*(s,a) = Σs′ P(s′|s,a) [R(s,a,s′) + γ maxa′ Q*(s′,a′)]
Relationship: V*(s) = maxa Q*(s,a) and π*(s) = argmaxa Q*(s,a)

8.2 Value Iteration

Update Rule:
Vk+1(s) = maxa Σs′ P(s′|s,a) [R(s,a,s′) + γ Vk(s′)]

Convergence: Vk → V* as k → ∞. Stop when maxs |Vk+1(s) − Vk(s)| < ε.
Convergence rate depends on γ: smaller γ = faster convergence.

8.3 Policy Iteration

Two alternating steps:
1. Policy Evaluation: Solve Vπ(s) = Σs′ P(s′|s, π(s)) [R + γ Vπ(s′)] (system of linear equations)
2. Policy Improvement: π′(s) = argmaxa Σs′ P(s′|s,a) [R + γ Vπ(s′)]

Converges in a finite number of iterations (at most |A||S| iterations).

8.4 Temporal Difference Learning

TD(0) Update:
V(s) ← V(s) + α [r + γ V(s′) − V(s)]
Bootstraps using current estimate. Combines ideas of MC and DP.
Q-Learning (Off-Policy TD):
Q(s,a) ← Q(s,a) + α [r + γ maxa′ Q(s′,a′) − Q(s,a)]
Converges to Q* regardless of exploration policy (with sufficient exploration and decaying α).
SARSA (On-Policy TD):
Q(s,a) ← Q(s,a) + α [r + γ Q(s′,a′) − Q(s,a)]
Uses the actual next action a′ chosen by the policy (not max).

8.5 Exploration Strategies

ε-Greedy:
With probability 1 − ε: choose a = argmaxa Q(s,a)
With probability ε: choose a random action uniformly
Boltzmann (Softmax) Exploration:
P(a|s) = eQ(s,a)/T / Σa′ eQ(s,a′)/T
Temperature T controls exploration: high T = random, low T = greedy.

9. Constraint Satisfaction Problems (Ch 14)

CSP Definition: (X, D, C) where X = set of variables, D = domains, C = constraints.
Arc Consistency (AC-3):
Xi is arc-consistent w.r.t. Xj if for every value in Di there exists some value in Dj that satisfies the constraint between Xi and Xj.
Complexity: O(ed³) where e = number of arcs, d = domain size.
Backtracking Search Heuristics:
• MRV (Minimum Remaining Values): Choose variable with fewest legal values
• Degree Heuristic: Choose variable involved in most constraints on unassigned variables
• LCV (Least Constraining Value): Choose value that rules out fewest choices for neighbors

10. Natural Language Processing (Ch 10)

N-gram Probability:
P(wn | w1…wn−1) ≈ P(wn | wn−N+1…wn−1)
Bigram: P(wn | wn−1), Trigram: P(wn | wn−2, wn−1)
TF-IDF:
TF(t,d) = count(t in d) / |d|
IDF(t) = log(N / df(t))
TF-IDF(t,d) = TF(t,d) × IDF(t)
High value = important word in a specific document.
Perplexity:
PP(W) = P(w1…wN)−1/N
Lower perplexity = better language model.
Cosine Similarity:
cos(θ) = (A · B) / (||A|| · ||B||)

11. Planning (Ch 13)

STRIPS Representation:
Action(a): Precondition(a), Effect(a) = Add(a) ∪ Del(a)
State: set of ground atoms (closed-world assumption: unlisted atoms are false)
Planning Graph Levels:
• S0 = initial state literals
• Ai = actions whose preconditions are in Si (+ persistence actions)
• Si+1 = effects of actions in Ai
• Mutex relations: Inconsistent effects, interference, competing needs, inconsistent support
GraphPlan heuristic for A*:
h(s) = level at which all goals first appear without mutex in the planning graph (admissible heuristic).

12. Quick Reference: Common GATE Calculations

12.1 Complexity Cheat-Sheet

Algorithm Time Space Notes
BFSO(bd)O(bd)Complete, optimal (uniform cost)
DFSO(bm)O(bm)Not complete, not optimal
IDDFSO(bd)O(bd)Complete, optimal (uniform cost)
UCSO(b1+⌊C*/ε⌋)O(b1+⌊C*/ε⌋)Complete, optimal
A* (Tree)O(bd) typicalO(bd)Optimal if h admissible
A* (Graph)O(bd) typicalO(bd)Optimal if h consistent
MinimaxO(bm)O(bm)Exponential in depth
Alpha-Beta (best)O(bm/2)O(bm)Perfect move ordering
AC-3O(ed³)O(e + nd)e=arcs, d=domain, n=vars

12.2 Useful Counting Formulas

Nodes in a complete tree: 1 + b + b² + … + bd = (bd+1 − 1) / (b − 1)
Number of propositional models: 2n for n propositional symbols
BN CPT entries: For binary node with k binary parents: 2k independent parameters
Geometric sum for discounted rewards:
Σt=0..∞ γt R = R / (1 − γ)  —  maximum total return for constant reward R
Conv output dimension: ⌊(n − f + 2p) / s⌋ + 1

12.3 Important Identities & Inequalities

Triangle Inequality (heuristic admissibility check):
h(n) ≤ c(n, n′) + h(n′) ⇒ consistent heuristic
Jensen’s Inequality:
f(E[X]) ≤ E[f(X)] for convex f
Useful in deriving cross-entropy and KL divergence properties.
KL Divergence (Relative Entropy):
DKL(P || Q) = Σx P(x) log(P(x) / Q(x)) ≥ 0
Not symmetric: DKL(P||Q) ≠ DKL(Q||P)

13. Last-Minute Exam Tips

Formula Recall Strategy:
  • Group similar formulas: Bellman equations all share the same structure — learn the template, not each variant separately.
  • Derive, don’t memorize: Understand where each formula comes from. If you forget Bayes’ theorem, you can derive it from the product rule.
  • Boundary checks: Plug extreme values (γ=0, γ=1, ε→0, b=1) to verify your formula makes sense.
  • Units/dimensions: In probability, results must be in [0,1]. In search, complexity must use correct parameters (b, d, m).
Common Formula Pitfalls in GATE:
  • Confusing BFS space O(bd) with DFS space O(bm) — these are very different!
  • Forgetting that A* Graph Search needs consistency (not just admissibility) for optimality.
  • Mixing up α (learning rate in ML) with α (alpha in alpha-beta pruning).
  • Using P(A|B) when you need P(B|A) — always write out Bayes’ theorem fully.
  • Forgetting to Skolemize before applying resolution in FOL.