Generate an explicit formula for: $a_n=a_{n-1}+n^2-5n+7, a_3=2$ So I'm currently solving this math homework problem and I've set up a recursive formula:

$a_n=a_{n-1}+n^2-5n+7; a_3=2$

Right now, I'm having trouble as to where to start. I was listing out the cases but they didn't get me very far: $a_3=2,a_4=5,a_5=12,a_6=25, \dots$
Thanks!
 A: $$a_n=a_{n-1}+n^2-5n+7,a_3=2$$
Let's sub $a_{n-2}+(n-1)^2-5(n-1)+7$ for $a_{n-1}$, we get
$$a_n=a_{n-2}+((n-1)^2+n^2)-5((n-1)+n)+(7+7)$$
We can see that if we keep subbing like this we get:
\begin{eqnarray}
a_n&=&a_{n-(n-3)}+\sum_{k=n-(n-3+1)}^{n}(k^2-5k+7)\\
&=&a_{3}+\sum_{k=2}^{n}k^2-5\sum_{k=2}^{n}k+\sum_{k=2}^{n}7\\
&=&2+\sum_{k=1}^{n}k^2-1
-\left(5\sum_{k=1}^{n}k-5\right)
+\sum_{k=1}^{n}7-7\\
&=&\dfrac{n(n+1)(2n+1)}{6}-\dfrac{5n(n+1)}{2}+7n-1
\end{eqnarray}
A: We may observe that:
$$
a_n-a_{n-1}=n^2-5n+7.
$$
Then we could have:
$$
\begin{align}
&a_n-a_3\\
=&\sum_{k=4}^n{a_k-a_{k-1}}\\
=&\sum_{k=4}^n{k^2-5k+7}\\
=&\left[ \left( \sum_{k=1}^n{k^2} \right) -1^2-2^2-3^2 \right] -\frac{5\left( 4+n \right) \left( n-3 \right)}{2}+7\left( n-3 \right)\\
=&\left[ \frac{n\left( n+1 \right) \left( 2n+1 \right)}{6}-14 \right] -\left( \frac{5}{2}n^2+\frac{5}{2}n-30 \right) +\left( 7n-21 \right)\\
=&\frac{1}{3}n^3-2n^2+\frac{14}{3}n-5,
\end{align}
$$
(note that the above summation has $(n-3)$ items).
So the explicit formula could be obtained by $a_n=(a_n-a_3)+a_3$:
$$
a_n=\frac{1}{3}n^3-2n^2+\frac{14}{3}n-3.
$$
