1

In the below solution to find an asymptotic bound on the recurrence $T(n)=T(n-1)+T(n-2)$ (where $T(0) = T(1)=1$), I was unsure how we could conclude that $T(n)=\Theta\left(a^n\right)$ for some $a$:

Solution: We apply the squeeze + guess & check method. First, we can lower bound it by, $T(n) \geq 2 T(n-2)$, so we know $T(n)=\Omega\left(2^{n / 2}\right)$. We can also upper-bound it by $T(n) \leq 2 T(n-1)$, which gives $T(n)=O\left(2^n\right)$. Hence, $T(n)=2^{\Theta(n)}$. However, we can actually compute a more precise runtime! Since we know the runtime is exponential with respect to $n$, we can write the runtime in the form $T(n)=\Theta\left(a^n\right)$. Then, plugging this into the recurrence, we have

(The above portion goes on for some more). I do not understand how we can conclude that $T(n)=\Theta\left(a^n\right)$ for some $a$. From my understanding, we only know that there exists some function $f$ such that $T(n) = 2^{f(n)}$. What is the reason why we can conclude this?

Princess Mia
  • 3,170
  • 2
    I think $T(n)\ge 0$, so $T(n)$ is increasing monotonically. And then you have $T(n)\ge 2T(n-2) \ge \dots\ge 2^{n/2}T(0)$, so it is at least exponential. – Noctis Sep 17 '24 at 08:08

1 Answers1

1

These are the Fibonacci numbers.

More specifically if you call the golden ratio $\varphi,\bar\varphi=\frac{1\pm\sqrt{5}}2$ (first one with $+$ sign , second one with $-$ sign) they are both roots of $x^2=x+1$ and this equation can be rewritten $$(x-\varphi)(x-\bar\varphi)=0\\x^2-(\varphi+\bar\varphi)x+\varphi\bar\varphi=0\\(x^2-\varphi x)-\bar\varphi(x-\varphi)=0$$

Therefore $$T_n=T_{n-1}+T_{n-2}\iff \overbrace{(T_n-\varphi T_{n-1})}^{U_n}-\bar\varphi\ \overbrace{(T_{n-1}-\varphi T_{n-2})}^{U_{n-1}}=0$$


And you can rewrite it as a system $\begin{cases}T_n-\varphi T_{n-1}=U_n\\U_n-\bar\varphi U_{n-1}=0\end{cases}$

You recognize a geometric series $U_n=\bar\varphi^n\ U_0$

And similarly the other with RHS solves to $T_n=a\,\varphi^n+b\, \bar\varphi^n$

I let it to you to find $a,b$ by applying initial conditions $\begin{cases}T_0=a+b=1\\T_1=a\varphi+b\bar\varphi=1\end{cases}$

Notice that numerical value $|\bar\varphi|<1$ so asymptotically $\bar\varphi^n\to 0$

It results that $T_n\sim a\varphi^n$

zwim
  • 29,833
  • Check on my homepage https://math.stackexchange.com/q/4205834/399263 for more details. – zwim Sep 17 '24 at 12:01