# $T(n) = 2T(n-1)$ Recurrences

What would be the complexity of the following recurrence?

$$T(n) = 2T(n-1)$$

• What do you mean by complexity of the recurrence? What is the complexity of the recurrence $T(n) = T(n-1) + 1$, for example? – Yuval Filmus Mar 28 '18 at 21:18
• Your recurrence $T(n) = 2T(n-1)$ isn't satisfied by your initial values. That's like asking "if $x = 0$ and $x = 1$, then which is true, $x = 0$ or $x = 1$?" – Yuval Filmus Mar 28 '18 at 21:22
• Possible duplicate of Solving or approximating recurrence relations for sequences of numbers – David Richerby Mar 29 '18 at 10:26

Note: The original version of the post included the initial values $T(0) = 0$ and $T(1) = 1$.

If $T(n) = 2T(n-1)$ for all $n > C$ then, as you can prove by induction, $$T(n) = 2^{n-C} T(C).$$ In particular, in your case $T(n) = 2^{n-1}$. Note that given your initial values, the recurrence $T(n) = 2T(n-1)$ cannot hold for $n=1$; presumably it holds for all larger $n$.

You are asking for the complexity of the recurrence. Recurrences have no such thing as complexity. A recurrence might describe the running time of an algorithm, and then its solution is the time complexity of the algorithm. But a recurrence can describe any number of things, or even be completely abstract.

i don't know what do you mean about complexity of reccurence but if you want to find the closed form you can use the backward substitution method:
$T(n) = 2T(n-1)$
and then expand the $T(n-1)$:
$T(n) = 2(2T(n-2))$
and after that expand $T(n-2)$:
$T(n) = 2(2(2T(n-3)))$
...
$T(n) = 2^nT(0)$
and if you have $T(0) = C$ as a base case, your closed form would be: $T(n) = C2^n$

• What if $T(0) = 0$, does that make $T(n)=0$ and therefore $T(n)=O(1)$ instead of $T(n)=O(2^n)$? This is what confuses me the most – Josh3248 Mar 29 '18 at 11:22
• in practice, when you have a base case like: $T(0) = 0$, you mean the cost of the algorithm with the size of ZERO is ZERO and after that for the size of ONE is ZERO too. because the closed form constructed by the base case and the equation doesn't have a heterogeneous part, it is strictly based on the base case and i think it doesn't true because of the wrong base case value. – Danial Bidekani Bakhtiarvand Mar 29 '18 at 14:20