How to find the closed form solution of this equation? Is there a repeatable pattern for solving this equation?
$$T(n) = \begin{cases} 1 & n = 1\\ 5T(n-1) + n^2 & \text{otherwise} \end{cases}$$
How to find the closed form solution of this equation? Is there a repeatable pattern for solving this equation?
$$T(n) = \begin{cases} 1 & n = 1\\ 5T(n-1) + n^2 & \text{otherwise} \end{cases}$$
How to find the closed form solution of this equation?
This is linear nonhomogeneous recurrence relation of the form $a_n = a_n^{h}+a_n^{p}$ where former expression in the right hand side is homogeneous solution while later one particular. Now, $a_n^p$ becomes $p_2n^2+p_1n+p_0$ whereas $a_n^h$ becomes $\alpha5^n$. Now solve them.
Another straightforward approach is to recursively solve the equation as follows $$\begin{align*} T(n) &= 5\cdot T(n-1)+n^2 \\ &= 5[5\cdot T(n-2)+(n-1)^2]+n^2 \\ &= 5^2T(n-2)+5(n-1)^2 + n^2 \\ &= 5^3T(n-3)+5^2(n-2)^2 + 5(n-1)^2 + n^2 \\ & \vdots\\ &= \sum_{k=0}^{n-1}5^{n-k}\cdot k^2 \end{align*}$$
Is there a repeatable pattern for solving this equation?
The very word recurrence implies pattern.