I'm trying to find the tightest upper bound for runtime of a function whose recurrence relation is the following: $T(n) = 2T(n/4) + O(n^2 \log n)$
I got $O(n^2 \log n)$ but I'm not sure if that is correct. I arrived to the solution using the Advanced master theorem: https://www.geeksforgeeks.org/advanced-master-theorem-for-divide-and-conquer-recurrences/#
One way to arrive at the desired bound is to expand the recurrence. We will compute the first few iterations and then generalise. The first one is:
$$T(n) = n^2 \lg n + 2T\left( \frac{n}{4} \right)$$
Then:
$$T(n) = n^2 \lg n + 2 \left( \frac{n}{4} \right)^2 \lg \frac{n}{4} + 2^2 T\left( \frac{n}{4^2} \right)$$
And after one more:
$$T(n) = n^2 \lg n + 2 \left( \frac{n}{4} \right)^2 \lg \frac{n}{4} + 2^2 \left( \frac{n}{4^2} \right)^2 \lg \frac{n}{4^2} + 2^3 T\left( \frac{n}{4^3} \right)$$
Now we generalise to:
$$T(n) = \sum_{i = 0}^{\frac{1}{2} \lg n} \frac{1}{8^i} n^2 \lg \frac{n}{4^i} + \sqrt{n} $$
$$= n^2 \lg n \sum_{i = 0}^{\frac{1}{2} \lg n} \frac{1}{8^i} - n^2 \sum_{i = 0}^{\frac{1}{2} \lg n} \frac{2i}{8^i} + \sqrt{n} $$
We can bound $T(n)$ from below:
$$T(n) \geq n^2 \lg n \sum_{i = 0}^{\frac{1}{2} \lg n} \frac{1}{8^i} - n^2 \sum_{i = 1}^{\frac{1}{2} \lg n} \frac{1}{4^i} + \sqrt{n}$$
And from above:
$$ T(n) \leq n^2 \lg n \sum_{i = 0}^{\frac{1}{2} \lg n} \frac{1}{8^i} + \sqrt{n} $$
The bound $\frac{1}{2} \lg n$ is the number of times $n$ needs to be divided by $4$ to reduce $n$ to $O(1)$, i.e. $n = 4^k = 2^{2k}$ and so $k = \frac{1}{2} \lg n$. Computing the geometric series gives:
$$ T(n) \geq \frac{8}{7} n^2 \lg n - \frac{1}{7} \sqrt{n} \lg n - \frac{1}{3} n^2 + \frac{1}{3} n + \sqrt{n}$$
$$T(n) \leq \frac{8}{7} n^2 \lg n - \frac{1}{7} \sqrt{n} \lg n + \sqrt{n}$$
And so we conclude $T(n) = O(n^2 \lg n)$, which we can verify using the substitution method. Removing lower order terms we assume $T(n) \leq c n^2 \lg n$. Now we substitute into the recurrence relation:
$$T(n) = 2T\left( \frac{n}{4} \right) + kn^2 \lg n $$ $$T(n) = 2\left( c \left( \frac{n}{4} \right)^2 \lg \frac{n}{4} \right) + kn^2 \lg n $$
$$T(n) = \frac{c}{8} n^2 \lg \frac{n}{4} + kn^2 \lg n$$ $$T(n) = \frac{c}{8} n^2 \lg n - \frac{c}{4} n^2 + kn^2 \lg n$$ $$T(n) = \left( \frac{c}{8} + k\right)n^2 \lg n - \frac{c}{4} n^2$$ $$T(n) \leq cn^2 \lg n$$
The last inequality holds for sufficiently large $c$, e.g. $\frac{8}{7} k \leq c$. Which shows that $T(n) = O(n^2 \lg n)$ as you thought. We could have also verified the bound by plugging the recurrence relation into a tool like Wolfram Alpha which gives the desired upper bound.