[Math] Find the asymptotic tight bound for $T(n) = 4T(n/2) + n^{2}\log n$

asymptoticsrecurrence-relations

Find the asymptotic tight bound in

$$
T(n) = 4T\left(\frac{n}{2}\right) + n^{2}\log n.
$$

where $ \log n= \log _{2}n $ and $T(1) = 1$.

I should solve this using all three common methods: iteration, master theorem and substitution.

It is highly likely that this kind of recurrence equation will be in my test in two days. Thank you very much in advance!

Best Answer

You're likely to get a comment about asking multiple questions as one big one, but to get you started, I'll do an iterative expansion.

Let $n=2^k$, since strictly speaking those are the only values for which your recurrence makes sense. Then your recurrence takes the form $$ T(2^k) = 2^2T(2^{k-1})+2^{2k}k $$ Now let's iterate $$\begin{align} T(2^k) &= 2^2[T(2^{k-1})]+2^{2k}k \\ &= 2^2[2^2T(2^{k-2})+2^{2(k-1)}(k-1)]+2^{2k}k\\ &\qquad= 2^4T(2^{k-2})+2^{2k}(k-1)+2^{2k}k\\ &= 2^4[2^2T(2^{k-3})+2^{2(k-2)}(k-2)]+2^{2k}(k-1)+2^{2k}k\\ &\qquad= 2^6T(2^{k-3})+2^{2k}(k-2)+2^{2k}(k-1)+2^{2k}k \end{align}$$ and the general pattern appears to be $$\begin{align} T(2^k) &= 2^{2j}T(2^{k-j})+2^{2k}(k-j+1)+2^{2k}(k-k+2)+\cdots+2^{2k}k\\ &= 2^{2j}T(2^{k-j})+2^{2k}((k-j+1)+(k-j+2)+\cdots k) \end{align}$$ assuming we've correctly guessed the pattern, we let $j=k$ and obtain $$ T(2^k)= 2^{2k}T(2^0)+2^{2k}(1+2+3+\cdots k)=(2^k)^2+(2^k)^2\frac{k(k+1)}{2} $$ Finally, recall that we set $n=2^k$ so $k=\lg n$ so we have the solution $$ T(n) =n^2+n^2\frac{\lg n(\lg n+1)}{2}=\Theta(n^2\lg^2n) $$ Now all you have to do is complete the remaining two parts. (grins)