Recurrence Relations – Solving by Substitution

recurrence-relationsrecursive algorithms

I have an exercise where I need to prove by using the substitution method the following
$$T(n) = 4T(n/3)+n = \Theta(n^{\log_3 4})$$
using as guess like the one below will fail, I cannot see why, though, even if I developed the substitution
$$T(n) ≤ cn^{\log_3 4}$$
finally, they ask me to show how to substract off a lower-order term to make a substitution proof work. I was thiking about using something like
$$T(n) ≤ cn^{\log_3 4}-dn$$
but again, I cannot see how to verify this recurrence.

What I did:

$$T(n) = 4T(n/3)+n$$
$$\qquad ≤ \frac{4c}{3}n^{\log_3 4} + n$$

and then from here, how to proceed and conclude that the first guess fails?

The complete exercise says:

Using the master method, you can show that the solution to the recurrence $T(n) = 4T(n/3)+n$ is $T(n)=\Theta(n^{log_3 4})$. Show that a substitution proof with the assumption $T(n) ≤ cn^{log_3 4}$ fails. Then show how to subtract off a lower-order term to make a substitution proof work.

Best Answer

It seems the cause of your trouble is simply that you made a mistake while computing $(n/3)^{\log_34}$, which is $n^{\log_34}/4$ and not $n^{\log_34}/3$.

(Note that $(n/3)^{\log_34}=n^{\log_34}/3^{\log_34}$ and that $3^{\log_34}=\exp(\ln3\cdot\log_34)$ with $\ln3\cdot\log_34=\ln3\cdot\ln4/\ln3=\ln4$ hence $3^{\log_34}=4$.)

Anyway, the hint you were given is to assume that $T(n)\leqslant An^{\log_34}+Bn$ $(*)$ and to check if $(*)$ is hereditary for some suitable $B$. Hence, assume $(*)$ holds for $n/3$, then $$ T(n)=4T(n/3)+n\leqslant 4A(n/3)^{\log_34}+4B(n/3)+n=An^{\log_34}+(4B/3+1)n, $$ and one sees that $(*)$ holds for $n$ as soon as $4B/3+1\leqslant B$, for example for $B=-3$.

Now, choosing $A$ large enough such that $T(n)\leqslant An^{\log_34}-3n$ holds for $n$ small, one sees that $T(n)\leqslant An^{\log_34}-3n$ holds for every $n$.

Likewise, there exists $A'$ such that $T(n)\geqslant A'n^{\log_34}-3n$ holds for $n$ small, and this is enough to guarantee that $T(n)\geqslant A'n^{\log_34}-3n$ holds for every $n$. Thus, $T(n)=\Theta(n^{\log_34})$.

In hindsight, all this can be made easier using the change of variable $\bar T(n)=T(n)+3n$ since $\bar T(n)=4T(n/3)+n+3n=4\bar T(n/3)$, a recursion whose solution can be computed directly.

Related Question