We never dump a formula. Here is the engine, step by step.
Suppose T(n)=aT(n/b)+h(n).
GuessT(n)≤cf(n) — call this the inductive hypothesis (IH).
Assume IH holds for all smaller values, in particular for n/b:
T(n/b)≤cf(n/b).Why this step? Induction lets us assume the claim for inputs smaller than n; n/b<n qualifies.
Substitute into the recurrence:
T(n)=aT(n/b)+h(n)≤acf(n/b)+h(n).Why this step? Replacing T(n/b) by its (assumed) upper bound only increases or preserves the right side — legal for an upper bound.
Massage the right side until it is ≤cf(n). The leftover terms must be absorbed. If you can choose c so the residual is ≤0, you win.
Base case: check small n (e.g. n=1) so the induction is grounded.
Imagine a magic box that, to answer a big question, asks two smaller copies of itself and adds a little work of its own. You want to know how long the whole thing takes. You make a smart guess ("I bet it takes about nlogn seconds"). Then you play a game: pretend the smaller boxes already obey your guess, plug that in, and check whether the big box still obeys it. If the leftover work disappears (becomes zero or negative), your guess was right! If a stubborn piece won't go away, your guess was wrong and you try a bigger one. You also check the tiniest box by hand so the whole chain of "pretends" stands on solid ground.
Substitution method ka idea simple hai: recurrence (jaise T(n)=2T(n/2)+n) apne answer ko apne andar chhupa ke rakhta hai. Hum pehle ek smart guess maarte hain — "bhai, ye toh O(nlogn) lag raha hai" — aur phir induction se prove karte hain. Isko "substitution" isliye kehte hain kyunki hum apna guess (smaller input ke liye) wapas recurrence mein substitute karke check karte hain ki inequality survive karti hai ya nahi.
Recipe yaad rakho — G-A-S-A-B: Guess karo, smaller n ke liye Assume karo, recurrence mein Substitute karo, jo leftover bachta hai usko Absorb karo (woh ≤0 hona chahiye SAME constant c ke saath), aur Base case check karo. Agar leftover term (−(c−1)n wala) negative ho gaya, matlab guess sahi hai.
Sabse bada trap: agar tumhe (c+1)n mila aur tum khush ho gaye ki "linear hi toh hai", toh galat! Induction mein wahi c wapas aana chahiye, badhna nahi chahiye. Constant har level pe badhta jaaye toh logn levels mil ke pura nlogn ban jaata hai. Isiliye T(n)=2T(n/2)+n ka actual answer Θ(nlogn) hai, O(n) nahi.
Aur ek pro-tip: kabhi-kabhi seedha guess fail hota hai chhote se leftover ke wajah se. Tab hypothesis ko strong karo — T(n)≤cn−d guess karo. Ulta lagta hai, par stronger assumption se inductive step mein zyada cheez maan-ne ko milti hai, jisse proof aasaan ho jaata hai. Base case kabhi mat bhoolna, aur nlogn ke liye n0=2 se shuru karo kyunki log1=0 hota hai.