Recurrence Relation and Master Theorem Calculator

Analyze divide-and-conquer recurrences of the form T(n)=aT(n/b)+Θ(n^k log^p n) using Master Theorem intuition.

AlgorithmsDiscrete MathComputer Science Math

Calculate

Model: T(n) = aT(n/b) + Θ(n^k log^p n)

a subproblems
Split factor b
k in n^k
p in log^p n
Example label
Please enter valid values.

What this calculator teaches

Recurrences describe recursive algorithm running time. The Master Theorem compares the work done at the leaves with the work done at each level.

This calculator gives a practical Big-O/Theta style classification for common divide-and-conquer recurrences.

Formula & Symbols

ConceptFormulaMeaning
RecurrenceT(n)=aT(n/b)+f(n)a subproblems, each of size n/b.
Critical exponentc = log_b(a)Compare f(n) with n^c.
Master comparisonf(n)=Θ(n^k log^p n)k and p describe nonrecursive work.

Step-by-Step Examples

Example 1
Merge sort
  • Merge sort has T(n)=2T(n/2)+n.
  • a=2, b=2, so c=log₂2=1.
  • f(n)=n, so k=1 and p=0.
✓ Θ(n log n).
Example 2
Binary search
  • Binary search has T(n)=T(n/2)+1.
  • a=1, b=2, c=0.
  • f(n)=1, so k=0 and p=0.
✓ Θ(log n).

Where students use this

🎓
High school and college
Use the tool to check homework and understand each step.
📊
Data and modeling
Connect formulas to tables, graphs, and real values.
🧪
Science and engineering
Use math results inside physics, chemistry, and engineering problems.
💻
Computer science
Apply the same logic to algorithms, systems, and numerical work.

Common Mistakes to Avoid

⚠️
Forgetting b must be greater than 1

The split factor b describes smaller subproblems, so b > 1.

⚠️
Comparing only a and b

You must compare f(n) to n^{log_b a}.

⚠️
Using Master Theorem for every recurrence

Some recurrences need recursion trees, substitution, Akra-Bazzi, or other methods.

Frequently Asked Questions

What is a recurrence relation?
It defines a value using smaller versions of itself.
What does a mean?
a is the number of recursive subproblems.
What does b mean?
b tells how much the input size shrinks in each recursive call.
What is log_b(a)?
It is the exponent that describes the growth from the recursion leaves.

Related Math Calculators

Formula Explorer connections

Interpretation: This relationship counts discrete structures, analyzes logic and sets, or describes algorithmic growth. Assumption: Define the sample space, recurrence, logical variables and counting constraints precisely. Avoid double counting and distinguish worst, average and best cases.

Recursive Runtime Calculator →Relation Properties Calculator →Set Cardinality Calculator →Math Formula Explorer →